与libwinpthread的静态链接 [英] Static linking with libwinpthread

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

问题描述

我尝试使用静态链接的工具链库构建程序. 我通过了:

I try to build program with static linked toolchain libraries. I pass:

LDFLAGS="-Wl,-Bstatic -lwinpthread -Wl,-Bdynamic -static-libgcc -static-libstdc++"

但程序与共享的libwinpthread-1.dll链接.

我做错了什么?

只有当我获得静态链接的libwinpthreads时,才将-static传递给LDFLAGS.但是它破坏了带有插件系统的构建程序.

Only way when I got static linked libwinpthreads is pass -static to LDFLAGS. But it break build programs with plugin system.

我使用MinGW构建项目中的mingw-w64 + GCC-4.7.2: http://sourceforge .net/projects/mingwbuilds/

I use mingw-w64 + GCC-4.7.2 from the MinGW-builds project: http://sourceforge.net/projects/mingwbuilds/

推荐答案

尝试一下:

-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic

-lpthread之前注意-lstdc++.它对我有用.

Notice the -lstdc++ before -lpthread. It worked for me.

请确保将其添加到g++命令行的最后.

Make sure to add this to the very end of your g++ command line.

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

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