Linking issue with BUILD_SHARED_LIBS + Intel toolchain
When compiling QE with the intel toolchain (tried with 2022 and 2023 versions), i encounter the following error:
[ 40%] Built target qe_cpv_exe
ld: CMakeFiles/qe_cpv_cppp_exe.dir/src/cppp.f90.o: undefined reference to symbol 'remove_stack_limit_'
ld: /home/crivella/Codes/QE/7.3-cmake_manual/_build/Modules/libqe_modules_c.so: error adding symbols: DSO missing from command line
which is related to the function being enabled for intel compilers https://gitlab.com/QEF/q-e/-/blob/develop/CPV/src/cppp.f90#L69 (as I did not encounter this problem with a foss toolchain)
This i think is due to libqe_modules_c.so
where the function is defined being set as a private dependency of libqe_modules.so
at https://gitlab.com/QEF/q-e/-/blob/develop/Modules/CMakeLists.txt?ref_type=heads#L228
One possible solution would be to either move this as a public dependency or to add -Wl,--copy-dt-needed-entries
to LDFLAGS
during compilation (https://stackoverflow.com/questions/19901934/libpthread-so-0-error-adding-symbols-dso-missing-from-command-line).
Not sure which would be the preferred route for solving this (eg public dependency, enforcing LDFLAGS, or just add comment for users about the LDFLAGS)