Skip to content
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

[libc][CMake] fix CMake configure issues on openSUSE #79751

Merged
merged 2 commits into from
Jan 28, 2024

Conversation

Lancern
Copy link
Member

@Lancern Lancern commented Jan 28, 2024

libc cannot be configured on openSUSE because openSUSE toolchain changes the triple format. This PR fixes this issue.

@llvmbot llvmbot added the libc label Jan 28, 2024
@llvmbot
Copy link

llvmbot commented Jan 28, 2024

@llvm/pr-subscribers-libc

Author: Sirui Mu (Lancern)

Changes

libc cannot be configured on openSUSE because openSUSE toolchain changes the triple format. This PR fixes this issue.


Full diff: https://github.com/llvm/llvm-project/pull/79751.diff

1 Files Affected:

  • (modified) libc/cmake/modules/LLVMLibCArchitectures.cmake (+5)
diff --git a/libc/cmake/modules/LLVMLibCArchitectures.cmake b/libc/cmake/modules/LLVMLibCArchitectures.cmake
index 10571101a341785..dbd3ea7293b2437 100644
--- a/libc/cmake/modules/LLVMLibCArchitectures.cmake
+++ b/libc/cmake/modules/LLVMLibCArchitectures.cmake
@@ -171,6 +171,11 @@ elseif(LIBC_TARGET_OS STREQUAL "poky")
   # include the right directories during compilation.
   set(LIBC_TARGET_OS_IS_LINUX TRUE)
   set(LIBC_TARGET_OS "linux")
+elseif(LIBC_TARGET_OS STREQUAL "suse")
+  # openSUSE uses different triple format which causes LIBC_TARGET_OS to be
+  # computed as "suse" instead of "linux".
+  set(LIBC_TARGET_OS_IS_LINUX TRUE)
+  set(LIBC_TARGET_OS "linux")
 elseif(LIBC_TARGET_OS STREQUAL "darwin")
   set(LIBC_TARGET_OS_IS_DARWIN TRUE)
 elseif(LIBC_TARGET_OS STREQUAL "windows")

@@ -171,6 +171,11 @@ elseif(LIBC_TARGET_OS STREQUAL "poky")
# include the right directories during compilation.
set(LIBC_TARGET_OS_IS_LINUX TRUE)
set(LIBC_TARGET_OS "linux")
elseif(LIBC_TARGET_OS STREQUAL "suse")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could probably merge this with the poky case above.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@SchrodingerZhu SchrodingerZhu merged commit 720ade2 into llvm:main Jan 28, 2024
4 checks passed
@Lancern Lancern deleted the libc-suse-cmake branch January 29, 2024 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants