Skip to content

Commit 2f28378

Browse files
authored
[libc] Fix builds on Windows (#102162)
This PR changes several places in the CMake scripts to make libc build on Windows. It adds the `errno` entrypoint to the Windows target. A mistake in the overlay build doc is also fixed. Tests still cannot be built on Windows because of the lack of osutils.
1 parent b9183d0 commit 2f28378

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

libc/cmake/modules/LLVMLibCTestRules.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ function(add_libc_fuzzer target_name)
348348
endfunction(add_libc_fuzzer)
349349

350350
# Get libgcc_s to be used in hermetic and integration tests.
351-
if(NOT LIBC_CC_SUPPORTS_NOSTDLIBPP)
351+
if(NOT MSVC AND NOT LIBC_CC_SUPPORTS_NOSTDLIBPP)
352352
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=libgcc_s.so.1
353353
OUTPUT_VARIABLE LIBGCC_S_LOCATION)
354354
string(STRIP ${LIBGCC_S_LOCATION} LIBGCC_S_LOCATION)

libc/config/windows/entrypoints.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ set(TARGET_LIBC_ENTRYPOINTS
9292
libc.src.stdlib.realloc
9393
libc.src.stdlib.aligned_alloc
9494
libc.src.stdlib.free
95+
96+
# errno.h entrypoints
97+
libc.src.errno.errno
9598
)
9699

97100
set(TARGET_LIBM_ENTRYPOINTS

libc/docs/overlay_mode.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ the CMake configure step as follows:
3939
$> cd llvm-project # The llvm-project checkout
4040
$> mkdir build
4141
$> cd build
42-
$> cmake ../llvm -G Ninja -DLLVM_ENABLE_PROJECTS="libc" \
42+
$> cmake ../llvm -G Ninja -DLLVM_ENABLE_RUNTIMES="libc" \
4343
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
4444
-DCMAKE_BUILD_TYPE=<Debug|Release> \ # Select build type
4545
-DCMAKE_INSTALL_PREFIX=<Your prefix of choice> # Optional

0 commit comments

Comments
 (0)