Issue 61646
Summary libc++ targetting wasm 32: fails to build with `error: use of undeclared identifier '__ratio'`
Labels libc++, backend:WebAssembly, build-problem
Assignees
Reporter sylvestre
    Building libc++ targetting wasm32. Recently start to fail on Ubuntu Kinetic
```

In file included from /build/source/libcxx/src/mutex.cpp:11:
In file included from /build/source/build-wasm/libcxx-wasm32-wasi/include/c++/v1/mutex:192:
/build/source/build-wasm/libcxx-wasm32-wasi/include/c++/v1/__condition_variable/condition_variable.h:94:44: error: no template named 'is_floating_point'; did you mean 'std::is_floating_point'?
inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<is_floating_point<_Rep>::value, chrono::nanoseconds>
 ^~~~~~~~~~~~~~~~~
 std::is_floating_point
/build/source/build-wasm/libcxx-wasm32-wasi/include/c++/v1/__type_traits/is_floating_point.h:27:50: note: 'std::is_floating_point' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_floating_point
 ^
In file included from /build/source/libcxx/src/mutex.cpp:11:
In file included from /build/source/build-wasm/libcxx-wasm32-wasi/include/c++/v1/mutex:192:
/build/source/build-wasm/libcxx-wasm32-wasi/include/c++/v1/__condition_variable/condition_variable.h:94:76: error: use of undeclared identifier 'chrono'; did you mean 'std::chrono'?
inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<is_floating_point<_Rep>::value, chrono::nanoseconds>
 ^~~~~~
 std::chrono
[...]

/build/source/build-wasm/libcxx-wasm32-wasi/include/c++/v1/__condition_variable/condition_variable.h:99:39: error: use of undeclared identifier '__ratio'
  _Rep __result_float = __d.count() * __ratio::num / __ratio::den;
 ^
/build/source/build-wasm/libcxx-wasm32-wasi/include/c++/v1/__condition_variable/condition_variable.h:99:54: error: use of undeclared identifier '__ratio'
  _Rep __result_float = __d.count() * __ratio::num / __ratio::den;
 ^
/build/source/build-wasm/libcxx-wasm32-wasi/include/c++/v1/__condition_variable/condition_variable.h:101:23: error: no template named 'numeric_limits'; did you mean 'std::numeric_limits'?
  _Rep __result_max = numeric_limits<__ns_rep>::max();
                      ^~~~~~~~~~~~~~
 std::numeric_limits

```

Full build log:
https://llvm-jenkins.debian.net/job/llvm-toolchain-kinetic-binaries/architecture=amd64,distribution=kinetic,label=amd64/351/consoleFull

Build command:
```
cmake -B "build-wasm/libcxx-wasm32-wasi" -S runtimes \
	-G Ninja \
	 \
	-DCMAKE_C_COMPILER_WORKS=ON \
	-DCMAKE_CXX_COMPILER_WORKS=ON \
	-DLLVM_COMPILER_CHECKED=ON \
	-DCMAKE_C_COMPILER_TARGET=wasm32-unknown-wasi \
	-DCMAKE_CXX_COMPILER_TARGET=wasm32-unknown-wasi \
	-DCMAKE_ASM_COMPILER_TARGET=wasm32-unknown-wasi \
	-DCMAKE_C_COMPILER=/build/source/build-llvm/tools/clang/stage2-bins/bin/clang \
	-DCMAKE_CXX_COMPILER=/build/source/build-llvm/tools/clang/stage2-bins/bin/clang++ \
	-DCMAKE_AR=/build/source/build-llvm/tools/clang/stage2-bins/bin/llvm-ar \
	-DCMAKE_RANLIB=/build/source/build-llvm/tools/clang/stage2-bins/bin/llvm-ranlib \
	-DCMAKE_C_FLAGS="-O2 -DNDEBUG -g1 -fstack-protector-strong -Wformat -Werror=format-security -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2 -fno-stack-protector" \
	-DCMAKE_CXX_FLAGS="-O2 -DNDEBUG -g1 -fstack-protector-strong -Wformat -Werror=format-security -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2 -fno-stack-protector" \
	-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/source/build-llvm/tools/clang/stage2-bins/lib" \
	-DCMAKE_MODULE_LINKER_FLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/source/build-llvm/tools/clang/stage2-bins/lib" \
	-DCMAKE_EXE_LINKER_FLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/source/build-llvm/tools/clang/stage2-bins/lib" \
	-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-17 \
	-DCMAKE_INSTALL_INCLUDEDIR=include/wasm32-wasi \
	-DLLVM_LIBDIR_SUFFIX=/wasm32-wasi \
	-DLLVM_CONFIG=/build/source/build-llvm/tools/clang/stage2-bins/bin/llvm-config \
	-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
	-DLIBCXX_USE_COMPILER_RT=ON \
	-DLIBCXXABI_USE_COMPILER_RT=ON \
	-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
	-DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON \
	-DLIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=OFF \
	-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
	-DLIBCXX_CXX_ABI=libcxxabi \
	-DLIBCXX_ABI_VERSION=2 \
	-DLIBCXX_HAS_MUSL_LIBC:BOOL=ON \
	-DLIBCXX_ENABLE_SHARED:BOOL=OFF \
	-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY:BOOL=OFF \
	-DLIBCXX_ENABLE_EXCEPTIONS:BOOL=OFF \
	-DLIBCXX_ENABLE_FILESYSTEM:BOOL=OFF \
	-DLIBCXX_ENABLE_THREADS:BOOL=OFF \
	-DLIBCXX_HAS_PTHREAD_API:BOOL=OFF \
	-DLIBCXX_HAS_EXTERNAL_THREAD_API:BOOL=OFF \
	-DLIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY:BOOL=OFF \
	-DLIBCXXABI_ENABLE_SHARED:BOOL=OFF \
	-DLIBCXXABI_ENABLE_EXCEPTIONS:BOOL=OFF \
	-DLIBCXXABI_SILENT_TERMINATE:BOOL=ON \
	-DLIBCXXABI_ENABLE_THREADS:BOOL=OFF \
	-DLIBCXXABI_HAS_PTHREAD_API:BOOL=OFF \
	-DLIBCXXABI_HAS_EXTERNAL_THREAD_API:BOOL=OFF \
	-DLIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY:BOOL=OFF


```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to