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

Using different compilers does not always go to dependencies #14

Open
KrisThielemans opened this issue Apr 29, 2017 · 4 comments
Open
Milestone

Comments

@KrisThielemans
Copy link
Member

KrisThielemans commented Apr 29, 2017

In bash, you can normally say

CC=gcc-5 CXX=g++-5 cmake .

to use a non-default compiler. However, these settings of CC do not get passed on to (some?) dependencies with the superbuild. It currently only works if you do

export CC=gcc-5
export CXX=g++-5
cmake .
@KrisThielemans KrisThielemans added this to the v1.0 milestone May 2, 2017
@KrisThielemans
Copy link
Member Author

This might help for the CMake projects (but not for configure etc)

http://stackoverflow.com/questions/32744788/forwarding-current-compiler-to-externalproject?rq=1

KrisThielemans pushed a commit that referenced this issue Jul 2, 2017
Use mark_as_superbuild to pass generator, platform info etc. This will
partial solve Issue #14 (but only for dependencies that build via CMake).
@KrisThielemans
Copy link
Member Author

This should no longer be a problem for CMake projects by using mark_as_superbuild. So I guess only configure projects affected. The suggested solution should work, so we'll postpone.

@KrisThielemans
Copy link
Member Author

The suggested solution of setting CC and CXX does not work for boost as Boost.Build ignores this and uses the system gcc anyway. It should be solvable by creating a user-config.jam, see an answer by Dave Riedel here

I have several different versions of gcc I need to work with so,
I have done this for a long time by modifying my user-config.jam as follows:
using gcc : : /<path to custom gcc>/bin/g++ : <linkflags>"-Wl,-rpath
-Wl,/<path to custom gcc>/lib64" ;

You need the rpath so that any shared libraries will find the correct
gcc runtime libraries. 

This would conceivably be possibly to do via CMake here, but it isn't trivial to get the complete and correct paths. The linkflags are presumably gcc specific as well.

we might still have to run ./b2 --toolset=gcc.

Boost bootstrap.sh seems to have a special toolset cc that might use CC environment variable, but @evgueni-ovtchinnikov and I couldn't get that to work.

@KrisThielemans
Copy link
Member Author

KrisThielemans commented Dec 18, 2018

Specifying compilers is actually not enough. We need to use the same C++ versions as well. See #161

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