-
-
Notifications
You must be signed in to change notification settings - Fork 851
Mac上使用mingw编译报错error: cc1plus: 对不起,尚未实现:未编译入对 64 位模式的支持 #293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
通过 |
|
你更新下dev分支版本 |
Mac上的将v2.2.2更新到v2.2.3之后执行
|
看log,下载已经完成了,正在安装中(想要看具体进度可以加-v, xmake update -v dev),不行的话,可以直接源码下载安装。 不过最近我正在重构改进mingw以及交叉工具链的检测和构建,要不等我这两天改进完,你再试试吧。。 |
我改进了下mingw的检测和配置过程,并且提供 并且随着windows x64的普及,我默认mingw arch切到了x86_64下。 对于macos下,mingw sdk根目录会去自动探测 /usr/local/opt/mingw-w64/ 。。 因此在mac下,只需要执行: $ xmake f -p mingw -c # 加 -c强制重新检测,清掉之前检测的配置缓存
$ xmake 你可以执行 目前我这边mac下测试是ok的,跟你这环境相同。。 |
执行
|
Mac在哪看log啊 |
根据前面的提示操作,更新失败,就加-v查 xmake update -v dev 安装是需要一点时间的,不一定就是卡住,请耐性等待安装完成,加-v可以看详细进度信息 |
|
我看了下,可能有两个问题导致:
|
我用 |
这两个问题我都修复了,你可以再更新下 xmake update -v dev试试 对于update更新安装卡住问题,我也修复了,不过需要先加-v更新一次后,才生效 |
编译生成ok,但是用mingw生成的exe依赖libstdc++-6.dll,需要-static参数,才可以不依赖libstdc++-6.dll。xmake的话对应是在哪里配置呢 |
add_ldflags("-static", {force = true}) |
在xmake.lua直接加入这句会报错
|
|
报错是因为你的动态库没设置导出符号,默认编译仅生成.dll 不生成对应的.lib,所以没法link的 而且你要static静态链接,就不应该通过set_kind 去设置生成shared动态库,应该生成set_kind static,如果是静态库,mingw下不加add_ldflags static也是没问题的 至于放在hello正常编译,是因为add_ldflags仅对binary target生效,所以放根目录可以,你放到hello下,去影响shared动态库,等于没生效 |
我是用 |
win的动态库生成,需要设置导出函数,才会自动生成dll对应的lib文件用于link,win下编译也是的 如果xmake提供的模板工程,默认内部我已经设置过了,这边测试编译没问题,你这为啥会link not find我回头看看 不依赖libstd++ dll这个本身跟xmake没啥关系了,你google找找 第一页就有解决方案 add_ldflags("-static-libstdc++", {force = true}) 相关文章: https://blog.csdn.net/cuijinquan/article/details/18480847 |
嗯嗯,是xmake的模板工程,thanks |
可以了么? |
还有在Mac用mingw编译是没有生成lib文件但是生成.a文件这个问题,导致后面编译出错 |
mac下mingw自动生成.a也是可以link的,我这边测试没问题,你可以把你这边的错误信息完整贴出来,我看看 ruki:hello ruki$ xmake -r -v
checking for the x86_64-w64-mingw32-g++ ... /usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-g++
checking for the shared library linker (sh) ... x86_64-w64-mingw32-g++
checking for the c++ compiler (cxx) ... x86_64-w64-mingw32-g++
checking for the ccache ... /usr/local/bin/ccache
checking for the /usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-g++ ... ok
checking for the flags(x86_64-w64-mingw32-g++) -O3 ... ok
[ 0%]: ccache compiling.release src/interface.cpp
/usr/local/bin/ccache /usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-g++ -c -fvisibility=hidden -O3 -m64 -o build/.objs/hello/mingw/x86_64/release/src/interface.cpp.o src/interface.cpp
checking for the flags(x86_64-w64-mingw32-g++) -E -MM ... ok
[ 50%]: linking.release hello.dll
/usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-g++ -o build/mingw/x86_64/release/hello.dll build/.objs/hello/mingw/x86_64/release/src/interface.cpp.o -s -fvisibility=hidden -m64 -shared -Wl,--out-implib,build/mingw/x86_64/release/hello.a
checking for the linker (ld) ... x86_64-w64-mingw32-g++
[ 50%]: ccache compiling.release src/test.cpp
/usr/local/bin/ccache /usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-g++ -c -fvisibility=hidden -O3 -m64 -o build/.objs/hello_demo/mingw/x86_64/release/src/test.cpp.o src/test.cpp
checking for the flags(x86_64-w64-mingw32-g++) -Wl,-rpath=@loader_path ... no
checking for the flags(x86_64-w64-mingw32-g++) -Xlinker -rpath -Xlinker @loader_path ... no
[100%]: linking.release hello_demo.exe
/usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-g++ -o build/mingw/x86_64/release/hello_demo.exe build/.objs/hello_demo/mingw/x86_64/release/src/test.cpp.o -Lbuild/mingw/x86_64/release -s -fvisibility=hidden -lhello -m64
build ok!👌 |
执行命令
|
因为你加了 -static,对于 link动态库,不需要设置这个的,你设置了反而会干扰,这个flags是用于 link静态库的。。你删了就好 |
同样的xmake.lua文件 |
因为我在window上试了加 |
你更新下 xmake update dev试试吧。我改了下。。 |
更新之后重新编译执行还是报错,缺少libwinpthread-1.dll
|
刚更新的dev版本,已经全改成lib了。。a9f3eac5faf29e1a60b68ec2ac7ec791ef7549ee 你没更新成功吧。。你重新打开个终端,或者 source ~/.xmake/profile下后再试试 |
1.更新之后正常生成lib文件,使用
|
更新不需要sudo的。。直接执行 xmake update dev 就行了 |
我是看到有个安装过程有个Permission denied,后面就用sudo再执行了一遍,这个Permission denied不影响是吗 |
这个是mingw的问题,不是xmake的问题了,你可以继续用-static,或者网上找下其他其他解决办法,仅对pthread进行 static link |
嗯嗯OK👌 |
如果没加sudo,看到这个提示,是老版本的问题,最新版本已经不会提示这个了。。除非必要,永远不要使用sudo去执行xmake |
No description provided.
The text was updated successfully, but these errors were encountered: