gpt4 book ai didi

c++ - GMP、MPC、MPFR的库文件和头文件是分开的,如何安装GCC?

转载 作者:行者123 更新时间:2023-11-30 02:45:59 25 4
gpt4 key购买 nike

我认为这是我安装 GCC 的问题。我不断得到

checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... yes
checking for the correct version of the gmp/mpfr/mpc libraries... no

当我打字时

/Users/[username]/Documents/gcc-4.8.3/configure --with-gmp=/usr/local
--with-mpc=/usr/local --with-mpfr=/usr/local

[用户名] 是我的实际用户名。

我安装了 GMP、MPC 和 MPFR,但这三者的文件分布在/usr/local 中的不同文件夹中。所有头文件都在/usr/local/include 中,但库文件在/usr/local/lib 中。

最佳答案

你应该能从这里弄明白:

$ ~/src/gcc/gcc/configure --help | fgrep gmp
--with-gmp-dir=PATH this option has been REMOVED
--with-gmp=PATH specify prefix directory for the installed GMP
--with-gmp-include=PATH/include plus
--with-gmp-lib=PATH/lib
--with-gmp-include=PATH specify directory for installed GMP include files
--with-gmp-lib=PATH specify directory for the installed GMP library

此外,https://gcc.gnu.org/install/prerequisites.html

Alternatively, if GMP is already installed but it is not in your library search path, you will have to configure with the --with-gmp configure option. See also --with-gmp-lib and --with-gmp-include.

当然,https://gcc.gnu.org/install/configure.html

--with-gmp=pathname
--with-gmp-include=pathname
--with-gmp-lib=pathname
--with-mpfr=pathname
--with-mpfr-include=pathname
--with-mpfr-lib=pathname
--with-mpc=pathname
--with-mpc-include=pathname
--with-mpc-lib=pathname
If you want to build GCC but do not have the GMP library, the MPFR library and/or the MPC library installed in a standard location and do not have their sources present in the GCC source tree then you can explicitly specify the directory where they are installed (‘--with-gmp=gmpinstalldir’, ‘--with-mpfr=mpfrinstalldir’, ‘--with-mpc=mpcinstalldir’). The --with-gmp=gmpinstalldir option is shorthand for --with-gmp-lib=gmpinstalldir/lib and --with-gmp-include=gmpinstalldir/include. Likewise the --with-mpfr=mpfrinstalldir option is shorthand for --with-mpfr-lib=mpfrinstalldir/lib and --with-mpfr-include=mpfrinstalldir/include, also the --with-mpc=mpcinstalldir option is shorthand for --with-mpc-lib=mpcinstalldir/lib and --with-mpc-include=mpcinstalldir/include. If these shorthand assumptions are not correct, you can use the explicit include and lib options directly. You might also need to ensure the shared libraries can be found by the dynamic linker when building and using GCC, for example by setting the runtime shared library path variable (LD_LIBRARY_PATH on GNU/Linux and Solaris systems).

这应该很明显地表明,文件不会全部位于一个目录中是完全正常的,甚至是意料之中的。几乎所有 UNIX 软件都将头文件和库安装在单独的目录中。

在树中构建这些库并将 GCC 静态链接到它们通常更容易,如 http://gcc.gnu.org/wiki/InstallingGCC 中所述

关于c++ - GMP、MPC、MPFR的库文件和头文件是分开的,如何安装GCC?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23985368/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com