Skip to content
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

Mac上使用mingw编译报错error: cc1plus: 对不起,尚未实现:未编译入对 64 位模式的支持 #293

Closed
jiagushuai opened this Issue Dec 18, 2018 · 43 comments

Comments

Projects
None yet
2 participants
@jiagushuai
Copy link

jiagushuai commented Dec 18, 2018

No description provided.

@jiagushuai jiagushuai changed the title 在Mac上安装ming'w Mac上使用mingw编译报错error: cc1plus: 对不起,尚未实现:未编译入对 64 位模式的支持 Dec 18, 2018

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 18, 2018

通过brew install mingw-w64安装mingw,用xmake create -l c++ -t shared hello创建hello项目后修改平台,执行xmake f -p mingw --sdk=/usr/local/opt/mingw-w64/ -a x86_64,就报错error: cc1plus: 对不起,尚未实现:未编译入对 64 位模式的支持

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 18, 2018

gushuai:Desktop jl$ xmake create -l c++ -t shared hello
create hello ...
create ok!👌
gushuai:Desktop jl$ cd hello/
gushuai:hello jl$ ls
src		xmake.lua
gushuai:hello jl$ xmake 
checking for the architecture ... x86_64
checking for the Xcode directory ... /Applications/Xcode.app
checking for the SDK version of Xcode ... 10.13
[00%]: compiling.release src/interface.cpp
[50%]: linking.release libhello.dylib
[50%]: compiling.release src/test.cpp
[100%]: linking.release hello_demo
gushuai:hello jl$ xmake f -p mingw --sdk=/usr/local/opt/mingw-w64/  -a x86_64
gushuai:hello jl$ xmake
[00%]: compiling.release src/interface.cpp
error: cc1plus: 对不起,尚未实现:未编译入对 64 位模式的支持
@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 18, 2018

你更新下dev分支版本 xmake update dev,试试,不行的话,加上-v编译下,给我看下详细信息,xmake -v

@waruqi waruqi added this to the v2.2.4 milestone Dec 18, 2018

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 19, 2018

Mac上的将v2.2.2更新到v2.2.3之后执行xmake update dev,一直卡在下载

gushuai:hello jl$ xmake update dev
update version: dev ..
  => download https://gitee.com/tboox/xmake.git .. ok
  => installing to /usr/local/Cellar/xmake/2.2.3/share/xmake .. \
@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 19, 2018

看log,下载已经完成了,正在安装中(想要看具体进度可以加-v, xmake update -v dev),不行的话,可以直接源码下载安装。

不过最近我正在重构改进mingw以及交叉工具链的检测和构建,要不等我这两天改进完,你再试试吧。。

@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 19, 2018

我改进了下mingw的检测和配置过程,并且提供xmake f/g --mingw=xxx来独立设置mingw sdk的根目录,当然之前的--sdk也有效,但以后主要用于其他通用交叉工具链设置

并且随着windows x64的普及,我默认mingw arch切到了x86_64下。

对于macos下,mingw sdk根目录会去自动探测 /usr/local/opt/mingw-w64/ 。。

因此在mac下,只需要执行:

$ xmake f -p mingw -c # 加 -c强制重新检测,清掉之前检测的配置缓存
$ xmake

你可以执行 xmake update dev更新下试试,如果不行可以在编译时候加 -v 编译,提供给我详细的编译信息,我好分析下。。

目前我这边mac下测试是ok的,跟你这环境相同。。

@waruqi waruqi added improvement and removed in review labels Dec 19, 2018

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 19, 2018

执行xmake update dev还是卡在第二步安装,xmake编译还是报错

gushuai:hello jl$ xmake f -p mingw -c
checking for the architecture ... i386
gushuai:hello jl$ xmake -v
configure
{
    host = macosx
,   arch = i386
,   ccache = true
,   kind = static
,   buildir = build
,   clean = true
,   mode = release
,   plat = mingw
}

checking for the g++ ... /usr/bin/g++
checking for the c++ compiler (cxx) ... g++
checking for the ccache ... no
checking for the /usr/bin/g++ ... ok
checking for the flags(g++) -O3 ... ok
checking for the shared library linker (sh) ... g++
[ 50%]: linking.release hello.dll
/usr/bin/g++ -o build/mingw/i386/release/hello.dll build/.objs/hello/mingw/i386/release/src/interface.cpp.o -s -fvisibility=hidden -shared -Wl,--out-implib,build/mingw/i386/release/hello.a
error: ld: warning: option -s is obsolete and being ignored
ld: unknown option: --out-implib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 19, 2018

