Use compiler from DOLFINConfig.cmake file
DOLFIN demos and JIT compilation should use
DOLFIN_CXX_COMPILER
from DOLFINConfig.cmake.
Using the default compiler can fail because of incompatible flags.
Comments (6)
-
-
The generated
CMakeList.txt
file used for JIT compilation of dolfin modules has:if (NOT $ENV{CXX}) set(CMAKE_CXX_COMPILER ${DOLFIN_CXX_COMPILER}) endif()
so for example all
Expressions
are compiled using the correct compiler. For JIT compiled UFC modules we have:if (NOT $ENV{CXX}) set(CMAKE_CXX_COMPILER ${UFC_CXX_COMPILER}) endif()
so that is not using DOLFIN_CXX_COMPILER. That saidin Python is UFC forms compiled without any bindings to DOLFIN, so I guess that should also be OK, right?
-
reporter There is something wrong because on Mac I compile DOLFIN using gcc, and then always have to set CXX to gcc, otherwise JIT compilation uses clang, which breaks on the OpenMP flags since clang does not support OpenMP.
I don't have the Mac with me right now to test.
-
Ok, this should work, as it was the one reason we switched to CMake for JIT.
-
reporter - assigned issue to
-
reporter - changed status to resolved
It seems that
if (NOT $ENV{CXX}) set(CMAKE_CXX_COMPILER ${UFC_CXX_COMPILER}) endif()
was not working. I have seen that position in the CMake file is important. Anyway, a cleaner has been implemented (CMake devs recommend not setting
CMAKE_CXX_COMPILER
in CMakeLists.txt files) withDOLFIN_CXX_FLAGS
no longer used. This has been made possible by not including CGAL header files via the DOLFIN public interface. UsingDOLFIN_CXX_FLAGS
is dangerous because they may be compiler-specific. - Log in to comment
Issue
#113was marked as a duplicate of this issue.