'LD_LIBRARY_PATH' Is Bad!!
前段时间想学习以下Latex编辑器,于是装了个集成开发环境Kile,但是一直运行不起来,在终端下运行时显示的错误是‘symbol lookup error: /usr/lib/libQtSvg.so.4: undefined symbol ......',到网上查了很长时间都没有找到解决办法。今天有时间又弄了以下,觉得是动态库的问题,ldd /usr/bin/kile,果然,看到结果后就可以确定问题是出在LD_LIBRARY_PATH这个环境变量上了,
linux-gate.so.1 => (0x00671000) libkhtml.so.5 => /usr/lib/libkhtml.so.5 (0x06640000) libkrosscore.so.4 => /usr/lib/libkrosscore.so.4 (0x00294000) libkfile.so.4 => /usr/lib/libkfile.so.4 (0x06d18000) libktexteditor.so.4 => /usr/lib/libktexteditor.so.4 (0x042ed000) libkparts.so.4 => /usr/lib/libkparts.so.4 (0x04bc7000) libkjs.so.4 => /usr/lib/libkjs.so.4 (0x04d65000) libQtScript.so.4 => /usr/lib/libQtScript.so.4 (0x06392000) libkio.so.5 => /usr/lib/libkio.so.5 (0x060f8000) libQtXml.so.4 => /opt/programs/altera/10.0/quartus/linux/libQtXml.so.4 (0x001f2000) libnepomuk.so.4 => /usr/lib/libnepomuk.so.4 (0x007cf000) libsoprano.so.4 => /usr/lib/libsoprano.so.4 (0x04135000) libQtNetwork.so.4 => /opt/programs/altera/10.0/quartus/linux/libQtNetwork.so.4 (0x002b2000) libkdeui.so.5 => /usr/lib/libkdeui.so.5 (0x05ceb000) libQtSvg.so.4 => /usr/lib/libQtSvg.so.4 (0x006f6000) libkdecore.so.5 => /usr/lib/libkdecore.so.5 (0x04f80000) libQtCore.so.4 => /opt/programs/altera/10.0/quartus/linux/libQtCore.so.4 (0x003d8000) libpthread.so.0 => /lib/libpthread.so.0 (0x00c88000) libQtDBus.so.4 => /usr/lib/libQtDBus.so.4 (0x00110000) libQtGui.so.4 => /opt/programs/altera/10.0/quartus/linux/libQtGui.so.4 (0x00ca3000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x008ae000) libm.so.6 => /lib/libm.so.6 (0x00c5c000) libgcc_s.so.1 => /opt/programs/altera/10.0/quartus/linux/libgcc_s.so.1 (0x00189000) libc.so.6 => /lib/libc.so.6 (0x00ad0000) libphonon.so.4 => /usr/lib/libphonon.so.4 (0x04ea0000) libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x04c8b000) libgif.so.4 => /usr/lib/libgif.so.4 (0x0074d000) libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00194000) libz.so.1 => /lib/libz.so.1 (0x001bc000) libSM.so.6 => /usr/lib/libSM.so.6 (0x00a9c000) libICE.so.6 => /usr/lib/libICE.so.6 (0x047be000) libX11.so.6 => /usr/lib/libX11.so.6 (0x0536e000) libXext.so.6 => /usr/lib/libXext.so.6 (0x001d1000) libXft.so.2 => /usr/lib/libXft.so.2 (0x00a64000) libXau.so.6 => /usr/lib/libXau.so.6 (0x001e2000) libXpm.so.4 => /usr/lib/libXpm.so.4 (0x0088b000) libsolid.so.4 => /usr/lib/libsolid.so.4 (0x0421e000) libXrender.so.1 => /usr/lib/libXrender.so.1 (0x001e5000) libpcre.so.0 => /lib/libpcre.so.0 (0x04c44000) libpcreposix.so.0 => /usr/lib/libpcreposix.so.0 (0x001ee000) libstreamanalyzer.so.0 => /usr/lib/libstreamanalyzer.so.0 (0x0099f000) libstreams.so.0 => /usr/lib/libstreams.so.0 (0x042b2000) libacl.so.1 => /lib/libacl.so.1 (0x04b4b000) libattr.so.1 => /lib/libattr.so.1 (0x04aff000) libsopranoclient.so.1 => /usr/lib/libsopranoclient.so.1 (0x006a2000) libdbusmenu-qt.so.2 => /usr/lib/libdbusmenu-qt.so.2 (0x00265000) libXtst.so.6 => /usr/lib/libXtst.so.6 (0x00a59000) libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0x00238000) libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x00242000) libbz2.so.1 => /lib/libbz2.so.1 (0x04a90000) liblzma.so.0 => /usr/lib/liblzma.so.0 (0x04b23000) libresolv.so.2 => /lib/libresolv.so.2 (0x00247000) libfam.so.0 => /usr/lib/libfam.so.0 (0x00668000) libdl.so.2 => /lib/libdl.so.2 (0x00672000) librt.so.1 => /lib/librt.so.1 (0x00677000) /lib/ld-linux.so.2 (0x00aaf000) libdbus-1.so.3 => /lib/libdbus-1.so.3 (0x00782000) libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x01716000) libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00a1c000) libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x017a8000) libpulse.so.0 => /usr/lib/libpulse.so.0 (0x0448f000) libpulse-mainloop-glib.so.0 => /usr/lib/libpulse-mainloop-glib.so.0 (0x00a8e000) libuuid.so.1 => /lib/libuuid.so.1 (0x00680000) libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00756000) libxml2.so.2 => /usr/lib/libxml2.so.2 (0x04340000) libXi.so.6 => /usr/lib/libXi.so.6 (0x00685000) libexpat.so.1 => /lib/libexpat.so.1 (0x018b6000) libpulsecommon-0.9.21.so => /usr/lib/libpulsecommon-0.9.21.so (0x045b1000) libwrap.so.0 => /lib/libwrap.so.0 (0x00a83000) libsndfile.so.1 => /usr/lib/libsndfile.so.1 (0x04b55000) libasyncns.so.0 => /usr/lib/libasyncns.so.0 (0x00a7b000) libnsl.so.1 => /lib/libnsl.so.1 (0x04b06000) libFLAC.so.8 => /usr/lib/libFLAC.so.8 (0x04d26000) libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0x0487b000) libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0x04aab000) libogg.so.0 => /usr/lib/libogg.so.0 (0x04aa3000)
红色部分就是问题之所在,由于之前在安装quartus的时候设置了一个so的路径,还以为LD_LIBRARY_PATH和PATH一样的都是按顺序查找各个部分呢,但是LD_LIBRARY_PATH是加在系统默认的加载路径之前的,'This list is prepended to the existing list of compiled-in loader paths for a given executable, and any system default loader paths',那么这个问题就和上次的那个nautilus程序的问题一样,都是连接到了错误的so文件,导致符号找不到或版本问题。
'LD_LIBRARY_PATH is handy for development and testing, but shouldn't be modified by an installation process for normal use by normal users; see ``Why LD_LIBRARY_PATH is Bad'' at http://www.visi.com/~barr/ldpath.html for an explanation of why',原文是这么说的,这个环境变量主要用于开发和测试阶段,不适合在应用程序的安装过程中修改。。