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

apple-clang 9.0 error #1778

Closed
ovanes opened this issue Sep 20, 2017 · 12 comments
Closed

apple-clang 9.0 error #1778

ovanes opened this issue Sep 20, 2017 · 12 comments

Comments

@ovanes
Copy link

ovanes commented Sep 20, 2017

Just upgraded Xcode and received new clang version 9.0.
This issue seems like an addon to: #1707

Now CMake produces the error:

Current conanbuildinfo.cmake directory: /some/build-dir
CMake Error at build/conanbuildinfo.cmake:724 (message):
  Incorrect 'apple-clang' version 'compiler.version=8.1' is not the one
  detected by CMake: 'AppleClang=9.0'
Call Stack (most recent call first):
  build/conanbuildinfo.cmake:767 (conan_error_compiler_version)
  build/conanbuildinfo.cmake:817 (check_compiler_version)
  build/conanbuildinfo.cmake:571 (conan_check_compiler)
  CMakeLists.txt:18 (conan_basic_setup)

I changed clang versions in the ~/.conan/settings.yml, that did not help. Afterwards I updated conan and was told that settings.yml was migrated.

Conan version is now:

$conan --version
Conan version 0.27.0

~/.conan/settings.yml content:


os:
    Windows:
    Linux:
    Macos:
    Android:
        api_level: ANY
    iOS:
        version: ["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3"]
    FreeBSD:
    SunOS:
    Arduino:
        board: ANY
arch: [x86, x86_64, ppc64le, ppc64, armv6, armv7, armv7hf, armv8, sparc, sparcv9, mips, mips64, avr]
compiler:
    sun-cc:
        version: ["5.10", "5.11", "5.12", "5.13", "5.14"]
        threads: [None, posix]
        libcxx: [libCstd, libstdcxx, libstlport, libstdc++]
    gcc:
        version: ["4.1", "4.4", "4.5", "4.6", "4.7", "4.8", "4.9", "5.1", "5.2", "5.3", "5.4", "6.1", "6.2", "6.3", "6.4", "7.1", "7.2"]
        libcxx: [libstdc++, libstdc++11]
        threads: [None, posix, win32] #  Windows MinGW
        exception: [None, dwarf2, sjlj, seh] # Windows MinGW
    Visual Studio:
        runtime: [MD, MT, MTd, MDd]
        version: ["8", "9", "10", "11", "12", "14", "15"]
    clang:
        version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0"]
        libcxx: [libstdc++, libstdc++11, libc++]
    apple-clang:
        version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0"]
        libcxx: [libstdc++, libc++]

build_type: [None, Debug, Release]

conan config get output

[storage]
path = ~/.conan/data

[remotes]
conan.io = https://server.conan.io
local = http://conan.local

[proxies]


[log]
run_to_output = True        # environment CONAN_LOG_RUN_TO_OUTPUT
run_to_file = False         # environment CONAN_LOG_RUN_TO_FILE
level = 50                  # environment CONAN_LOGGING_LEVEL
# trace_file =              # environment CONAN_TRACE_FILE
print_run_commands = False  # environment CONAN_PRINT_RUN_COMMANDS

[general]
compression_level = 9       # environment CONAN_COMPRESSION_LEVEL
sysrequires_sudo = True     # environment CONAN_SYSREQUIRES_SUDO
# cmake_generator           # environment CONAN_CMAKE_GENERATOR


[settings_defaults]
arch = x86_64
build_type = Release
compiler = apple-clang
compiler.version = 9.0
os = Macos
compiler.libcxx = libc++

Steps to reproduce:

  • Install todays Xcode upgrade
  • create a new build directory and cd there
  • run conan install .. --build=missing
  • run cmake ..

Notes

  • Seems like conan switched to profiles.
  • I suspect that cmake now determines the compiler name as AppleClang instead of apple-clang => modified settings.yml and edited profiles/default to use:
[settings]
arch = x86_64
build_type = Release
compiler = AppleClang
compiler.version = 9.0
os = Macos
compiler.libcxx = libc++

Now conan started to recompile the modules. Will report if that helped.

@memsharded
Copy link
Member

Yes, now the defaults settings are stored in .conan/profiles/default, and [settings_defaults] shouldn't exist in conan.conf

But the compiler is still called apple-clang in conan, so you shouldn't change it.

Could it be that your bare cmake invocation (after the install) is still using the older Xcode 8.1 apple-clang, instead of the new one?

@ovanes
Copy link
Author

ovanes commented Sep 20, 2017

I appended [settings_defaults] there, but there were not used. After the migration this section was not there.

When I run cmake after conan install .. I receive this full output:

