-
-
Notifications
You must be signed in to change notification settings - Fork 818
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
Fix msvc-wine with cmake package #5871
Conversation
@@ -642,6 +642,9 @@ function _get_configs_for_cross(package, configs, opt) | |||
envs.CMAKE_CXX_COMPILER = _translate_bin_path(package:build_getenv("cxx")) | |||
envs.CMAKE_ASM_COMPILER = _translate_bin_path(package:build_getenv("as")) | |||
envs.CMAKE_AR = _translate_bin_path(package:build_getenv("ar")) | |||
if package:is_plat("windows") and is_host("linux") then | |||
envs.CMAKE_AR = path.join(path.directory(envs.CMAKE_CXX_COMPILER), "lib.exe") | |||
end |
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.
可能改 CMAKE_STATIC_LINKER_FLAGS 更好?
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.
应该得用 link.exe -lib 吧 你试试
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.
...
FAILED: libusb-1.0.lib
: && /home/star/msvc/bin/x64/link.exe /nologo -lib -lib /out:libusb-1.0.lib CMakeFiles/usb-1.0.dir/libusb/core.c.obj CMakeFiles/usb-1.0.dir/libusb/descriptor.c.obj CMakeFiles/usb-1.0.dir/libusb/hotplug.c.obj CMakeFiles/usb-1.0.dir/libusb/io.c.obj CMakeFiles/usb-1.0.dir/libusb/strerror.c.obj CMakeFiles/usb-1.0.dir/libusb/sync.c.obj CMakeFiles/usb-1.0.dir/libusb/os/events_windows.c.obj CMakeFiles/usb-1.0.dir/libusb/os/threads_windows.c.obj CMakeFiles/usb-1.0.dir/libusb/os/windows_common.c.obj CMakeFiles/usb-1.0.dir/libusb/os/windows_usbdk.c.obj CMakeFiles/usb-1.0.dir/libusb/os/windows_winusb.c.obj CMakeFiles/usb-1.0.dir/libusb/libusb-1.0.rc.res && :
LINK : warning LNK4044: unrecognized option '/lib'; ignored
LINK : warning LNK4044: unrecognized option '/lib'; ignored
LINK : fatal error LNK1561: entry point must be defined
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.
应该得用 link.exe -lib 吧 你试试
"/home/star/msvc/bin/x64/link.exe -lib" /nologo /out:libusb-1.0.lib CMakeFiles/usb-1.0.dir/libusb/core.c.obj CMakeFiles/usb-1.0.dir/libusb/descriptor.c.obj CMakeFiles/usb-1.0.dir/libusb/hotplug.c.obj CMakeFiles/usb-1.0.dir/libusb/io.c.obj CMakeFiles/usb-1.0.dir/libusb/strerror.c.obj CMakeFiles/usb-1.0.dir/libusb/sync.c.obj CMakeFiles/usb-1.0.dir/libusb/os/events_windows.c.obj CMakeFiles/usb-1.0.dir/libusb/os/threads_windows.c.obj CMakeFiles/usb-1.0.dir/libusb/os/windows_common.c.obj CMakeFiles/usb-1.0.dir/libusb/os/windows_usbdk.c.obj CMakeFiles/usb-1.0.dir/libusb/os/windows_winusb.c.obj CMakeFiles/usb-1.0.dir/libusb/libusb-1.0.rc.res && :
/bin/sh: 1: /home/star/msvc/bin/x64/link.exe -lib: not found
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.
可能是多加了个双引号的问题,你得 ar 设置成 link.exe ,-lib 挪到 flags 里去
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.
...
FAILED: libusb-1.0.lib : && /home/star/msvc/bin/x64/link.exe /nologo -lib -lib /out:libusb-1.0.lib CMakeFiles/usb-1.0.dir/libusb/core.c.obj CMakeFiles/usb-1.0.dir/libusb/descriptor.c.obj CMakeFiles/usb-1.0.dir/libusb/hotplug.c.obj CMakeFiles/usb-1.0.dir/libusb/io.c.obj CMakeFiles/usb-1.0.dir/libusb/strerror.c.obj CMakeFiles/usb-1.0.dir/libusb/sync.c.obj CMakeFiles/usb-1.0.dir/libusb/os/events_windows.c.obj CMakeFiles/usb-1.0.dir/libusb/os/threads_windows.c.obj CMakeFiles/usb-1.0.dir/libusb/os/windows_common.c.obj CMakeFiles/usb-1.0.dir/libusb/os/windows_usbdk.c.obj CMakeFiles/usb-1.0.dir/libusb/os/windows_winusb.c.obj CMakeFiles/usb-1.0.dir/libusb/libusb-1.0.rc.res && : LINK : warning LNK4044: unrecognized option '/lib'; ignored LINK : warning LNK4044: unrecognized option '/lib'; ignored LINK : fatal error LNK1561: entry point must be defined
这个就是用 CMAKE_STATIC_LINKER_FLAGS
的结果。
貌似只能改成 lib.exe
了,不过有点 hardcode 了
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.
is_host("linux")
这个判断可以删除,在 host windows 交叉编译 target windows arm64 也出现了这个问题。
#4501 (comment)