Mac在哪看log啊

@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 19, 2018

看log,下载已经完成了,正在安装中(想要看具体进度可以加-v, xmake update -v dev),不行的话,可以直接源码下载安装。

根据前面的提示操作,更新失败,就加-v查
看详细log

xmake update -v dev

安装是需要一点时间的,不一定就是卡住,请耐性等待安装完成,加-v可以看详细进度信息

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 19, 2018

xmake update dev执行更新OK,mingw编译结果跟刚才不一样,但是还是报错

gushuai:hello jl$ xmake update dev
update version: dev ..
  => download https://gitee.com/tboox/xmake.git .. ok
  => installing to /usr/local/Cellar/xmake/2.2.3/share/xmake .. -
  => install to /usr/local/Cellar/xmake/2.2.3/share/xmake .. ok
xmake v2.2.3.201811281708, A cross-platform build utility based on Lua
Copyright (C) 2015-2018 Ruki Wang, tboox.org, xmake.io
Copyright (C) 2005-2015 Mike Pall, luajit.org
                         _        
    __  ___ __  __  __ _| | ______ 
    \ \/ / |  \/  |/ _  | |/ / __ \
     >  <  | \__/ | /_| |   <  ___/
    /_/\_\_|_|  |_|\__ \|_|\_\____| 
                         by ruki, tboox.org
    
    👉  Manual: https://xmake.io/#/home
    🙏  Donate: https://xmake.io/pages/donation.html#donate
    
gushuai:hello jl$ xmake f -p mingw -c
checking for the architecture ... x86_64
checking for the mingw directory ... /usr/local/opt/mingw-w64
gushuai:hello jl$ xmake -v
configure
{
    arch = x86_64
    ccache = true
    mode = release
    plat = mingw
    bin = /usr/local/opt/mingw-w64/bin
    mingw = /usr/local/opt/mingw-w64
    kind = static
    buildir = build
    host = macosx
    cross = i686-w64-mingw32-
    clean = true
}
checking for the i686-w64-mingw32-g++ ... /usr/local/opt/mingw-w64/bin/i686-w64-mingw32-g++
checking for the c++ compiler (cxx) ... i686-w64-mingw32-g++
checking for the ccache ... no
checking for the /usr/local/opt/mingw-w64/bin/i686-w64-mingw32-g++ ... ok
checking for the flags(i686-w64-mingw32-g++) -O3 ... ok
[  0%]: compiling.release src/interface.cpp
/usr/local/opt/mingw-w64/bin/i686-w64-mingw32-g++ -c -fvisibility=hidden -O3 -m64 -o build/.objs/hello/mingw/x86_64/release/src/interface.cpp.o src/interface.cpp
error: cc1plus: 对不起,尚未实现:未编译入对 64 位模式的支持
@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 19, 2018

我看了下,可能有两个问题导致:

  1. 你这执行更新安装到/usr/local下需要权限提示用户确认,我这边处理上有点问题,所以你这看着像是安装卡主了。。这块我之后改进下

  2. 可能找错了arch对应的mingw/g++导致,我后两天改进后你再试试

@waruqi waruqi added the bug label Dec 19, 2018

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 19, 2018

我用xmake update -v dev命令安装的时候就不会遇到卡住停顿的问题。
嗯嗯,那我后面再测试mingw

@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 19, 2018

这两个问题我都修复了,你可以再更新下 xmake update -v dev试试

对于update更新安装卡住问题,我也修复了,不过需要先加-v更新一次后,才生效

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 19, 2018

编译生成ok,但是用mingw生成的exe依赖libstdc++-6.dll,需要-static参数,才可以不依赖libstdc++-6.dll。xmake的话对应是在哪里配置呢

@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 19, 2018

add_ldflags("-static", {force = true})

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 19, 2018

在xmake.lua直接加入这句会报错

gushuai:hello jl$  xmake -r -v
checking for the mingw directory ... /usr/local/opt/mingw-w64
configure
{
    ccache = true
    host = macosx
    mingw = /usr/local/opt/mingw-w64
    buildir = build
    arch = x86_64
    mode = release
    ld = /usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-g++
    cxx = /usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-g++
    cross = x86_64-w64-mingw32-
    kind = static
    clean = true
    bin = /usr/local/opt/mingw-w64/bin
    plat = mingw
    sh = /usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-g++
}
checking for the ccache ... no
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%]: compiling.release src/interface.cpp
/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
[ 50%]: compiling.release src/test.cpp
/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 -static -m64
error: /usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-x86_64/bin/x86_64-w64-mingw32-ld: 找不到 -lhello
collect2: 错误:ld 返回 1
@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 19, 2018

image

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 19, 2018

add_ldflags("-static", {force = true})放在target("hello")里面就可以正常编译,但是生成的exe还是依赖libstdc++-6.dll

@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 19, 2018

报错是因为你的动态库没设置导出符号,默认编译仅生成.dll 不生成对应的.lib,所以没法link的

而且你要static静态链接,就不应该通过set_kind 去设置生成shared动态库,应该生成set_kind static,如果是静态库,mingw下不加add_ldflags static也是没问题的

至于放在hello正常编译,是因为add_ldflags仅对binary target生效,所以放根目录可以,你放到hello下,去影响shared动态库,等于没生效

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 19, 2018

我是用xmake create -l c++ -t shared hello生成的动态库项目
window下默认编译是有生成.lib的,在Mac上的mingw编译就生成.a
1.为什么说动态库没设置导出符号不生成对应的.lib呢?同份代码Windows直接编译不是有生成.lib?
2.那动态库项目的话,用mingw编译怎么设置生成的exe不依赖libstdc++-6.dll呢

@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 19, 2018

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

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 19, 2018

嗯嗯,是xmake的模板工程,thanks

@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 19, 2018

可以了么?

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 20, 2018

还有在Mac用mingw编译是没有生成lib文件但是生成.a文件这个问题,导致后面编译出错

@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 20, 2018

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!👌
@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 20, 2018

执行命令xmake -v -r

gushuai:hello jl$ xmake -v -r
checking for the mingw directory ... /usr/local/opt/mingw-w64
configure
{
    host = macosx
    ar = /usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-ar
    mingw = /usr/local/opt/mingw-w64
    buildir = build
    arch = x86_64
    ld = /usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-g++
    bin = /usr/local/opt/mingw-w64/bin
    mode = release
    cc = /usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-gcc
    cross = x86_64-w64-mingw32-
    sh = /usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-g++
    kind = static
    plat = mingw
    cxx = /usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-g++
    clean = true
    ccache = true
}
checking for the ccache ... no
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%]: compiling.release src/interface.cpp
/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
[ 50%]: compiling.release src/test.cpp
/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 -static -m64
error: /usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-x86_64/bin/x86_64-w64-mingw32-ld: 找不到 -lhello
collect2: 错误:ld 返回 1
@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 20, 2018

image

@jiagushuai jiagushuai closed this Dec 20, 2018

@jiagushuai jiagushuai reopened this Dec 20, 2018

@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 20, 2018

因为你加了 -static,对于 link动态库,不需要设置这个的,你设置了反而会干扰,这个flags是用于 link静态库的。。你删了就好

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 20, 2018

但是我在Windows上编译是通过的,
设置-static用mingw生成的exe才不会依赖libstdc++-6.dll,libgcc_s_dw2-1.dll.
尝试过设置add_ldflags("-static-libstdc++"),add_ldflags("-static-libgcc")但是报错缺少libwinpthread-1.dll暂解决不了。
image

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 20, 2018

同样的xmake.lua文件

@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 20, 2018

设置-static用mingw生成的exe才不会依赖libstdc++-6.dll,libgcc_s_dw2-1.dll.
尝试过设置add_ldflags("-static-libstdc++"),add_ldflags("-static-libgcc")但是报错缺少libwinpthread-1.dll暂解决不了。

之前不是说了么 通过这两个flags一样能解决啊,我这可以啊,mac上mingw编译的,同样的工程。

add_ldflags("-static-libstdc++", "-static-libgcc", {force = true})

snip20181220_1

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 20, 2018

会报错哦,只用add_ldflags("-static-libstdc++", "-static-libgcc", {force = true})的话
image

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 20, 2018

因为我在window上试了加-static是ok的
只用add_ldflags("-static-libstdc++", "-static-libgcc", {force = true})在Windows上也可以。
但是在我这边Mac上用mingw编译会报缺少libwinpthread-1.dll的错误

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 20, 2018

Windows这边是可以
image

@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 20, 2018

你更新下 xmake update dev试试吧。我改了下。。

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 20, 2018

更新之后重新编译执行还是报错,缺少libwinpthread-1.dll
mingw这边编译还是生成.a而不是.lib,这个会有影响吗

gushuai:hello jl$ xmake update dev
update version: dev ..
  => download https://gitee.com/tboox/xmake.git .. ok \
  => install to /usr/local/share/xmake .. ok \