make ..
-- The CXX compiler identification is AppleClang 9.0.0.9000037
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Current conanbuildinfo.cmake directory: /.../build
CMake Error at build/conanbuildinfo.cmake:724 (message):
  Incorrect 'apple-clang' version 'compiler.version=8.1' is not the one
  detected by CMake: 'AppleClang=9.0'
Call Stack (most recent call first):
  build/conanbuildinfo.cmake:767 (conan_error_compiler_version)
  build/conanbuildinfo.cmake:817 (check_compiler_version)
  build/conanbuildinfo.cmake:571 (conan_check_compiler)
  CMakeLists.txt:18 (conan_basic_setup)

Just to be sure, I ran afterwards:

$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ --version
Apple LLVM version 9.0.0 (clang-900.0.37)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

After the full rebuild of the modules, I still the the error from above.

@lasote
Copy link
Contributor

lasote commented Sep 20, 2017

Look at the file .conan/profiles/default. It should be adjusted to apple-clang 9

@ovanes
Copy link
Author

ovanes commented Sep 20, 2017

Ok, here are the 3 config files from my ~/.conan directory:

~/.conan/profiles/default

[settings]
arch = x86_64
build_type = Release
compiler = apple-clang
compiler.version = 9.0
os = Macos
compiler.libcxx = libc++

~/.conan/settings.yml


os:
    Windows:
    Linux:
    Macos:
    Android:
        api_level: ANY
    iOS:
        version: ["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3"]
    FreeBSD:
    SunOS:
    Arduino:
        board: ANY
arch: [x86, x86_64, ppc64le, ppc64, armv6, armv7, armv7hf, armv8, sparc, sparcv9, mips, mips64, avr]
compiler:
    sun-cc:
        version: ["5.10", "5.11", "5.12", "5.13", "5.14"]
        threads: [None, posix]
        libcxx: [libCstd, libstdcxx, libstlport, libstdc++]
    gcc:
        version: ["4.1", "4.4", "4.5", "4.6", "4.7", "4.8", "4.9", "5.1", "5.2", "5.3", "5.4", "6.1", "6.2", "6.3", "6.4", "7.1", "7.2"]
        libcxx: [libstdc++, libstdc++11]
        threads: [None, posix, win32] #  Windows MinGW
        exception: [None, dwarf2, sjlj, seh] # Windows MinGW
    Visual Studio:
        runtime: [MD, MT, MTd, MDd]
        version: ["8", "9", "10", "11", "12", "14", "15"]
    clang:
        version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0"]
        libcxx: [libstdc++, libstdc++11, libc++]
    apple-clang:
        version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0"]
        libcxx: [libstdc++, libc++]

build_type: [None, Debug, Release]

~/.conan/conan.conf

[storage]
path = ~/.conan/data

[remotes]
conan.io = https://server.conan.io
local = http://conan.local

[proxies]


[log]
run_to_output = True        # environment CONAN_LOG_RUN_TO_OUTPUT
run_to_file = False         # environment CONAN_LOG_RUN_TO_FILE
level = 50                  # environment CONAN_LOGGING_LEVEL
# trace_file =              # environment CONAN_TRACE_FILE
print_run_commands = False  # environment CONAN_PRINT_RUN_COMMANDS

[general]
compression_level = 9       # environment CONAN_COMPRESSION_LEVEL
sysrequires_sudo = True     # environment CONAN_SYSREQUIRES_SUDO
# cmake_generator           # environment CONAN_CMAKE_GENERATOR

@ovanes
Copy link
Author

ovanes commented Sep 20, 2017

Even grepping for 8.1 through the previously wiped build directory points to the log file:

./cmake-build-debug/CMakeFiles/CMakeOutput.log

containing:

The system is: Darwin - 16.7.0 - x86_64
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ 
Build flags: 
Id flags:  

The output was:
0


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out"

The CXX compiler identification is AppleClang, found in "/my-home/my-project-dir/cmake-build-debug/CMakeFiles/3.8.1/CompilerIdCXX/a.out"

Using:

$ strings ./cmake-build-debug/CMakeFiles/3.8.1/CompilerIdCXX/a.out

produces:

INFO:compiler[AppleClang]
INFO:platform[Darwin]
INFO:arch[]
INFO:dialect_default[98]
INFO:compiler_version[00000009.00000000.00000000.09000037]

As log file states my system runs cmake 3.8.1 and that's why I find the log file... Lucky co-incidence.

@memsharded
Copy link
Member

Thanks for the feedback, having a look.

@memsharded
Copy link
Member

Lets try to reduce it so something smaller that we can reproduce. Please try a very simple package creation:

$ conan new Hello/0.1 -s -t
$ conan create user/testing

Paste the whole output here. Thanks!

@ovanes
Copy link
Author

ovanes commented Sep 20, 2017

That one works:

