-
-
Notifications
You must be signed in to change notification settings - Fork 376
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
quickjs: fix windows build #3587
Conversation
我感觉直接
用set_toolchains的方式貌似会更好,这样能在我的电脑上编译过 |
packages/q/quickjs/xmake.lua
Outdated
add_versions("2021.03.27", "b5e62895c619d4ffc75c9d822c8d85f1ece77e5b") | ||
add_versions("2023.12.09", "daa35bc1e5d43192098af9b51caeb4f18f73f9f9") | ||
add_versions("2024.01.13", "d6c7d169de6fb2c90cd2bd2226ba9dafdef883ce") | ||
add_deps("mingw-w64") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用 llvm-mingw 也许会更好些,支持的 arch 更多,win arm64 也支持
切 mingw ,建议直接切 plat 而不是 toolchain,内部很多逻辑 都依赖 mingw plat 的判断,不仅仅只是 toolchain,比如 mingw 平台相关的 target 可执行后缀名等,都是平台决定的,不是 toolchain |
主要是最后的导出库是给msvc用的,所以我感觉plat仍然用windows会更好,这样相关的库以及后缀都是windows平台格式的 |
The main reason is that the final export library is for msvc, so I feel it would be better if the platform still uses windows, so that the relevant libraries and suffixes are in the windows platform format. |
1 similar comment
The main reason is that the final export library is for msvc, so I feel it would be better if the platform still uses windows, so that the relevant libraries and suffixes are in the windows platform format. |
plat 是 windows 而 toolchain 是 mingw ,最后生成的库 bin 格式还是 gnulib,仅仅只是后缀名是 .lib ,要让 msvc 可用,得转成 mslib ,这个不是只改 plat 就行的 |
plat is windows and the toolchain is mingw. The bin format of the finally generated library is still gnulib, but the suffix is .lib. To make msvc usable, it must be converted to mslib. This does not just require changing plat. |
静态库确实没办法互通,但是动态库dll能够生成def再生成一个导出库.lib让msvc可用。完全的静态链接我感觉应该是无法实现的,因为mingw的库和msvc实在无法互通。所以我在最上面让windows只能进行动态链接了。也好在C没有name mangling, 所以动态库可以互通使用
|
我没说静态库,我说的就是动态库的 导出库 .lib 的格式,你 plat windows ,toolchain mingw ,最后生成的动态库即使是 .dll ,它的导出库,还是走的 mingw toolchain 是 gnulib 格式的,还是要转下的,避免不了,反而可能遗漏掉其他一些 mingw 平台下的处理,所以通常走 mingw 编译,就完整且 mingw plat ,也不会因为后期 xmake 又加了什么 mingw 相关的改动,漏掉一些处理,最后对生成的 mingw 的 dll 和 dll.a 走 gnu2mslib 处理下就行了 。。 |
两种方式我都测试运行了一下,结果好像是一样的,都能正常运行。我之前担心用mingw做plat会导致编译出来的dll和mingw结合过于紧密,但是最后发现两种方式都一样,免不了要引入mingw的dll,是我想多了。 我dumpbin了一下quickjs.dll
libstdc++应该是不需要的,可以少复制一个dll |
既然只生成 dll,为啥不用 xmake 的 mingw 版本,我记得是不依赖任何 mingw dll 的。。 |
I have tested and run both methods, and the results seem to be the same and both can run normally. I used to worry that using MinGW as a platform would cause the compiled DLL to be too closely integrated with MinGW, but in the end I found that both methods were the same, and it was inevitable to introduce MinGW's DLL, but I was overthinking it. |
看起来还是要传 |
It seems that you still need to pass |
应该跟这个没关系吧,cl/link 我也从来不设置这个,选择 arch 都是跟当前 msvc envs 绑定的,估计是执行 lib.exe 没绑定当前 arch 的 msvc envs 导致 刚我改了下,再重跑下试试 xmake-io/xmake@08fd85a |
quickjs里面可能用了什么特殊的库,导致它必须得链接libgcc了,我这边加上了也还是会依赖libgcc。但是我另开了一个测试工程就不会依赖libgcc |
确定这个 flag 加进去并且生效了? dll 得用 add_shflags |
It should have nothing to do with this. I never set this in cl/link. The selected arch is bound to the current msvc envs. It is probably caused by executing lib.exe without binding the msvc envs of the current arch. I just changed it, try running it again xmake-io/xmake@08fd85a |
我的问题。用add_shflags就不依赖了,我加到ldflags里面了 |
There may be some special library used in quickjs, which causes it to have to be linked to libgcc. Even if I add it here, it will still rely on libgcc. But if I open another test project, it will not depend on libgcc. |
Are you sure this flag has been added and taken effect? dll must use add_shflags |
my question. Use add_shflags to avoid dependence. I added it to ldflags. |
|
Fix #3586