xmake v2.2.3.201812191625, A cross-platform build utility based on Lua
Copyright (C) 2015-2018 Ruki Wang, tboox.org, xmake.io
Copyright (C) 2005-2015 Mike Pall, luajit.org
                         _        
    __  ___ __  __  __ _| | ______ 
    \ \/ / |  \/  |/ _  | |/ / __ \
     >  <  | \__/ | /_| |   <  ___/
    /_/\_\_|_|  |_|\__ \|_|\_\____| 
                         by ruki, tboox.org
    
    👉  Manual: https://xmake.io/#/home
    🙏  Donate: https://xmake.io/pages/donation.html#donate
    
gushuai:hello jl$ xmake -r -v
configure
{
    host = macosx
    mingw = /usr/local/opt/mingw-w64
    buildir = build
    arch = x86_64
    mode = release
    plat = mingw
    cxx = /usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-g++
    bin = /usr/local/opt/mingw-w64/bin
    sh = /usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-g++
    kind = static
    ld = /usr/local/opt/mingw-w64/bin/x86_64-w64-mingw32-g++
    cross = x86_64-w64-mingw32-
    clean = true
    ccache = true
}
[  0%]: compiling.release src/interface.cpp
/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
[ 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
[ 50%]: compiling.release src/test.cpp
/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
[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 -static-libstdc++ -static-libgcc -m64
build ok!👌

@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 20, 2018

刚更新的dev版本,已经全改成lib了。。a9f3eac5faf29e1a60b68ec2ac7ec791ef7549ee

你没更新成功吧。。你重新打开个终端,或者 source ~/.xmake/profile下后再试试

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 20, 2018

1.更新之后正常生成lib文件,使用-static编译OK正常使用,不依赖gcc动态库文件,问题解决👌
2.只使用add_ldflags("-static-libstdc++", "-static-libgcc", {force = true})编译通过但是运行还是报错缺少libwinpthread-1.dll。
3.更新使用命令sudo xmake update -v dev看到有个Permission denied

installing to /Users/shandikeji/.local ...
plat: macosx
arch: x86_64
ok!
./scripts/get.sh: line 144: /Users/shandikeji/.bash_profile: Permission denied
xmake v2.2.3.201812201055, A cross-platform build utility based on Lua
Copyright (C) 2015-2018 Ruki Wang, tboox.org, xmake.io
Copyright (C) 2005-2015 Mike Pall, luajit.org
                         _        
    __  ___ __  __  __ _| | ______ 
    \ \/ / |  \/  |/ _  | |/ / __ \
     >  <  | \__/ | /_| |   <  ___/
    /_/\_\_|_|  |_|\__ \|_|\_\____| 
                         by ruki, tboox.org
    
    👉  Manual: https://xmake.io/#/home
    🙏  Donate: https://xmake.io/pages/donation.html#donate
    
  => install to ~/.local/bin .. ok    
xmake v2.2.3.201812201055, A cross-platform build utility based on Lua
Copyright (C) 2015-2018 Ruki Wang, tboox.org, xmake.io
Copyright (C) 2005-2015 Mike Pall, luajit.org
                         _        
    __  ___ __  __  __ _| | ______ 
    \ \/ / |  \/  |/ _  | |/ / __ \
     >  <  | \__/ | /_| |   <  ___/
    /_/\_\_|_|  |_|\__ \|_|\_\____| 
                         by ruki, tboox.org
    
    👉  Manual: https://xmake.io/#/home
    🙏  Donate: https://xmake.io/pages/donation.html#donate
    
@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 20, 2018

更新使用命令sudo xmake update -v dev

更新不需要sudo的。。直接执行 xmake update dev 就行了

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 20, 2018

我是看到有个安装过程有个Permission denied,后面就用sudo再执行了一遍,这个Permission denied不影响是吗

@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 20, 2018

只使用add_ldflags("-static-libstdc++", "-static-libgcc", {force = true})编译通过但是运行还是报错缺少libwinpthread-1.dll。

这个是mingw的问题,不是xmake的问题了,你可以继续用-static,或者网上找下其他其他解决办法,仅对pthread进行 static link

@jiagushuai

This comment has been minimized.

Copy link
Author

jiagushuai commented Dec 20, 2018

嗯嗯OK👌

@waruqi

This comment has been minimized.

Copy link
Member

waruqi commented Dec 20, 2018

我是看到有个安装过程有个Permission denied,后面就用sudo再执行了一遍,这个Permission denied不影响是吗

如果没加sudo,看到这个提示,是老版本的问题,最新版本已经不会提示这个了。。除非必要,永远不要使用sudo去执行xmake

@waruqi waruqi closed this Dec 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.