Closed kenkopelson closed 4 months ago
It seems that you have this line in the root CMakeLists.txt file (line #41):
if(BUILD_UVW_SHARED_LIB)
set(BUILD_UVW_LIBS BOOL:ON)
endif()
This seems it could be wrong, since it will force the static lib to be built if the shared lib is requested. As I looked down further, I found this section, which seems to require both flags, but the files are not called the same: one is "uv" and the other is "uv_a".
if(FETCH_LIBUV AND BUILD_UVW_LIBS)
# libuv is only fetched when both above conditions are true
install(DIRECTORY ${libuv_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/uvw/uv/include)
if (BUILD_UVW_SHARED_LIB)
install(TARGETS uv EXPORT uvwConfig LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/uvw)
else()
install(TARGETS uv_a EXPORT uvwConfig ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/uvw)
endif()
endif(FETCH_LIBUV AND BUILD_UVW_LIBS)
The build.ninja file does not have those file name differences, so perhaps that is where the error is.
As I perused through the CMakeLists.txt files, it appeared that an assumption was made that the uvw.lib file produced during STATIC library build is compatible with uvw.lib file produced during SHARED library build. This is not the case, so it looks like a bit of rework will be required to get the make files working properly. I need to use this library very soon, so if there is any way you can fix this in a timely fashion, it would be incredibly appreciated. I like the work you did on this, and would like to put it to good use.
To be honest, I don't understand yet if you're hitting a wall with the static lib, the shared lib or while trying to mix them in the same executable. Can we start from what you're trying to do? Just to exclude XY-problems first of all. Thanks. 👍
Closing this issue as starving. Feel free to reopen it or continue the discussion here if needed. Thanks.
The following error is generated when compiling on Windows 10 using clang++:
ninja: error: build.ninja:914: multiple rules generate _deps/libuv-build/uv.lib
From what I can see, the build.ninja file has the following section in it:
This has the following targets at the top:
build _deps/libuv-build/uv.dll _deps/libuv-build/uv.lib
Then, further down in the build.ninja file (generated by CMake), we have the following:
This has the exact same target at the top, as the file in the SHARED library:
build _deps/libuv-build/uv.lib
As I'm sure you know, the static build uses the uv.lib file to contain all the contents of the library, while the same file in the shared build is used as the interface library file to the DLL. Even through the files are named the same, they will be different depending on whether they are linked for static or shared. Thus, it is invalid to build both the static and shared files, if the .lib file is named the same thing for each. It seems that the build files should only build the STATIC OR THE SHARED, but not both. Or call the files something different.