【发布时间】:2012-07-31 07:22:41
【问题描述】:
我有两个使用不同 gcc 版本生成的可执行文件
一种是在我的 Linux 机器中使用gcc 3.4.2,另一种是使用gcc 4.3.2
两者都必须在相同的环境中运行,即具有相同的 LD_LIBRARY_PATH。
当前4.3.2 的路径放在3.4.2 之前,3.4.2 给出错误。
libstdc++.so.6: version 'GLIBCXX_3.4.9' not found (required by../../src/hello)
我正在考虑可以将信息存储在 exe 中的解决方案 需要加载时间文件。
我在下面创建了出现问题的构建脚本:
基本上O3选项在做优化。
/opt/gcc-4.3.2/bin/g++ -pipe -O3 -c hello4_3_2.cpp
/opt/gcc-4.3.2/bin/g++ -o hello4_3_2 hello4_3_2.o -L$/opt/gcc-4.3.2/lib64/libstdc++
/opt/gcc-3.4.2/bin/g++ -pipe -O3 -c hello3_4_2.cpp
/opt/gcc-3.4.2/bin/g++ -o hello3_4_2 hello3_4_2.o -L$/opt/gcc-3.4.2/lib64/libstdc++
以下脚本适用于我:(没有 O3 选项)
/opt/gcc-4.3.2/bin/g++ -pipe -c hello4_3_2.cpp
/opt/gcc-4.3.2/bin/g++ -o hello4_3_2 hello4_3_2.o -L$/opt/gcc-4.3.2/lib64/libstdc++
/opt/gcc-3.4.2/bin/g++ -pipe -c hello3_4_2.cpp
/opt/gcc-3.4.2/bin/g++ -o hello3_4_2 hello3_4_2.o -L$/opt/gcc-3.4.2/lib64/libstdc++
现在:
我想知道是否有其他方法可以实现。
这样做有什么缺点吗。
【问题讨论】:
标签: c++ gcc load runtime-error