-
Notifications
You must be signed in to change notification settings - Fork 55
Intel oneAPI compilers and libirc.so
The Intel oneAPI compilers default to a legacy library libirc.so that, depending on the project, gets linked to the shared library or application. The library libirc.so is problematic, because it looks like a shared library when it is actually a static library (run ldd on the file to check), and it is missing symbols from libc.so. This can lead to segmentation faults like the following when launching an application (see issue https://github.com/JCSDA/spack-stack/issues/1436 provides more information).
Relink `/path/to/libirc.so' with `/lib/x86_64-linux-gnu/libc.so.6' for IFUNC symbol `memmove'
This problem is fixed with a new, properly linked shared library libintlc.so that is contained in the Intel oneAPI installation. Even though Intel recommends using libintlc.so over libirc.so, they refuse to make it the default because of existing legacy systems. To switch from libirc.so to libintlc.so, one needs to pass the flag -shared-intel to the linker. Depending on the application/library and the build system, this can be implemented in different ways.
For the example of NEPTUNE, which uses the Fortran compiler to link Fortran, C++, and C code into the final executable, the following changes are necessary and sufficient in the CMake configuration:
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -shared-intel")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -shared-intel")