[cmake-developers] Implicit library trouble with mixed languages
Christian Pfeiffer
cpfeiffer at live.de
Tue May 2 11:48:58 EDT 2017
Hi folks,
I've tried to link some code built with GNU G++ together with the PGI
Fortran compiler as linker. However, G++ pulls in libstdc++, which in
turn depends on libgcc_s. Any library starting with 'gcc' is being
ignored in CMakeParseImplicitLinkInfo.cmake L.136, so libgcc_s is being
stripped from the commandline. PGI Fortran however does not need
libgcc_s on its own and therefore won't link it. Alas, by stripping
libgcc_s from the implicit library list, the linking process fails due
to missing symbols. On a side note, PGI C also doesn't use libgcc_s,
only PGI C++ does. In fact, using an all PGI environment yields the same
issue.
I'd like to open an MR for this issue, but I'm not quite sure how to
perform the cleanup as it exists right now in a fashion that doesn't
include too many language-specific items on the link line - the reason
this removal process exists - but yet works in a robust fashion.
Ideally, we'd compare all enabled languages and strip the libraries that
are being linked by all, but given the way that enable_language() can be
called anywhere, that doesn't seem to lead to a solution to me.
Any suggestions on how to handle/fix the issue?
- Chris
More information about the cmake-developers
mailing list