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

Compile error using ninja #48

Closed
arthaud opened this issue Dec 17, 2018 · 3 comments
Closed

Compile error using ninja #48

arthaud opened this issue Dec 17, 2018 · 3 comments
Labels
C-compiler-error Category: Compiler Error

Comments

@arthaud
Copy link
Member

arthaud commented Dec 17, 2018

I am getting an error when I try to build ikos using ninja:

$ cmake -GNinja ..
[...]
$ ninja
[35/119] Linking CXX executable frontend/llvm/ikos-pp
FAILED: frontend/llvm/ikos-pp
: && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -w -fdiagnostics-color -g -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,--color-diagnostics frontend/llvm/CMakeFiles/ikos-pp.dir/src/ikos_pp.cpp.o  -o frontend/llvm/ikos-pp  frontend/llvm/libikos-pp.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMAnalysis.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMAsmParser.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMBitReader.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMBitWriter.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMCodeGen.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMCore.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMCoroutines.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMInstCombine.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMInstrumentation.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMipo.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMIRReader.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMMC.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMObjCARCOpts.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMScalarOpts.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMSupport.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMTarget.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMTransformUtils.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMVectorize.a /Users/marthaud/Homebrew/lib/libboost_filesystem-mt.dylib /Users/marthaud/Homebrew/lib/libboost_system-mt.dylib /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMBitWriter.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMInstrumentation.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMAsmParser.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMLinker.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMInstCombine.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMAggressiveInstCombine.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMTransformUtils.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMAnalysis.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMObject.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMBitReader.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMMCParser.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMMC.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMDebugInfoCodeView.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMDebugInfoMSF.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMProfileData.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMCore.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMBinaryFormat.a /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMSupport.a -lz -lcurses -lm /Users/marthaud/Homebrew/Cellar/llvm/7.0.0_1/lib/libLLVMDemangle.a && :
ld: unknown option: --color-diagnostics
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[44/119] Building CXX object analyzer/CMakeFiles/ikos-analyzer.dir/src/ikos_analyzer.cpp.o
ninja: build stopped: subcommand failed.
@arthaud arthaud added the C-compiler-error Category: Compiler Error label Dec 17, 2018
@arthaud
Copy link
Member Author

arthaud commented Dec 18, 2018

This is a bug in llvm.

In HandleLLVMOptions.cmake, they add the flag -Wl,--color-diagnostics to provide colored linker errors. The problem is that --color-diagnostics is not supported by ld. It looks like they try to check if the option is supported before using it, but the test always passes.

@arthaud
Copy link
Member Author

arthaud commented Dec 18, 2018

The check_linker_flag() llvm function doesn't work in IKOS because we use cmake_minimum_required(VERSION 2.8.12.2 FATAL_ERROR), hence the cmake policy CMP0056 is set to OLD. Setting it to NEW fixes the issue.

@lixiaoquan
Copy link

I run into the same issue. If using cmake 3.1, check_linker_flag can work as expected, but when using cmake 3.12, check_linker_flag always passes. Could you please elobrate how you solved that problem? I added cmake_policy(set CMP0056 NEW) but that error still existed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-compiler-error Category: Compiler Error
Projects
None yet
Development

No branches or pull requests

2 participants