-
Notifications
You must be signed in to change notification settings - Fork 194
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 non-default compilers #13
Comments
Original comment by Jon Diprose (Bitbucket: well-jon, GitHub: Unknown): OK, how do you make this not eat backticks? `? No. `? Oh, it's markdown, so with a backslash. The above should show: cmake -DCMAKE_C_COMPILER=`which gcc` -DCMAKE_CXX_COMPILER=`which g++` ... So I actually do: /apps/well/cmake/2.8.12.2/bin/cmake -DCMAKE_C_COMPILER=`which gcc` -DCMAKE_CXX_COMPILER=`which g++` -DFORCE_OWN_FFTW=ON -DFORCE_OWN_FLTK=ON ../ |
Original comment by Bjoern Forsberg (Bitbucket: bforsbe, GitHub: bforsbe): That's strange. I just tried on my system and it appears to work for me;
What system are you on? |
Original comment by Stefan Fleischmann (Bitbucket: sfle, GitHub: Unknown): Hi Jon, regarding "eating backticks", just put command lines and program output in between code tags:
What is the output of "which gcc" on your system? I'm guessing it is /usr/bin/gcc which is in turn a link to something like gcc-5 or gcc-4.8.
vs.
|
Original comment by Jon Diprose (Bitbucket: well-jon, GitHub: Unknown): Understood - it was more that I always forget cmake doesn't do what I expect and adding it to the docs might save others a few minutes googling. As building c++11 code (or, in this case, getting avx instructions out of fftw) requires a non-standard compiler on EL6-based distros, I'm regularly using a non-standard compiler. For this build I'm using a local build of gcc4.9.3 installed to a non-standard (but visible cluster-wide) location. We use the environment-modules package to set up the correct environment for that build. I also use the scl-provided devtoolset-1.1 (gcc4.7.2, /opt/centos/devtoolset-1.1/root/usr/bin/gcc) and devtoolset-2 (gcc4.8.2, /opt/rh/devtoolset-2/root/usr/bin/gcc) versions. It's just easier for me to set my environment up right outside the build script and use `which gcc` inside the script. |
Original comment by Jon Diprose (Bitbucket: well-jon, GitHub: Unknown): Ah. From cmake's wiki: "Any other way (like writing make CC=gcc-3.3 CXX=g++-3.3) will not work". Every day is an education... |
Originally reported by: Jon Diprose (Bitbucket: well-jon, GitHub: Unknown)
cmake appears to determinedly ignore both PATH and CC environment variables when deciding what compiler to use. It might be useful to others if you could add a section to your installation documentation that suggests using something like:
cmake -DCMAKE_C_COMPILER=
which gcc
-DCMAKE_CXX_COMPILER=which g++
...to get the behaviour that I was naively expecting.
The text was updated successfully, but these errors were encountered: