Skip to content
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

[Bug]: Compilation issue on Windows 2022 with Ninja and CMake #1701

Open
BotellaA opened this issue Jul 5, 2024 · 0 comments
Open

[Bug]: Compilation issue on Windows 2022 with Ninja and CMake #1701

BotellaA opened this issue Jul 5, 2024 · 0 comments

Comments

@BotellaA
Copy link
Contributor

BotellaA commented Jul 5, 2024

Describe the issue

I am using the latest LTS 20240116.2. I am on Windows with visual studio 2022 and I use Ninja and CMake to build Abseil in shared library.
I cannot build from scratch Abseil, I have the following message, which does not clearly say something about the error:

[155/170] Linking CXX shared library bin\abseil_dll.dll
FAILED: bin/abseil_dll.dll absl/abseil_dll.lib 
cmd.exe /C "cmd.exe /C ""C:\Program Files\CMake\bin\cmake.exe" -E __create_def C:\Users\arnau\Documents\Code\OpenGeode\build\third_party\abseil\build\absl\CMakeFiles\abseil_dll.dir\.\exports.def C:\Users\arnau\Documents\Code\OpenGeode\build\third_party\abseil\build\absl\CMakeFiles\abseil_dll.dir\.\exports.def.objs && cd C:\Users\arnau\Documents\Code\OpenGeode\build\third_party\abseil\build" && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=absl\CMakeFiles\abseil_dll.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\abseil_dll.rsp  /out:bin\abseil_dll.dll /implib:absl\abseil_dll.lib /pdb:bin\abseil_dll.pdb /dll /version:0.0 /machine:x64 /debug /INCREMENTAL  /INCREMENTAL:NO /LTCG /DEF:absl\CMakeFiles\abseil_dll.dir\.\exports.def  && cd ."

Thanks for the help.

Steps to reproduce the problem

I am using ExternalProject_Add from CMake to configure and build Abseil. So it runs cmake with the following options and than build it.

ExternalProject_Add(abseil
    PREFIX ${ABSEIL_PATH}
    SOURCE_DIR ${ABSEIL_PATH}/src
    BINARY_DIR ${ABSEIL_PATH}/build
    STAMP_DIR ${ABSEIL_PATH}/stamp
    GIT_REPOSITORY https://github.com/abseil/abseil-cpp
    GIT_TAG 20240116.2
    GIT_SHALLOW ON
    GIT_PROGRESS ON
    CMAKE_GENERATOR ${CMAKE_GENERATOR}
    CMAKE_GENERATOR_PLATFORM ${CMAKE_GENERATOR_PLATFORM}
    CMAKE_ARGS
        -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
        -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
        -DCMAKE_INSTALL_MESSAGE=LAZY
        -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}        
        -DCMAKE_POLICY_DEFAULT_CMP0091=NEW
        -DCMAKE_MSVC_RUNTIME_LIBRARY:STRING=${CMAKE_MSVC_RUNTIME_LIBRARY}
        -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
        -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
        -DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=${CMAKE_INTERPROCEDURAL_OPTIMIZATION}
    CMAKE_CACHE_ARGS
        -DCMAKE_INSTALL_PREFIX:PATH=${ABSEIL_INSTALL_PREFIX}
)

What version of Abseil are you using?

LTS 20240116.2

What operating system and version are you using?

Windows

What compiler and version are you using?

visual studio 2022, C++17

What build system are you using?

cmake version 3.27.1 and ninja 1.11.1

Additional context

I run the compilation another time, than it works. Here the log of the second try.

[1/16] Linking CXX shared library bin\abseil_dll.dll
[2/16] Linking CXX static library absl\flags\absl_flags_commandlineflag_internal.lib
[3/16] Linking CXX static library absl\flags\absl_flags_program_name.lib
[4/16] Linking CXX static library absl\flags\absl_flags_marshalling.lib
[5/16] Linking CXX static library absl\log\absl_log_internal_fnmatch.lib
[6/16] Linking CXX static library absl\strings\absl_string_view.lib
[7/16] Linking CXX static library absl\flags\absl_flags_commandlineflag.lib
[8/16] Linking CXX static library absl\flags\absl_flags_config.lib
[9/16] Linking CXX static library absl\log\absl_vlog_config_internal.lib
[10/16] Linking CXX static library absl\flags\absl_flags_private_handle_accessor.lib
[11/16] Linking CXX static library absl\flags\absl_flags_internal.lib
[12/16] Linking CXX static library absl\flags\absl_flags_reflection.lib
[13/16] Linking CXX static library absl\log\absl_log_flags.lib
[14/16] Linking CXX static library absl\flags\absl_flags_usage_internal.lib
[15/16] Linking CXX static library absl\flags\absl_flags_usage.lib
[16/16] Linking CXX static library absl\flags\absl_flags_parse.lib
[61/74] Performing install step for 'abseil'

I also tried with visual studio instead of Ninja, the result is the same.
Do you have an idea of the issue? It is hard to run twice the compilation on our CI, I would prefer find the origin of the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant