Skip to content

CMakeParseLibraryArchitecture: Fix parsing /lib/<arch> implicit object path

The current regular expression is able to match /usr/lib/<arch>, /usr/usr/lib/<arch>, /usr/usr/usr/lib/<arch>, ... but not /lib/<arch>.

This behavior ends up causing the detected architecture to be x86_64-pc-linux-gnu when the Clang compiler is installed on a "non-system" location (like /opt/llvm-13) which, in turn, makes almost every find_library() fail because the correct architecture is x86_64-linux-gnu.

This is due to a typo in !5984 (merged), which used + instead of ?.

Backport: release
Topic-rename: lib-arch-no-usr

Edited by Brad King

Merge request reports