You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When picking up libraries from multiple prefixes (which is quite common in practice, for example when you have /usr and /opt), it is very easy to get into a situation where the wrong library is being picked up by the linker. For example:
With PKG_CONFIG_PATH=/prefix1/lib/pkgconfig:/prefix2/lib/pkgconfig you'd expect libbar.a to be picked up from prefix1. But if you are aggregating flags like so:
The solution is that probe_library() should resolve the -L -l flags it receives from the pc file to on-disk files immediately, and pass those files to the linker:
/prefix2/lib/libfaz.a /prefix1/lib/libbar.a
If it is unable to find the corresponding library, it can fall back to the current behaviour. This should reduce the likelihood of incorrect libs being picked up considerably.
The text was updated successfully, but these errors were encountered:
When picking up libraries from multiple prefixes (which is quite common in practice, for example when you have
/usr
and/opt
), it is very easy to get into a situation where the wrong library is being picked up by the linker. For example:With
PKG_CONFIG_PATH=/prefix1/lib/pkgconfig:/prefix2/lib/pkgconfig
you'd expectlibbar.a
to be picked up fromprefix1
. But if you are aggregating flags like so:This will generate a linker line like:
The linker will resolve this to:
The solution is that
probe_library()
should resolve the-L -l
flags it receives from the pc file to on-disk files immediately, and pass those files to the linker:If it is unable to find the corresponding library, it can fall back to the current behaviour. This should reduce the likelihood of incorrect libs being picked up considerably.
The text was updated successfully, but these errors were encountered: