【原创】解决glibc编译报错:configure: error: you must configure in a separate build directory

blogdaren 2018-06-29 抢沙发 3718人次

问题背景:

[root@node1 software]# cd glibc-2.15
[root@node1 glibc-2.15]# ./configure 
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for readelf... readelf
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ can link programs... yes
configure: error: you must configure in a separate build directory

问题原因:

查阅源码包INSTALL文档发现:不要直接在源码目录中直接执行 ./configure,否则可能引起系统不稳定。

33.png

解决方案:

根据提示我们在源码目录中新建一个目录比如叫:/path/to/glibc-2.15/build,然后在此目录正常编译即可:

mkdir /path/to/glibc-2.15/build
cd /path/to/glibc-2.15/build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
make && make install 

注意事项:

编译时,最好不要安装在默认的 /usr/local 目录,官方表示这可能造成系统不稳定,所以我们最好手动指定比如:/usr/local/glibc-2.15

GNU C Library should not be installed into
*** /usr/local since this might make your system totally unusable.
*** We strongly advise to use a different prefix. For details read the FAQ.
*** If you really mean to do this, run configure again using the extra
*** parameter `--disable-sanity-checks'.

#glibc#

版权声明:除非注明,本文由( blogdaren )原创,转载请保留文章出处。

本文链接:【原创】解决glibc编译报错:configure: error: you must configure in a separate build directory

发表评论:

您的昵称:
电子邮件:
个人主页: