Skip to content

Commit d1a461d

Browse files
authored
[libc++] tests with picolibc: prevent looking for unneeded "rt" library (llvm#82262)
Picolibc does not provide the clock_gettime function nor the "rt" library. check_library_exists was invalidly detecting the "rt" library due to cmake issue present, when cross-compiling[1]. This resulted with "chrono.cpp" trying to link to the "rt" library and following error: unable to find library from dependent library specifier: rt [1] https://gitlab.kitware.com/cmake/cmake/-/issues/18121
1 parent 6ee9c8a commit d1a461d

File tree

7 files changed

+7
-18
lines changed

7 files changed

+7
-18
lines changed

libcxx/cmake/config-ix.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include(CMakePushCheckState)
22
include(CheckLibraryExists)
3+
include(CheckSymbolExists)
34
include(LLVMCheckCompilerLinkerFlag)
45
include(CheckCCompilerFlag)
56
include(CheckCXXCompilerFlag)
@@ -97,6 +98,8 @@ int main(void) { return 0; }
9798
cmake_pop_check_state()
9899
endif()
99100

101+
check_symbol_exists(__PICOLIBC__ "string.h" PICOLIBC)
102+
100103
# Check libraries
101104
if(WIN32 AND NOT MINGW)
102105
# TODO(compnerd) do we want to support an emulation layer that allows for the
@@ -116,6 +119,10 @@ elseif(ANDROID)
116119
set(LIBCXX_HAS_PTHREAD_LIB NO)
117120
set(LIBCXX_HAS_RT_LIB NO)
118121
set(LIBCXX_HAS_ATOMIC_LIB NO)
122+
elseif(PICOLIBC)
123+
set(LIBCXX_HAS_PTHREAD_LIB NO)
124+
set(LIBCXX_HAS_RT_LIB NO)
125+
set(LIBCXX_HAS_ATOMIC_LIB NO)
119126
else()
120127
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
121128
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)

libcxx/test/std/time/time.clock/time.clock.file/to_from_sys.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010

1111
// UNSUPPORTED: availability-filesystem-missing
1212

13-
// "unable to find library from dependent library specifier: rt"
14-
// XFAIL: LIBCXX-PICOLIBC-FIXME
15-
1613
// <chrono>
1714
//
1815
// file_clock

libcxx/test/std/time/time.clock/time.clock.hires/now.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// "unable to find library from dependent library specifier: rt"
10-
// XFAIL: LIBCXX-PICOLIBC-FIXME
11-
129
// <chrono>
1310

1411
// high_resolution_clock

libcxx/test/std/time/time.clock/time.clock.system/from_time_t.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// "unable to find library from dependent library specifier: rt"
10-
// XFAIL: LIBCXX-PICOLIBC-FIXME
11-
129
// <chrono>
1310

1411
// system_clock

libcxx/test/std/time/time.clock/time.clock.system/now.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// "unable to find library from dependent library specifier: rt"
10-
// XFAIL: LIBCXX-PICOLIBC-FIXME
11-
129
// <chrono>
1310

1411
// system_clock

libcxx/test/std/time/time.clock/time.clock.system/to_time_t.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// "unable to find library from dependent library specifier: rt"
10-
// XFAIL: LIBCXX-PICOLIBC-FIXME
11-
129
// <chrono>
1310

1411
// system_clock

libcxx/test/std/time/time.point/time.point.nonmember/op_-duration.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// "unable to find library from dependent library specifier: rt"
10-
// XFAIL: LIBCXX-PICOLIBC-FIXME
11-
129
// <chrono>
1310

1411
// time_point

0 commit comments

Comments
 (0)