Modify g++ library path

时光怂恿深爱的人放手 提交于 2019-12-02 11:43:35

You could have a new (or modify the existing) GCC specs file, documentation is here.

AFAIK, the specs file is in your "install" dir, so for you would be in
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/specs (which you could create if it does not exist).

AFAIK there is some built-in default, but you could configure your system to have an explicit one.

Read also about the debugging options of GCC. You may want to use -dumpspecs to get the built-in default spec.

Details may be highly specific to your system, especially if you compiled GCC from its source code.

I am not familiar enough with specs files to give a reliable solution for your particular issue. You might ask on gcc-help@gcc.gnu.org for details.


NB: I would tend to believe that configuring a gcc with --prefix=/usr (and not a non-system prefix like the default --prefix=/usr/local/ or some --prefix=/opt/ etc...) is a mistake (or at least use also --program-suffix=-4.9). You are likely to mix up your gcc with the system gcc; If you want to replace your system gcc (which is probably dangerous) you should configure your new gcc with the same arguments as your system gcc had. Notice that /usr/bin/gcc -v tells you how was your system gcc configured (to be done before overwriting it).

When compiling a recent GCC 4.9 on some older system I generally would recommend to configure it with --prefix=/usr/local/ and --program-suffix=-4.9 then add /usr/local/bin/ to your $PATH, and use make CC=gcc-4.9 CXX=g++-4.9 for building programs with it.

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