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][test] make DeathTestExecutors and FPExceptionHelpers hermetic #125092

Open
nickdesaulniers opened this issue Jan 30, 2025 · 2 comments
Open
Assignees

Comments

@nickdesaulniers
Copy link
Member

Towards the goal of being able to cross compile full builds, I hit a snag yesterday when cross compiling some of the unit tests. With some other smaller fixes to our cmake, I can cross compile (and run in QEMU) some unit tests, but quite a few still fail to build.

80cf21d added a TODO that implies that the LibcDeathTestExecutors and LibcFPExceptionHelpers are indeed not yet hermetic. (It then unsets LLVM_LIBC_FULL_BUILD which changes the set compiler options from _get_common_test_compile_options).

Here's an example failure:

llvm-project/libc/test/UnitTest/LibcDeathTestExecutors.cpp:15:10: fatal error: 'assert.h' file not found
   15 | #include <assert.h>
      |          ^~~~~~~~~~

I suspect we can start relying on hdr/ for these from the UnitTests.

So that needs to get fixed first, before we can cross compile the entire unit test suite.

cc @lntue


FWIW, my cmake invocation is:

$ cmake ../runtimes -GNinja -DLLVM_ENABLE_LLD=ON -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_RUNTIMES="libc" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_LIBC_FULL_BUILD=ON -DLIBC_TARGET_TRIPLE=aarch64-linux-gnu -DCMAKE_CROSSCOMPILING_EMULATOR=qemu-aarch64 -DLIBC_KERNEL_HEADERS=/tmp/sysroot/include

and my kernel headers were built via:

$ make LLVM=1 ARCH=arm64 INSTALL_HDR_PATH=/tmp/sysroot headers_install
@llvmbot
Copy link
Member

llvmbot commented Jan 30, 2025

@llvm/issue-subscribers-libc

Author: Nick Desaulniers (nickdesaulniers)

Towards the goal of being able to cross compile full builds, I hit a snag yesterday when cross compiling some of the unit tests. With some other smaller fixes to our cmake, I can cross compile (and run in QEMU) _some_ unit tests, but quite a few still fail to build.

80cf21d added a TODO that implies that the LibcDeathTestExecutors and LibcFPExceptionHelpers are indeed not yet hermetic. (It then unsets LLVM_LIBC_FULL_BUILD which changes the set compiler options from _get_common_test_compile_options).

Here's an example failure:

llvm-project/libc/test/UnitTest/LibcDeathTestExecutors.cpp:15:10: fatal error: 'assert.h' file not found
   15 | #include &lt;assert.h&gt;
      |          ^~~~~~~~~~

I suspect we can start relying on hdr/ for these from the UnitTests.

So that needs to get fixed first, before we can cross compile the entire unit test suite.

cc @lntue


FWIW, my cmake invocation is:

$ cmake ../runtimes -GNinja -DLLVM_ENABLE_LLD=ON -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_RUNTIMES="libc" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_LIBC_FULL_BUILD=ON -DLIBC_TARGET_TRIPLE=aarch64-linux-gnu -DCMAKE_CROSSCOMPILING_EMULATOR=qemu-aarch64 -DLIBC_KERNEL_HEADERS=/tmp/sysroot/include

and my kernel headers were built via:

$ make LLVM=1 ARCH=arm64 INSTALL_HDR_PATH=/tmp/sysroot headers_install

@nickdesaulniers
Copy link
Member Author

If we make a proxy hdr/ for assert, we could probably also use it from libc/src/__support/libc_assert.h.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants