-
-
Notifications
You must be signed in to change notification settings - Fork 267
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: Revise status output for important build options & fix misc. annoyances #3654
Conversation
ea1fe0f
to
a7f9cf7
Compare
I gave this a try on Mac OSX, the LLVM detection works fine but the first run complained about geod24@geod24mbp2018 ~/projects/dlang/ldc/build-test (git)-[remotes/kinke/cmake_misc] % cmake ..
-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found host D compiler /usr/local/bin/ldmd2, with default flags ''
-- Host D compiler ID: LDMD
-- Host D compiler version: LDC - the LLVM D compiler (1.24.0)
-- Host D compiler front-end version: 2094
-- LLVM_NATIVE_ARCH: X86
-- Found LLVM: /usr/local/Cellar/llvm/11.0.1 (found suitable version "11.0.1", minimum required is "6.0")
-- Found mlir-tblgen: /usr/local/Cellar/llvm/11.0.1/bin/mlir-tblgen
-- -- Building LDC with MLIR support (/usr/local/Cellar/llvm/11.0.1)
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2")
-- Checking for module 'LLVMSPIRVLib'
-- No package 'LLVMSPIRVLib' found
-- -- Building LDC without SPIR-V support: not found
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
-- LDC version identifier: 1.25.0-git-a7f9cf7-dirty
-- -- Building LDC with dynamic compilation support (LDC_DYNAMIC_COMPILE): ON
-- -- Building LDC with integrated LLD linker (LDC_WITH_LLD): ON
-- -- Building LDC with plugin support (LDC_ENABLE_PLUGINS): ON
CMake Error at cmake/Modules/ExtractDMDSystemLinker.cmake:41 (message):
Failed to link empty D program using '/usr/local/bin/ldmd2 -wi'
Call Stack (most recent call first):
CMakeLists.txt:642 (include)
-- Configuring incomplete, errors occurred!
See also "/Users/geod24/projects/dlang/ldc/build-test/CMakeFiles/CMakeOutput.log".
See also "/Users/geod24/projects/dlang/ldc/build-test/CMakeFiles/CMakeError.log". When I re-ran it, without changing anything, it passed: 1 geod24@geod24mbp2018 ~/projects/dlang/ldc/build-test (git)-[remotes/kinke/cmake_misc] % cmake .. :(
-- Found host D compiler /usr/local/bin/ldmd2, with default flags ''
-- Host D compiler ID: LDMD
-- Host D compiler version: LDC - the LLVM D compiler (1.24.0)
-- Host D compiler front-end version: 2094
-- LLVM_NATIVE_ARCH: X86
-- Found mlir-tblgen: /usr/local/Cellar/llvm/11.0.1/bin/mlir-tblgen
-- -- Building LDC with MLIR support (/usr/local/Cellar/llvm/11.0.1)
-- Checking for module 'LLVMSPIRVLib'
-- No package 'LLVMSPIRVLib' found
-- -- Building LDC without SPIR-V support: not found
-- LDC version identifier: 1.25.0-git-a7f9cf7-dirty
-- -- Building LDC with dynamic compilation support (LDC_DYNAMIC_COMPILE): ON
-- -- Building LDC with integrated LLD linker (LDC_WITH_LLD): ON
-- -- Building LDC with plugin support (LDC_ENABLE_PLUGINS): ON
-- Host D compiler linker program: /usr/bin/cc
-- Host D compiler linker flags: -L/usr/local/Cellar/ldc/1.24.0/lib;-lphobos2-ldc;-ldruntime-ldc;-ldl;-lpthread;-lm;-m64
-- -- Including LTO linker plugin (LDC_INSTALL_LTOPLUGIN): ON (/usr/local/Cellar/llvm/11.0.1/lib/libLTO.dylib)
-- -- Including LLVM compiler-rt libraries (LDC_INSTALL_LLVM_RUNTIME_LIBS): ON
-- -- - /usr/local/Cellar/llvm/11.0.1/lib/clang/11.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib --> libldc_rt.asan.dylib
/Library/Developer/CommandLineTools/usr/bin/install_name_tool: warning: changes being made to the file will invalidate the code signature in: /Users/geod24/projects/dlang/ldc/build-test/lib/libldc_rt.asan.dylib (for architecture x86_64)
/Library/Developer/CommandLineTools/usr/bin/install_name_tool: warning: changes being made to the file will invalidate the code signature in: /Users/geod24/projects/dlang/ldc/build-test/lib/libldc_rt.asan.dylib (for architecture arm64)
-- -- - /usr/local/Cellar/llvm/11.0.1/lib/clang/11.0.1/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib --> libldc_rt.tsan.dylib
/Library/Developer/CommandLineTools/usr/bin/install_name_tool: warning: changes being made to the file will invalidate the code signature in: /Users/geod24/projects/dlang/ldc/build-test/lib/libldc_rt.tsan.dylib (for architecture x86_64)
/Library/Developer/CommandLineTools/usr/bin/install_name_tool: warning: changes being made to the file will invalidate the code signature in: /Users/geod24/projects/dlang/ldc/build-test/lib/libldc_rt.tsan.dylib (for architecture arm64)
-- -- - /usr/local/Cellar/llvm/11.0.1/lib/clang/11.0.1/lib/darwin/libclang_rt.osx.a --> libldc_rt.builtins.a
-- -- - /usr/local/Cellar/llvm/11.0.1/lib/clang/11.0.1/lib/darwin/libclang_rt.profile_osx.a --> libldc_rt.profile.a
-- -- - /usr/local/Cellar/llvm/11.0.1/lib/clang/11.0.1/lib/darwin/libclang_rt.fuzzer_osx.a --> libldc_rt.fuzzer.a
-- -- - /usr/local/Cellar/llvm/11.0.1/lib/clang/11.0.1/lib/darwin/libclang_rt.xray_osx.a --> libldc_rt.xray.a
-- -- - /usr/local/Cellar/llvm/11.0.1/lib/clang/11.0.1/lib/darwin/libclang_rt.xray-basic_osx.a --> libldc_rt.xray-basic.a
-- -- - /usr/local/Cellar/llvm/11.0.1/lib/clang/11.0.1/lib/darwin/libclang_rt.xray-fdr_osx.a --> libldc_rt.xray-fdr.a
-- -- - /usr/local/Cellar/llvm/11.0.1/lib/clang/11.0.1/lib/darwin/libclang_rt.xray-profiling_osx.a --> libldc_rt.xray-profiling.a
-- Using path for Intrinsics.td: /usr/local/Cellar/llvm/11.0.1/include
-- The ASM compiler identification is Clang
-- Found assembler: /Library/Developer/CommandLineTools/usr/bin/cc
-- -- LDC runtime configuration:
-- -- - Building 32/64-bit libraries (MULTILIB): OFF
-- -- - Building shared libraries (BUILD_SHARED_LIBS): BOTH
-- -- - Building LTO libraries (BUILD_LTO_LIBS): OFF
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Use custom passes in jit: ON
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/geod24/projects/dlang/ldc/build-test |
Thx for testing; please re-test again from scratch, as that error should now show the compiler stderr output for troubleshooting. |
-- LDC version identifier: 1.25.0-git-fbc3161
-- -- Building LDC with dynamic compilation support (LDC_DYNAMIC_COMPILE): ON
-- -- Building LDC with integrated LLD linker (LDC_WITH_LLD): ON
-- -- Building LDC with plugin support (LDC_ENABLE_PLUGINS): ON
CMake Error at cmake/Modules/ExtractDMDSystemLinker.cmake:41 (message):
Failed to link empty D program using '/usr/local/bin/ldmd2 -wi':
ld: library not found for -ldl
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
Error: /Library/Developer/CommandLineTools/usr/bin/cc failed with status: 1
Call Stack (most recent call first):
CMakeLists.txt:642 (include)
-- Configuring incomplete, errors occurred!
See also "/Users/geod24/projects/dlang/ldc/build-test/CMakeFiles/CMakeOutput.log".
See also "/Users/geod24/projects/dlang/ldc/build-test/CMakeFiles/CMakeError.log". |
Hmm, that would mean a trivial |
Hum, the issue is that CMake is trying to pull in However, I don't know why |
Hmm, the compiler explicitly adds it for Darwin: Lines 650 to 658 in 4bee4e6
Edit: But we don't use it for the runtime libs (shared libs and test runners): Line 134 in 4bee4e6
|
set(linkdl "") | ||
if("${TARGET_SYSTEM}" MATCHES "Linux") | ||
set(linkdl "LINKDL=-L-ldl") | ||
endif() |
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.
Wouldn't https://cmake.org/cmake/help/latest/variable/CMAKE_DL_LIBS.html be better here ?
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.
Not for cross-compilation with our own TARGET_SYSTEM
semantics.
@Geod24: Have you tested the latest version by chance? |
Previously, it would print a *warning* but continue execution, running into some string-replace *error* due to an undefined variable later on, obfuscating this presumably rather common error.
…tion tests) dmd-testsuite doesn't depend on it anymore, and GNU make is probably rather exotic on Windows dev boxes (doesn't come with git).
This should fix concurrency errors/warnings like this, from Azure CI Windows: mv: cannot stat 'D:/a/1/build/runtime/objects/object.bc': No such file or directory ... many more ...
It's apparently not required to link with dl{open,close} and e.g. not set in CMAKE_DL_LIBS for Darwin targets.
@kinke : Sorry missed the notification. Haven't tested recently (since it needed to be compiled with a different host). |
No worries; thx for updating and note that you might be affected by #3673 as package maintainer (if so, then hopefully positively :)). |
No description provided.