Decoding gcc specs file line

喜夏-厌秋 提交于 2019-12-06 06:59:34

That line affects how libraries are found relative to GCC's $PREFIX/lib directory (where $PREFIX is the directory GCC was installed to.)

There are three parts to it:

$PREFIX/lib/. is used when neither -m32 or -m64 is used on the command-line.

$PREFIX/lib/.:$PREFIX/lib/../lib64 is used when -m64 is used.

$PREFIX/lib/.:$PREFIX/lib/../lib32 is used when -m32 is used.

This suggests to me you are using Debian or Ubuntu, I don't think a vanilla GCC build from the FSF sources would have that in the specs. Were both your GCC versions from .deb packages or did you install them yourself? (The Multi Arch support in recent Debian/Ubuntu releases moves library directories and so breaks vanilla GCC, I think Debian and Ubuntu patch the GCC code for their .deb packages.)

Could you add the output of linking with g++ -v for each of your versions, to see the exact library search paths used by each version?

Also, why not just use -L instead of LIBRARY_PATH? Directories specified with -L always come first, before the system dirs or GCC's own dirs or the ones specified in LIBRARY_PATH.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!