-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[cmake] Normalize TARGET_SUBDIR paths #138524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Some code paths normalize ".." and thus don't create the directory. But some execute in a shell thus requiring the directory to exist to be able to take the parent directory. Normalize all the `TARGET_SUBDIR` variables to avoid this issue.
@llvm/pr-subscribers-libunwind @llvm/pr-subscribers-libc Author: Raul Tambre (tambry) ChangesSome code paths normalize ".." and thus don't create the directory. Full diff: https://github.com/llvm/llvm-project/pull/138524.diff 4 Files Affected:
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index b264dcb4974c7..f21fc2fba7305 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -220,6 +220,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
if(LIBC_LIBDIR_SUBDIR)
string(APPEND LIBC_TARGET_SUBDIR /${LIBC_LIBDIR_SUBDIR})
endif()
+ cmake_path(NORMAL_PATH LIBC_TARGET_SUBDIR)
endif()
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND (LIBC_ENABLE_USE_BY_CLANG OR LIBC_TARGET_OS_IS_GPU))
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index ebaa6e9fd0e97..da059ffef8034 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -419,6 +419,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
if(LIBCXX_LIBDIR_SUBDIR)
string(APPEND LIBCXX_TARGET_SUBDIR /${LIBCXX_LIBDIR_SUBDIR})
endif()
+ cmake_path(NORMAL_PATH LIBCXX_TARGET_SUBDIR)
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBCXX_TARGET_SUBDIR})
set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
set(LIBCXX_GENERATED_MODULE_DIR "${LLVM_BINARY_DIR}/modules/c++/v1")
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index 6dcfc51e55321..3e2f80b818450 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -187,6 +187,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
if(LIBCXXABI_LIBDIR_SUBDIR)
string(APPEND LIBCXXABI_TARGET_SUBDIR /${LIBCXXABI_LIBDIR_SUBDIR})
endif()
+ cmake_path(NORMAL_PATH LIBCXXABI_TARGET_SUBDIR)
set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBCXXABI_TARGET_SUBDIR})
set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBCXXABI_TARGET_SUBDIR} CACHE STRING
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index 3c8499fd33464..e27f3c2e2fc17 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -145,6 +145,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
if(LIBUNWIND_LIBDIR_SUBDIR)
string(APPEND LIBUNWIND_TARGET_SUBDIR /${LIBUNWIND_LIBDIR_SUBDIR})
endif()
+ cmake_path(NORMAL_PATH LIBUNWIND_TARGET_SUBDIR)
set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBUNWIND_TARGET_SUBDIR})
set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBUNWIND_TARGET_SUBDIR} CACHE STRING
"Path where built libunwind libraries should be installed.")
|
@llvm/pr-subscribers-libcxx Author: Raul Tambre (tambry) ChangesSome code paths normalize ".." and thus don't create the directory. Full diff: https://github.com/llvm/llvm-project/pull/138524.diff 4 Files Affected:
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index b264dcb4974c7..f21fc2fba7305 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -220,6 +220,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
if(LIBC_LIBDIR_SUBDIR)
string(APPEND LIBC_TARGET_SUBDIR /${LIBC_LIBDIR_SUBDIR})
endif()
+ cmake_path(NORMAL_PATH LIBC_TARGET_SUBDIR)
endif()
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND (LIBC_ENABLE_USE_BY_CLANG OR LIBC_TARGET_OS_IS_GPU))
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index ebaa6e9fd0e97..da059ffef8034 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -419,6 +419,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
if(LIBCXX_LIBDIR_SUBDIR)
string(APPEND LIBCXX_TARGET_SUBDIR /${LIBCXX_LIBDIR_SUBDIR})
endif()
+ cmake_path(NORMAL_PATH LIBCXX_TARGET_SUBDIR)
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBCXX_TARGET_SUBDIR})
set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
set(LIBCXX_GENERATED_MODULE_DIR "${LLVM_BINARY_DIR}/modules/c++/v1")
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index 6dcfc51e55321..3e2f80b818450 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -187,6 +187,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
if(LIBCXXABI_LIBDIR_SUBDIR)
string(APPEND LIBCXXABI_TARGET_SUBDIR /${LIBCXXABI_LIBDIR_SUBDIR})
endif()
+ cmake_path(NORMAL_PATH LIBCXXABI_TARGET_SUBDIR)
set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBCXXABI_TARGET_SUBDIR})
set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBCXXABI_TARGET_SUBDIR} CACHE STRING
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index 3c8499fd33464..e27f3c2e2fc17 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -145,6 +145,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
if(LIBUNWIND_LIBDIR_SUBDIR)
string(APPEND LIBUNWIND_TARGET_SUBDIR /${LIBUNWIND_LIBDIR_SUBDIR})
endif()
+ cmake_path(NORMAL_PATH LIBUNWIND_TARGET_SUBDIR)
set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBUNWIND_TARGET_SUBDIR})
set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBUNWIND_TARGET_SUBDIR} CACHE STRING
"Path where built libunwind libraries should be installed.")
|
Merging since this is both small and seems obviously correct. I technically don't have oversight of libc, but I don't think the owners would oppose this change. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/11/builds/14974 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/169/builds/11367 Here is the relevant piece of the build log for the reference
|
I forgot to comment on this patch, but it's fine from the libc side. |
Some code paths normalize ".." and thus don't create the directory.
But some execute in a shell thus requiring the directory to exist to be able to take the parent directory.
Normalize all the
TARGET_SUBDIR
variables to avoid this issue.