summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorRaphael Gozzo <raphael.rg91@gmail.com>2021-12-06 15:03:10 -0300
committerBrad King <brad.king@kitware.com>2021-12-06 16:47:29 -0500
commitd4ba945c48a3af674bdd95157d18d6236f7c2472 (patch)
treea43dd3d0f76e089e28d911fc2aa74be053d0f98c /Tests
parent60ebe5f3da67151f79e068f193ff309f7a358d41 (diff)
downloadcmake-d4ba945c48a3af674bdd95157d18d6236f7c2472.tar.gz
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 commit 764606e256 (CMakeDetermineCompilerABI: Extract lib arch from implicit object file paths, 2021-04-05, v3.20.1~10^2), which used `+` instead of `?`.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-custom_clang-C-Clang-13.0.0.input56
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-custom_clang-CXX-Clang-13.0.0.input58
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake1
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/results/linux-custom_clang-C-Clang-13.0.0.output1
-rw-r--r--Tests/RunCMake/ParseImplicitIncludeInfo/results/linux-custom_clang-CXX-Clang-13.0.0.output1
-rw-r--r--Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake1
-rw-r--r--Tests/RunCMake/ParseImplicitLinkInfo/results/linux-custom_clang-C-Clang-13.0.0.output3
-rw-r--r--Tests/RunCMake/ParseImplicitLinkInfo/results/linux-custom_clang-CXX-Clang-13.0.0.output3
8 files changed, 124 insertions, 0 deletions
diff --git a/Tests/RunCMake/ParseImplicitData/linux-custom_clang-C-Clang-13.0.0.input b/Tests/RunCMake/ParseImplicitData/linux-custom_clang-C-Clang-13.0.0.input
new file mode 100644
index 0000000000..a80592c103
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitData/linux-custom_clang-C-Clang-13.0.0.input
@@ -0,0 +1,56 @@
+CMAKE_LANG=C
+CMAKE_LINKER=/opt/llvm-13/bin/ld.lld
+CMAKE_C_COMPILER_ABI=ELF
+CMAKE_C_COMPILER_AR=/opt/llvm-13/bin/llvm-ar
+CMAKE_C_COMPILER_ARCHITECTURE_ID=
+CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN=
+CMAKE_C_COMPILER_ID=Clang
+CMAKE_C_COMPILER_LAUNCHER=
+CMAKE_C_COMPILER_LOADED=1
+CMAKE_C_COMPILER_RANLIB=/opt/llvm-13/bin/llvm-ranlib
+CMAKE_C_COMPILER_TARGET=
+CMAKE_C_COMPILER_VERSION=13.0.0
+CMAKE_C_COMPILER_VERSION_INTERAL=
+Change Dir: /tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp
+
+Run Build Command(s):/usr/bin/make -f Makefile cmTC_91833/fast && /usr/bin/make -f CMakeFiles/cmTC_91833.dir/build.make CMakeFiles/cmTC_91833.dir/build
+make[1]: Entering directory '/tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp'
+Building C object CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o
+/opt/llvm-13/bin/clang -v -MD -MT CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o -MF CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o.d -o CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o -c /opt/cmake-3.21.3/share/cmake-3.21/Modules/CMakeCCompilerABI.c
+clang version 13.0.0
+Target: x86_64-pc-linux-gnu
+Thread model: posix
+InstalledDir: /opt/llvm-13/bin
+Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
+Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
+Candidate multilib: .@m64
+Candidate multilib: 32@m32
+Candidate multilib: x32@mx32
+Selected multilib: .@m64
+ (in-process)
+ "/opt/llvm-13/bin/clang-13" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -main-file-name CMakeCCompilerABI.c -mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -v -fcoverage-compilation-dir=/tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp -resource-dir /opt/llvm-13/lib/clang/13.0.0 -dependency-file CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o.d -MT CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o -sys-header-deps -internal-isystem /opt/llvm-13/lib/clang/13.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp -ferror-limit 19 -fgnuc-version=4.2.1 -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o -x c /opt/cmake-3.21.3/share/cmake-3.21/Modules/CMakeCCompilerABI.c
+clang -cc1 version 13.0.0 based upon LLVM 13.0.0 default target x86_64-pc-linux-gnu
+ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include"
+ignoring nonexistent directory "/include"
+#include "..." search starts here:
+#include <...> search starts here:
+ /opt/llvm-13/lib/clang/13.0.0/include
+ /usr/local/include
+ /usr/include/x86_64-linux-gnu
+ /usr/include
+End of search list.
+Linking C executable cmTC_91833
+/opt/cmake-3.21.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_91833.dir/link.txt --verbose=1
+/opt/llvm-13/bin/clang -v -rdynamic CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o -o cmTC_91833
+clang version 13.0.0
+Target: x86_64-pc-linux-gnu
+Thread model: posix
+InstalledDir: /opt/llvm-13/bin
+Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
+Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
+Candidate multilib: .@m64
+Candidate multilib: 32@m32
+Candidate multilib: x32@mx32
+Selected multilib: .@m64
+ "/opt/llvm-13/bin/ld.lld" -export-dynamic -z relro --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_91833 /lib/x86_64-linux-gnu/crt1.o /lib/x86_64-linux-gnu/crti.o /opt/llvm-13/lib/clang/13.0.0/lib/x86_64-pc-linux-gnu/clang_rt.crtbegin.o -L/opt/llvm-13/bin/../lib/x86_64-pc-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/opt/llvm-13/bin/../lib -L/lib -L/usr/lib CMakeFiles/cmTC_91833.dir/CMakeCCompilerABI.c.o /opt/llvm-13/lib/clang/13.0.0/lib/x86_64-pc-linux-gnu/libclang_rt.builtins.a --as-needed -l:libunwind.so --no-as-needed -lc /opt/llvm-13/lib/clang/13.0.0/lib/x86_64-pc-linux-gnu/libclang_rt.builtins.a --as-needed -l:libunwind.so --no-as-needed /opt/llvm-13/lib/clang/13.0.0/lib/x86_64-pc-linux-gnu/clang_rt.crtend.o /lib/x86_64-linux-gnu/crtn.o
+make[1]: Leaving directory '/tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitData/linux-custom_clang-CXX-Clang-13.0.0.input b/Tests/RunCMake/ParseImplicitData/linux-custom_clang-CXX-Clang-13.0.0.input
new file mode 100644
index 0000000000..e65639006a
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitData/linux-custom_clang-CXX-Clang-13.0.0.input
@@ -0,0 +1,58 @@
+CMAKE_LANG=CXX
+CMAKE_LINKER=/opt/llvm-13/bin/ld.lld
+CMAKE_CXX_COMPILER_ABI=ELF
+CMAKE_CXX_COMPILER_AR=/opt/llvm-13/bin/llvm-ar
+CMAKE_CXX_COMPILER_ARCHITECTURE_ID=
+CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN=
+CMAKE_CXX_COMPILER_ID=Clang
+CMAKE_CXX_COMPILER_LAUNCHER=
+CMAKE_CXX_COMPILER_LOADED=1
+CMAKE_CXX_COMPILER_RANLIB=/opt/llvm-13/bin/llvm-ranlib
+CMAKE_CXX_COMPILER_TARGET=
+CMAKE_CXX_COMPILER_VERSION=13.0.0
+CMAKE_CXX_COMPILER_VERSION_INTERAL=
+Change Dir: /tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp
+
+Run Build Command(s):/usr/bin/make -f Makefile cmTC_5372b/fast && /usr/bin/make -f CMakeFiles/cmTC_5372b.dir/build.make CMakeFiles/cmTC_5372b.dir/build
+make[1]: Entering directory '/tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp'
+Building CXX object CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o
+/opt/llvm-13/bin/clang++ -v -MD -MT CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o -MF CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o.d -o CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o -c /opt/cmake-3.21.3/share/cmake-3.21/Modules/CMakeCXXCompilerABI.cpp
+clang version 13.0.0
+Target: x86_64-pc-linux-gnu
+Thread model: posix
+InstalledDir: /opt/llvm-13/bin
+Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
+Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
+Candidate multilib: .@m64
+Candidate multilib: 32@m32
+Candidate multilib: x32@mx32
+Selected multilib: .@m64
+ (in-process)
+ "/opt/llvm-13/bin/clang-13" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -main-file-name CMakeCXXCompilerABI.cpp -mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -v -fcoverage-compilation-dir=/tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp -resource-dir /opt/llvm-13/lib/clang/13.0.0 -dependency-file CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o.d -MT CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o -sys-header-deps -internal-isystem /opt/llvm-13/bin/../include/x86_64-pc-linux-gnu/c++/v1 -internal-isystem /opt/llvm-13/bin/../include/c++/v1 -internal-isystem /opt/llvm-13/lib/clang/13.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir=/tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp -ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o -x c++ /opt/cmake-3.21.3/share/cmake-3.21/Modules/CMakeCXXCompilerABI.cpp
+clang -cc1 version 13.0.0 based upon LLVM 13.0.0 default target x86_64-pc-linux-gnu
+ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include"
+ignoring nonexistent directory "/include"
+#include "..." search starts here:
+#include <...> search starts here:
+ /opt/llvm-13/bin/../include/x86_64-pc-linux-gnu/c++/v1
+ /opt/llvm-13/bin/../include/c++/v1
+ /opt/llvm-13/lib/clang/13.0.0/include
+ /usr/local/include
+ /usr/include/x86_64-linux-gnu
+ /usr/include
+End of search list.
+Linking CXX executable cmTC_5372b
+/opt/cmake-3.21.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_5372b.dir/link.txt --verbose=1
+/opt/llvm-13/bin/clang++ -v -rdynamic CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_5372b
+clang version 13.0.0
+Target: x86_64-pc-linux-gnu
+Thread model: posix
+InstalledDir: /opt/llvm-13/bin
+Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
+Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
+Candidate multilib: .@m64
+Candidate multilib: 32@m32
+Candidate multilib: x32@mx32
+Selected multilib: .@m64
+ "/opt/llvm-13/bin/ld.lld" -export-dynamic -z relro --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_5372b /lib/x86_64-linux-gnu/crt1.o /lib/x86_64-linux-gnu/crti.o /opt/llvm-13/lib/clang/13.0.0/lib/x86_64-pc-linux-gnu/clang_rt.crtbegin.o -L/opt/llvm-13/bin/../lib/x86_64-pc-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/opt/llvm-13/bin/../lib -L/lib -L/usr/lib CMakeFiles/cmTC_5372b.dir/CMakeCXXCompilerABI.cpp.o -lc++ -lm /opt/llvm-13/lib/clang/13.0.0/lib/x86_64-pc-linux-gnu/libclang_rt.builtins.a -l:libunwind.so -lc /opt/llvm-13/lib/clang/13.0.0/lib/x86_64-pc-linux-gnu/libclang_rt.builtins.a -l:libunwind.so /opt/llvm-13/lib/clang/13.0.0/lib/x86_64-pc-linux-gnu/clang_rt.crtend.o /lib/x86_64-linux-gnu/crtn.o
+make[1]: Leaving directory '/tmp/cmake/Tests/RunCMake/ParseImplicitData/build/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake
index e501f122e5..75c26a7a17 100644
--- a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake
@@ -38,6 +38,7 @@ set(targets
linux-C-XL-16.1.0.0 linux-CXX-XL-16.1.0.0
linux-CUDA-NVIDIA-10.1.168-CLANG linux-CUDA-NVIDIA-10.1.168-XLClang-v-empty
linux-CUDA-NVIDIA-9.2.148-GCC
+ linux-custom_clang-C-Clang-13.0.0 linux-custom_clang-CXX-Clang-13.0.0
mingw.org-C-GNU-4.9.3 mingw.org-CXX-GNU-4.9.3
netbsd-C-GNU-4.8.5 netbsd-CXX-GNU-4.8.5
netbsd_nostdinc-C-GNU-4.8.5 netbsd_nostdinc-CXX-GNU-4.8.5
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/results/linux-custom_clang-C-Clang-13.0.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/results/linux-custom_clang-C-Clang-13.0.0.output
new file mode 100644
index 0000000000..2435c62fb8
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/results/linux-custom_clang-C-Clang-13.0.0.output
@@ -0,0 +1 @@
+/opt/llvm-13/lib/clang/13.0.0/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/results/linux-custom_clang-CXX-Clang-13.0.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/results/linux-custom_clang-CXX-Clang-13.0.0.output
new file mode 100644
index 0000000000..de5a3689c9
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitIncludeInfo/results/linux-custom_clang-CXX-Clang-13.0.0.output
@@ -0,0 +1 @@
+/opt/llvm-13/include/x86_64-pc-linux-gnu/c\+\+/v1;/opt/llvm-13/include/c\+\+/v1;/opt/llvm-13/lib/clang/13.0.0/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include
diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake b/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake
index dcdc7f1b96..51c88325f8 100644
--- a/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake
+++ b/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake
@@ -38,6 +38,7 @@ set(targets
linux-C-XL-16.1.0.0 linux-CXX-XL-16.1.0.0
linux-CUDA-NVIDIA-10.1.168-CLANG linux-CUDA-NVIDIA-10.1.168-XLClang-v
linux-CUDA-NVIDIA-9.2.148-GCC
+ linux-custom_clang-C-Clang-13.0.0 linux-custom_clang-CXX-Clang-13.0.0
mingw.org-C-GNU-4.9.3 mingw.org-CXX-GNU-4.9.3
netbsd-C-GNU-4.8.5 netbsd-CXX-GNU-4.8.5
netbsd_nostdinc-C-GNU-4.8.5 netbsd_nostdinc-CXX-GNU-4.8.5
diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-custom_clang-C-Clang-13.0.0.output b/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-custom_clang-C-Clang-13.0.0.output
new file mode 100644
index 0000000000..108712d565
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-custom_clang-C-Clang-13.0.0.output
@@ -0,0 +1,3 @@
+libs=-l:libunwind.so;c;-l:libunwind.so
+dirs=/opt/llvm-13/lib/x86_64-pc-linux-gnu;/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib64;/lib/x86_64-linux-gnu;/lib64;/usr/lib/x86_64-linux-gnu;/opt/llvm-13/lib;/lib;/usr/lib
+library_arch=x86_64-linux-gnu
diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-custom_clang-CXX-Clang-13.0.0.output b/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-custom_clang-CXX-Clang-13.0.0.output
new file mode 100644
index 0000000000..e4a8a70ebc
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-custom_clang-CXX-Clang-13.0.0.output
@@ -0,0 +1,3 @@
+libs=c\+\+;m;-l:libunwind.so;c;-l:libunwind.so
+dirs=/opt/llvm-13/lib/x86_64-pc-linux-gnu;/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib64;/lib/x86_64-linux-gnu;/lib64;/usr/lib/x86_64-linux-gnu;/opt/llvm-13/lib;/lib;/usr/lib
+library_arch=x86_64-linux-gnu