conan new Hello/0.1 -s -t
File saved: conanfile.py
File saved: src/CMakeLists.txt
File saved: src/hello.cpp
File saved: src/hello.h
File saved: test_package/CMakeLists.txt
File saved: test_package/conanfile.py
File saved: test_package/example.cpp
(conan)mbprr:conan-clang9-test $ conan create user/testing
Hello/0.1@user/testing: Exporting package recipe
Hello/0.1@user/testing export: Copied 1 '.h' files: hello.h
Hello/0.1@user/testing export: Copied 1 '.cpp' files: hello.cpp
Hello/0.1@user/testing export: Copied 1 '.txt' files: CMakeLists.txt
Hello/0.1@user/testing: A new conanfile.py version was exported
Hello/0.1@user/testing: Folder: /Users/ovanes/.conan/data/Hello/0.1/user/testing/export
Hello/0.1@user/testing: Installing package
Requirements
    Hello/0.1@user/testing from local
Packages
    Hello/0.1@user/testing:7fe67dff831b24bc4a8b5db678a51f1be5e44e7c

Hello/0.1@user/testing: WARN: Forced build from source
Hello/0.1@user/testing: Building your package in /Users/ovanes/.conan/data/Hello/0.1/user/testing/build/7fe67dff831b24bc4a8b5db678a51f1be5e44e7c
Hello/0.1@user/testing: Configuring sources in /Users/ovanes/.conan/data/Hello/0.1/user/testing/source
Hello/0.1@user/testing: Copying sources to build folder
Hello/0.1@user/testing: Generator cmake created conanbuildinfo.cmake
Hello/0.1@user/testing: Calling build()
-- The CXX compiler identification is AppleClang 9.0.0.9000037
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: called by CMake conan helper
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan C++ stdlib: libc++
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/ovanes/.conan/data/Hello/0.1/user/testing/build/7fe67dff831b24bc4a8b5db678a51f1be5e44e7c
Scanning dependencies of target hello
[ 50%] Building CXX object CMakeFiles/hello.dir/hello.cpp.o
[100%] Linking CXX static library lib/libhello.a
[100%] Built target hello
Hello/0.1@user/testing: Package '7fe67dff831b24bc4a8b5db678a51f1be5e44e7c' built
Hello/0.1@user/testing: Build folder /Users/ovanes/.conan/data/Hello/0.1/user/testing/build/7fe67dff831b24bc4a8b5db678a51f1be5e44e7c
Hello/0.1@user/testing: Generated conaninfo.txt
Hello/0.1@user/testing: Generated conanbuildinfo.txt
Hello/0.1@user/testing: Generating the package
Hello/0.1@user/testing: Package folder /Users/ovanes/.conan/data/Hello/0.1/user/testing/package/7fe67dff831b24bc4a8b5db678a51f1be5e44e7c
Hello/0.1@user/testing: Calling package()
Hello/0.1@user/testing package(): Copied 1 '.h' files: hello.h
Hello/0.1@user/testing package(): Copied 1 '.a' files: libhello.a
Hello/0.1@user/testing: Package '7fe67dff831b24bc4a8b5db678a51f1be5e44e7c' created
Hello/0.1@user/testing: Testing with 'test_package'
Hello/0.1@user/testing test package: Installing dependencies
Hello/0.1@user/testing: Already installed!
Hello/0.1@user/testing test package: Generator cmake created conanbuildinfo.cmake
Hello/0.1@user/testing test package: Generator txt created conanbuildinfo.txt
Hello/0.1@user/testing test package: Generated conaninfo.txt
Hello/0.1@user/testing test package: Running build()
-- The CXX compiler identification is AppleClang 9.0.0.9000037
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: called by CMake conan helper
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan C++ stdlib: libc++
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/ovanes/projects/conan-clang9-test/test_package/build/da39a3ee5e6b4b0d3255bfef95601890afd80709
Scanning dependencies of target example
[ 50%] Building CXX object CMakeFiles/example.dir/example.cpp.o
[100%] Linking CXX executable bin/example
[100%] Built target example
Hello/0.1@user/testing test package: Running test()
Hello World Release!

@ovanes
Copy link
Author

ovanes commented Sep 20, 2017

I just grepped through my own package directory and see that there in test_package directory built modules refer to clang 8.1.

.//conan-zmq/test_package/build/ebf9df4f1d1163cb42855db8c26e6d33cf2f6112/conaninfo.txt:    compiler.version=8.1
.//conan-zmq/test_package/build/ebf9df4f1d1163cb42855db8c26e6d33cf2f6112/conaninfo.txt:    compiler.version=8.1

And these modules were deployed on my local system using conan test_package command. Can that be a problem?

@ovanes
Copy link
Author

ovanes commented Sep 20, 2017

And this is the conaninfo.txt file generated in the project's build directory:

[settings]
    arch=x86_64
    build_type=Release
    compiler=apple-clang
    compiler.libcxx=libc++
    compiler.version=9.0
    os=Macos

[requires]
    Boost/1.Y.Z
    Catch/1.Y.Z
    PicoSHA2/v1.0.0
    Protobuf/3.Y.Z
    SconaLogging/0.0.2
    Turtle/1.Y.Z
    cppzmq/4.Y.Z

[options]


[full_settings]
    arch=x86_64
    build_type=Release
    compiler=apple-clang
    compiler.libcxx=libc++
    compiler.version=9.0
    os=Macos

[full_requires]
    Boost/1.64.0@ovanes/stable:1a7c363b523ac384834f4b871c9eb91497b82dfb
    Catch/1.9.3@ovanes/stable:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
    PicoSHA2/v1.0.0@ovanes/stable:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
    Protobuf/3.2.0@ovanes/stable:5ca022a77eb41d746d5f6d861ddcfeee018deced
    SconaLogging/0.0.2@ovanes/stable:979225cbbb04bfc19dbe0aa37310408a802809b1
    Turtle/1.3.0@ovanes/stable:52c8e8d320ef379a383bf2e9b53a55b75223f482
    bzip2/1.0.6@lasote/stable:aa84d9aecf24e625da451318795116f31a55ba90
    cppzmq/4.2.1@ovanes/stable:1686cbbda545ba2177cad298877b69c2401b9b59
    libzmq/4.2.2@ovanes/stable:7fe67dff831b24bc4a8b5db678a51f1be5e44e7c
    zlib/1.2.11@lasote/stable:88263a5eedcad02ecba019e36cb1c59d215c43ff

[full_options]
    Boost:fPIC=False
    Boost:header_only=False
    Boost:python=False
    Boost:shared=True
    Boost:without_atomic=False
    Boost:without_chrono=False
    Boost:without_container=False
    Boost:without_context=False
    Boost:without_coroutine=False
    Boost:without_coroutine2=False
    Boost:without_date_time=False
    Boost:without_exception=False
    Boost:without_filesystem=False
    Boost:without_graph=False
    Boost:without_graph_parallel=False
    Boost:without_iostreams=False
    Boost:without_locale=False
    Boost:without_log=False
    Boost:without_math=False
    Boost:without_mpi=False
    Boost:without_process=False
    Boost:without_program_options=False
    Boost:without_random=False
    Boost:without_regex=False
    Boost:without_serialization=False
    Boost:without_signals=False
    Boost:without_system=False
    Boost:without_test=False
    Boost:without_thread=False
    Boost:without_timer=False
    Boost:without_type_erasure=False
    Boost:without_wave=False
    Protobuf:shared=True
    Protobuf:static=True
    Protobuf:use_static=False
    SconaLogging:shared=True
    bzip2:fPIC=True
    bzip2:shared=False
    libzmq:shared=False
    zlib:shared=True

[scope]
    dev=True

[recipe_hash]


[env]

And if I for example cat libzmq package's info file ~/.conan/data/libzmq/4.2.2/ovanes/stable/package/7fe67dff831b24bc4a8b5db678a51f1be5e44e7c/conaninfo.txt

[settings]
    arch=x86_64
    build_type=Release
    compiler=apple-clang
    compiler.libcxx=libc++
    compiler.version=9.0
    os=Macos

[requires]


[options]
    shared=False

[full_settings]
    arch=x86_64
    build_type=Release
    compiler=apple-clang
    compiler.libcxx=libc++
    compiler.version=9.0
    os=Macos

[full_requires]


[full_options]
    shared=False

[scope]

[recipe_hash]
    475f210e72620851791272ff2eeec9f9

[env]

@memsharded
Copy link
Member

Yes, that could be related, but not sure how.

The packages are built and installed for 9.0, which is right. It is in the local command that your build system is picking the wrong configuration somehow. Not sure how to debug it. Are you in slack or hangouts? Please ping us to info@conan.io, maybe we could arrange some interactive pair debugging

@ovanes
Copy link
Author

ovanes commented Sep 20, 2017

Many thanks @lasote
My CMakeLists.txt had that inclusion:

if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/build/conanbuildinfo.cmake) #Clion, with conanbuildinfo.cmake in build folder
    include(${CMAKE_CURRENT_SOURCE_DIR}/build/conanbuildinfo.cmake)
else()
    include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) # Not CLion
endif()

Which was wrong, because I was using the CLion build directory: cmake-build-debug and in fact build directory was also existing, so this if caused cmake to load config from the abandoned build directory and therefore the compiler check failed :(

The solution was:

if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) 
    include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
endif()

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

3 participants