-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
build: Improve build by cmake for Cygwin #2085
Conversation
cc @bradking |
|
cf71478
to
44ccd7f
Compare
Anything blocking this from inclusion? |
44ccd7f
to
887b8d1
Compare
Needs rebase (conflict). |
8ab0497
to
cee8643
Compare
cee8643
to
ed7edcf
Compare
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Waiting on #2504 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
ed7edcf
to
45e2022
Compare
@slurps-mad-rips Issabella, any chance you could take a look at this? |
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.
@saghul I left a few comments. I've got some personal choices I disagree with, but that's because I haven't had time to finish cleaning up the entire file itself. 😛
That said, we still haven't merged my unit test changes, which affects this PR to a degree as well. I'll ping on that commit when I have a moment (it's late here in my timezone so I'll have to wait until the day star is back in the sky 🙂)
That said, I know I can't have any authority on this, but I'm vehemently against renaming the "logical target" names for uv and uv_a until I have time to make sure that exporting targets works correctly. Right now if we change the CMake name for any of these targets, anyone including it directly within their build via add_subdirectory
(which my changes in #2504 allow for), their builds will break. It's possible to fix this, but I'd need to sit down and outline a plan as it's more than just a simple name change with some property settings.
still needs a rebase |
- Fix issue that can't build on Cygwin. - Fix file name of static library.
ff1bd8a
to
3e56e65
Compare
I rebased and squashed. |
CI no longer fails, as per #2085 (comment)
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
I have learned a lot more about CMake in the last couple years, starting from zero. I can now understand why that assertion was wrong. Furthermore:
Actually, it turns out that we already have numerous tests for this in CI, showing that luv should be perfectly happy with this change too. Had to rebase (merge conflicts with LIBUV_BUILD_SHARED) and then will plan to merge once CI finishes. |
Hi, especially the if(CYGWIN OR MSYS) I'm using msys2 which is up to date and cmake to build libUV. my cmake line is : |
@@ -8,5 +8,5 @@ Version: @PACKAGE_VERSION@ | |||
Description: multi-platform support library with a focus on asynchronous I/O. | |||
URL: http://libuv.org/ | |||
|
|||
Libs: -L${libdir} -luv_a @LIBS@ | |||
Libs: -L${libdir} -l:libuv.a @LIBS@ |
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.
Why is there a colon? It breaks the build for me:
[133/228] : && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -fPIC -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names wpinet/CMakeFiles/wpinet_dsclient.dir/examples/dsclient/dsclient.cpp.o -o bin/wpinet_dsclient lib/libwpinetd.a lib/libwpiutild.a /Users/leanderSchulten/git_projekte/vcpkg/vcpkg_installed/arm64-osx/debug/lib/libfmtd.a -l:libuv.a /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/lib/libpthread.tbd && :
FAILED: bin/wpinet_dsclient
: && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -fPIC -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names wpinet/CMakeFiles/wpinet_dsclient.dir/examples/dsclient/dsclient.cpp.o -o bin/wpinet_dsclient lib/libwpinetd.a lib/libwpiutild.a /Users/leanderSchulten/git_projekte/vcpkg/vcpkg_installed/arm64-osx/debug/lib/libfmtd.a -l:libuv.a /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/lib/libpthread.tbd && :
ld: library not found for -l:libuv.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
and removing it resolved this error.
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.
-l: is a different flag from -l and specifies a full file name (instead of just the soname)
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 this a gcc thing? Because I have a libuv.a
on my library search patch, but as written in the error message it is 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.
Seems that this is only supported by the gcc linker and not the llvm linker.
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.
It sounds like an ld.lld emulation bug in LLVM in that case
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.
But nearly all *.pc files I have seen are wrong in this respect.
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.
True, I don't really know why *.pc files seem to use -L${libdir}
, when the logical thing would be ${libdir}/libuv.a
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.
Ah, apparently it is because those particular flags have special meaning to pkg-config beyond their use in ld (c.f. PKG_CONFIG_SYSROOT_DIR)
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.
Hm ok. But this would mean that I use a pkg-config file from a lib of my host system to use a lib on my target system instead of using the pkg-config file of the lib for the target system directly (via PKG_CONFIG_PATH
).
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.
I probably patch the lib that uses libuv via pkgconfig to use cmake config files ... :D
Part of this MR is causing issues building on windows with Ninja generator. See #4139 |
As commit 17ea56e is apparently causing regressions, should it be reverted? It reverts cleanly. |
There is a part of that commit that is supposed to add the lib prefix when not gcc, which presumably fixes that already. But it only supports msvc |
The only parts of the MR that needs to be reverted are the lines which change the
I don't think this part fixes anything, even in MSVC, as that repro I posted on the issue is testing exactly that configuration.
That also imposing an unixism on windows. On windows, libs don't use a |
This reverts commit 17ea56e.
This makes cmake more consistent about how to name this file, otherwise sometimes it names it uv.lib and sometimes libuv.a depending on which compiler is selected or if ./configure is used. Refs: #2085 (comment)
This makes cmake more consistent about how to name this file, otherwise sometimes it names it uv.lib and sometimes libuv.a depending on which compiler is selected or if ./configure is used. Refs: #2085 (comment)
Add installation targets to Windows.Fix an issue that can't be compiled with MSVC in specific language environment.Change to be able to select whether to build static library or shared library.Fix problem where building on Windows fails if BUILD_TESTING is set.