Linux下安装QT的剧痛经历 联系客服

发布时间 : 星期一 文章Linux下安装QT的剧痛经历更新完毕开始阅读f53df919ddccda38376baf9d

上网上搜索到几个网址:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40360 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35693 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35577 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36248

说的问题都很相似,但可能不是同一个版本。大致看了一下,有可能是mpfr库的路径造成的问题,于是想按照示例指定mpfr的路径,在终端上的查看mpfr的路径: whereis mpfr

结果显示为空!竟然没有安装成功?但是安装的过程中没有看到有错误产生。

为了再看一遍是否成功,对mpfr重新安装了一遍,在make install结束后,离打印结束的位置很近的地方有如下提示:

---------------------------------------------------------------------- Libraries have been installed in: /usr/local/lib

If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following:

- add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution

- add LIBDIR to the `LD_RUN_PATH' environment variable during linking

- use the `-Wl,--rpath -Wl,LIBDIR' linker flag

- have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- 先不管,再: whereis mpfr

结果还是显示为空,直接打开 /usr/local/lib,还是可以看见有mpfr库的:libmpfr.a、libmpfr.la、libmpfr.so.1.1.1、libmpfr.so.1.2.2,还有两个链接文件:libmpfr.so、libmpfr.so.1。 指定路径的例子如下:

../gcc-4.3.0/configure --with-gmp=/apps/gmp/4.2.2 --with-mpfr=/apps/mpfr/2.3.0 --prefix=/apps/gcc/4.2.2 --enable-languages=c,c++,fortran,java,objc,obj-c++,treelang 重新进入gcc4.7.0目录:

./configure --with-mpfr=/usr/local/lib 几秒钟就结束了,没有发现错误。继续: make

结果错误依旧。

继续上网搜索,请参考网址:

http://hi.http://www.china-audit.com//jrckkyy/blog/item/f3427f11729e9200b8127b6d.html: 需要安装gmp与mpfr

并且需要在.bash_profile(一般在/root目录下)配置LD_LIBRARY_PATH,把GMP与MPFR对应的lib配置上 如:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpfr/2.4.0/lib:/usr/local/gmp/4.2.2/libexport LD_LIBRARY_PATH

一定要重启生效或者使用 source /root/.bash_profile

但我不是root用户,无法进入这个目录,晕,root用户还没有开启,还得找方法。哎,惨痛啊,今天都5.4号了,1周多了,这环境还没有搞定,看来搞linux有饭吃,服务就能赚钱了。

由于无法直接修改.bash_profile文件,所以就直接在命令行下胡乱试一下: LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib 然后再make,结果错误一样。 继续搜索,找到

了 http://topic.csdn.net/u/20110826/21/dd903bec-c852-4d7e-a5b1-05710c3804ee.html,问题是一样的,只是版本不一样,但是没有结果,再搜,又搜到一篇,http://www.cnblogs.com/shawn-zhou/archive/2009/08/06/1540624.html: configure: error: cannot compute suffix of object files: cannot compile gcc Configure file can't find mpfr libs

export LD_LIBRARY_PATH=/usr/local/lib (if your mpfr is intalled in it)

按照它,我输入:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib 然后再make,结果又错了,但信息不一样: In file included from /usr/include/stdio.h:28:0, from ../.././libgcc/../gcc/tsystem.h:88, from ../.././libgcc/libgcc2.c:29:

/usr/include/features.h:323:26: fatal error: bits/predefs.h:没有那个文件或目录 compilation terminated. make[3]: *** [_muldi3.o] 错误 1

make[3]:正在离开目录 `/home/ligo/qttools/gcc-4.7.0/i686-pc-linux-gnu/libgcc' make[2]: *** [all-stage1-target-libgcc] 错误 2 make[2]:正在离开目录 `/home/ligo/qttools/gcc-4.7.0' make[1]: *** [stage1-bubble] 错误 2

make[1]:正在离开目录 `/home/ligo/qttools/gcc-4.7.0' make: *** [all] 错误 2

网上也找不到什么解决方法,我以为是自己可能把LD_LIBRARY_PATH变量给改坏了,用set看了一下,其值为: /usr/local/lib,usr/local/lib

两个重复的没有啥特殊用途,于是重启虚拟机系统,再进入目录: ./configure

提示无权限,接着用 su

输入密码。这个用来提升权限,再 ./configure

很快就成功,然后继续 make

结果又出错了:

/home/ligo/qttools/gcc-4.7.0/host-i686-pc-linux-gnu/gcc/cc1: error while loading shared libraries: libmpfr.so.1: cannot open shared object file: No such file or directory make[3]: *** [_muldi3.o] 错误 1

make[3]:正在离开目录 `/home/ligo/qttools/gcc-4.7.0/i686-pc-linux-gnu/libgcc' make[2]: *** [all-stage1-target-libgcc] 错误 2 make[2]:正在离开目录 `/home/ligo/qttools/gcc-4.7.0'

make[1]: *** [stage1-bubble] 错误 2

make[1]:正在离开目录 `/home/ligo/qttools/gcc-4.7.0' make: *** [all] 错误 2

和之前不一样。似乎又是mpfr的问题,但是进入/usr/local/lib查看,libmpfr.so.1还是在的,而且其链接的那个文件也同样存在,怎么可能打不开呢? 5.07:

今天启动虚拟机,然后直接输入set查看LD_LIBRARY_PATH的值,结果不存在这个坏境变量,于是设置它:

export LD_LIBRARY_PATH=/usr/local/lib 然后再进入gcc-4.7.0目录: ./configure 成功,再 make

结果还是失败:/usr/include/features.h:323:26: fatal error: bits/predefs.h:没有那个文件或目录

看来一定要查看这个文件是什么了,网上搜索

到 http://blog.sina.com.cn/s/blog_4e7453df01012r9d.html: 解决方法:

确定你的系统是x86_64 GNU/Linux

root@mm-desktop:/home/mm/android# uname -a

Linux mm-desktop 2.6.27-9-generic #1 SMP Thu Nov 20 22:15:32 UTC 2008 x86_64 GNU/Linux 安装libc6-dev-i386

sudo apt-get install libc6-dev-i386

不管了,直接输入命令看能否解决: sudo apt-get install libc6-dev-i386

结果显示:末发现软件包libc6-dev-i386,没有办法,上网上又搜索到http://www.cnblogs.com/superniaoren/archive/2012/3/23.html:

编译过程中出错,报错是fatal error: bits/predefs.h:没有那个文件或目录compilation terminated. ,需要安装包

multilib, 命令为 $sudo apt-get install gcc-multilib