-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
cmake(MSVC): building ortools_full.lib is not working in Debug #3822
Comments
to test: cmake -S. -Bbuild -DBUILD_DEPS=ON
cmake --build build --config Debug -v -j 8
cmake --install build --config Debug --prefix install ref: |
Postponed to next release since even Debug build seems broken: cmake --build build --config Debug -v -j 12
...
"C:\Users\...\or-tools\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\...\or-tools\build\ortools\math_opt\samples\cpp\cutting_stock.vcxproj" (default target) (173) ->
absl_synchronization.lib(mutex.obj) : error LNK2005: "private: void __cdecl absl::lts_20240116::Mutex::Dtor(void)" (?Dtor@Mutex@lts_20240116@absl@@AEAAXXZ) already defined in ortools.lib(model_storage.obj)
[C:\Users\...\or-tools\build\ortools\math_opt\samples\cpp\cutting_stock.vcxproj]
C:\Users\...\or-tools\build\DEBUG\bin\cutting_stock.exe : fatal error LNK1169: one or more multiply defined symbols found
[C:\Users\...\or-tools\build\ortools\math_opt\samples\cpp\cutting_stock.vcxproj] same for any executable -> need to dig for next release... |
I confirm that. It happens exactly to me using vs 2022 and only on debug build. I think it has to do with a recent change in abseils Mutex::Dtor. A simple solution would be to patch this part back to the abseil 202308-state, or wait for the already open issue to be resolved for the next release of abseil, see: This error however makes me think that the reason may as well be in how ortools' cmake is configured. Maybe DEBUG is not always set for every target or the BUILD_ABSEIL_DLL is not correctly set, I did not check it so far. Regarding the original issue of bundle install not working on windows: I confirm that it does not work be it on Debug or Release. The execute command fails in both configs, saying it does not find libortools_all.lib (during removal call at top of bundle-install.cmake). |
As spotted by user the cmake/bundle-install.cmake.in is not working in config Debug since we don't take into account the variable
CMAKE_DEBUG_POSTFIX
.here we should add few wildcard (or better use
${CMAKE_DEBUG_POSTFIX}
) to find the correct static lib dependenciesor-tools/cmake/bundle-install.cmake.in
Lines 16 to 38 in a834604
Todo:
ref: https://cmake.org/cmake/help/latest/variable/CMAKE_CONFIG_POSTFIX.html#variable:CMAKE_%3CCONFIG%3E_POSTFIX
The text was updated successfully, but these errors were encountered: