DrTimothyAldenDavis / SuiteSparse

The official SuiteSparse library: a suite of sparse matrix algorithms authored or co-authored by Tim Davis, Texas A&M University.
https://people.engr.tamu.edu/davis/suitesparse.html
Other
1.15k stars 259 forks source link

Explicitly select linker for some mixed language libraries. #853

Closed mmuetzel closed 2 months ago

mmuetzel commented 2 months ago

If no linker preference is set for a shared library, CMake is choosing the executable that is used for linking based on the highest linker preference value. If a library consists of C and Fortran sources, the Fortran compiler frontend has the higher linker preference value and it is chosen by default.

For the Intel oneAPI compiler with MSVC-like syntax icx-cl as the C and C++ compiler and the Intel oneAPI Fortran compilers ifort or ifx, this leads to the following situation in combination with WINDOWS_EXPORT_ALL_SYMBOLS:

That leads to the linked libraries being empty or only exporting the Fortran symbols.

This is probably an issue that should be fixed in CMake. (However, that doesn't seem to be solvable easily.) To work around the issue, explicitly specify to use the C compiler frontend as the linker for the AMD and CHOLMOD libraries.

Fixes #799.