如何静态链接libstdc ++ [英] How to statically link libstdc++

查看:430
本文介绍了如何静态链接libstdc ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我的程序在另一台机器上工作,libstdc ++版本是不同的。我正在开发和编译它在netbeans。我已经指定选项-static-libstdc ++,但程序继续尝试加载libstdc ++。so.6在本地机器。



如何获得完全静态的libstdc ++链接?



谢谢。

解决方案

不确定这里的确切情况,但我遇到了类似的问题,刚刚与不同版本的Mac OS X和GCC。我通过将我想要的实际dylib复制到可执行文件的同一个目录中并改变 DYLD_LIBRARY_PATH 来让它在/ usr / lib之前搜索。

I am trying to get my program working in another machine where libstdc++ versions is different. I am developing and compiling it on netbeans. I have specified the option -static-libstdc++ but the program continues trying to load libstdc++.so.6 in the local machine.

How can I get a fully static libstdc++ link?

Thanks.

解决方案

Not sure of the exact circumstances here, but I ran into a similar problem just now with different versions of Mac OS X and gcc. I worked around it by copying the actual dylib I wanted into the same directory as the executable and changing DYLD_LIBRARY_PATH to have it search there first before /usr/lib.

这篇关于如何静态链接libstdc ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