HomeFreeBSD

devel/wasi-libcxx: actually disable exceptions

Description

devel/wasi-libcxx: actually disable exceptions

This port was accidentially using the base system compiler for some
parts of the configure stages - which gives wrong results in the
compiler feature tests, as base clang on FreeBSD 13.0 (llvm 11) does
not know about the wasm32 target.
Worse, even with the correct compiler some of the feature tests depend
on a present and usable libc++ for the wasi target, which we don't
have yet (this port will build one, but before...).
The end result was that the build system failed to figure out the
compiler flags for disabling exceptions (-fno-exceptions in clang's
case) and built the wasm libc++ with exceptions enabled. But exceptions
are not (yet) supported in wasi-sdk, so trying to build any code against
this wasm libc++ failed with linker errors like

wasm-ld: error: /usr/local/share/wasi-sysroot/lib/wasm32-wasi/libc++.a(string.cpp.o): undefined symbol: __cxa_allocate_exception
wasm-ld: error: /usr/local/share/wasi-sysroot/lib/wasm32-wasi/libc++.a(string.cpp.o): undefined symbol: __cxa_throw

To solve that, we have to force the configure stages to use the correct
compiler by pushing CC/CXX and related variables into CONFIGURE_ENV
and specify the results of the compiler feature tests via cmake
arguments. That is a horrible workaround, but short of a full bootstrap
build, I can't see any other solution to the chicken-and-egg problem
with wasi-libcxx requiring a functional wasi-libc++ to build.

PR: 260005
Approved by: greg at unrelenting dot technology (maintainer)

(cherry picked from commit bf143897d312fc861061eeca33d4cf3e777b6728)

Details

Provenance
cmtAuthored on Nov 24 2021, 8:58 PM
Parents
R11:1f5c7bb26d76: devel/wasi-libcxx: Update to 13.0.0.
Branches
Unknown
Tags
Unknown