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
CMakeFile produces VS2015 Projects with Link Errors #981
Comments
Can you please show us some of those errors too? |
|
Ok, yes the unit tests can only build with debug versions of libcurl since it requires that a bunch of otherwise hidden symbols are available - to get tested. As they're not part of the regular API, they're not reachable in a normal build. I suppose the cmake build files need to skip building the unit tests unless that condition is met. That's what the autoconf based build does. |
I should add that all the 16xx tests (that are in tests/unit) are such unit tests. |
A cmake option to disable all tests would be nice, |
-DBUILD_TESTING=OFF I tried building the tests just now, I also ran into problems. |
Right, the cmake build should only try to build the unit tests when asked to build debug builds as otherwise it fails like this... |
@bagder @SparhawkSoftware @jay In fact Curl_hash_init symbols will be available if @SparhawkSoftware So if you want to fix build use |
It is probably still a good idea to have the build script check if the unit tests can get built before doing that, to avoid this build error. |
@bagder Linux exports all symbols by default. So all Curl_hash is in |
Aha! but that's a bug - it should hide symbols by default and what's what it does in the autoconf build! That's why the "regular" build can't be used for the unit test. Also, some unit tests use symbols that are otherwise marked static and I'm not sure they're always made available even if symbols aren't hidden. |
Confirmed that -DBUILD_TESTING=OFF fixes my issue. I should have noticed that flag in the CMAKE. Adding this near the top would be nice: |
The build should simply not build the unit tests if it can't link them... |
@SparhawkSoftware According to documentation this option already there and ON by default. @bagder So what's the decision? Are |
@snikulov They're not "optional". They're internal functions that are tested with unit tests. Those functions are not public and will never be, they're not part of any official API. All functions in libcurl that start with an uppercase 'Curl' are like that. They're also subject to change at any time, but then we of course also need to update the tests. |
@snikulov the option statement with a comment makes it clearer. @bagder the issue comes from the way cmake works with VisualStudio because cmake adds all projects to a single solution and msbuild always builds all projects in the solution. It is not possible to not build the test projects without manually editing the outputs of cmake which defeats the purpose of using cmake. |
I'm just saying that when cmake is invoked, it can determine if the unit tests can get built or not and only if they can it should attempt that. |
Detect support for compiler symbol visibility flags and apply those according to CURL_HIDDEN_SYMBOLS option. It should work true to the autotools build except it tries to unhide symbols on Windows when requested and prints warning if it fails. Ref: #981 (comment) Reported-by: Daniel Stenberg
The fix does not work.
|
I have a similar problem, in Windows.
, the windows sockets library is missing from the curl library , so you get linking errors
one way to fix this is to manually edit the generated libcurl.vcxproj and add
but this should be fixed in some way on the curl Cmake script to reproduce the bug, do
this clones and builds curl and netcdf for curl, it is used
|
Ran cmake to create VS0125 projects with
-DHTTP_ONLY:BOOL=ON -DBUILD_CURL_EXE:BOOL=OFF
msbuild /p:Configuration=Debug CURL.sln
I expected it to work but a bunch of test programs failed with linker errors.
The cmake options don't make a difference.
Same problem with no options.
I reverted to 7_48_0 and everything was fine.
The text was updated successfully, but these errors were encountered: