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

Allow project options to be used in creation of a conan package. #122

Merged
merged 4 commits into from Apr 27, 2022

Conversation

lambtonr
Copy link
Contributor

Stumbled across this problem when using project options to build a library, that library could no longer be built via a conan recipe.

i have wrapped part of the conan.cmake to test if we are been built via conan and allow conan to define the build settings, rather than call ''conan_cmake_autodetect``

you can find my test project library and recipe that shows the problem (currently calling my fork of project options) reverting back to current release should show the following issue.

gcc conan create ./all 0.0.1@lambtonr/testing

[ 50%] Building CXX object CMakeFiles/example.dir/example.cpp.o
[100%] Linking CXX executable bin/example
[100%] Built target example
HelloWorld/0.0.1@lambtonr/testing (test package): Running test()
Hello World! Release!

clang conan create ./all 0.0.1@lambtonr/testing

[ 50%] Building CXX object CMakeFiles/example.dir/example.cpp.o
[100%] Linking CXX executable bin/example
CMakeFiles/example.dir/example.cpp.o: In function `main':
example.cpp:(.text+0xd): undefined reference to `ConanLibrary::HelloWorld()'

This is caused by the fact conan_cmake_autodetect will use different setting to conan GCC default profile matches that of conan_cmake_autodetect where as clangs defaults differ causing the issue.

Configuration: (conan profile show default)
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=clang
compiler.libcxx=libstdc++
compiler.version=13
os=Linux
os_build=Linux
[options]
[build_requires]
[env]

....

Configuration: (conan_cmake_autodetect)
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=clang
compiler.cppstd=11
compiler.libcxx=libstdc++11
compiler.version=13
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
CC=
CXX=/usr/bin/clang++

@aminya
Copy link
Owner

aminya commented Apr 20, 2022

@ddalcino Could you review this?

src/Conan.cmake Outdated Show resolved Hide resolved
@aminya
Copy link
Owner

aminya commented Apr 20, 2022

The MacOS failure seems to be caused by llvm 14.0.0.

ld: warning: dylib (/Users/runner/hostedtoolcache/llvm/14.0.0/x64/lib/libc++.dylib) was built for newer macOS version (11.6) than being linked (11.0)
ld: warning: dylib (/Users/runner/hostedtoolcache/llvm/14.0.0/x64/lib/libunwind.dylib) was built for newer macOS version (11.6) than being linked (11.0)
ld: warning: dylib (/Users/runner/hostedtoolcache/llvm/14.0.0/x64/lib/libunwind.dylib) was built for newer macOS version (11.6) than being linked (11.0)
ThinLTO: CMakeFiles/main.dir/Release/src/main/main.cpp.o0: error: Invalid record
LLVM ERROR: Can't load module, abort.
clang-14: error: unable to execute command: Abort trap: 6
clang-14: error: linker command failed due to signal (use -v to see invocation)

Co-authored-by: Amin Yahyaabadi <aminyahyaabadi74@gmail.com>
src/Conan.cmake Outdated Show resolved Hide resolved
Co-authored-by: Amin Yahyaabadi <aminyahyaabadi74@gmail.com>
@lambtonr lambtonr requested a review from aminya April 27, 2022 12:28
@aminya aminya merged commit 6fc988c into aminya:main Apr 27, 2022
@aminya
Copy link
Owner

aminya commented Apr 27, 2022

Thanks for fixing this!

@aminya aminya mentioned this pull request Apr 27, 2022
1 task
@aminya aminya added bug Something isn't working enhancement New feature or request labels Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants