Closed phillipjohnston closed 2 years ago
I've got same/similar issue on Ubuntu 22.04:
[296/393] Compiling C++ object src/core/libcore.a.p/rtos_libcpp_threading.cpp.o
FAILED: src/core/libcore.a.p/rtos_libcpp_threading.cpp.o
ccache c++ -Isrc/core/libcore.a.p -Isrc/core -I../src/core -Isrc/utilities -I../src/utilities -Isrc/subsystems -I../src/subsystems -I../src/etl -I../subprojects/gsl-lite/include -Isubprojects/libcpp/include/c++ -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Wpedantic -std=c++17 -O2 -Wold-style-cast -Wnon-virtual-dtor -Wctor-dtor-privacy -Woverloaded-virtual -Wnoexcept -Wstrict-null-sentinel -Wuseless-cast -Wzero-as-null-pointer-constant -Wextra-semi -fno-rtti -fno-exceptions -fno-unwind-tables -fdiagnostics-show-option -ffunction-sections -fdata-sections -fdevirtualize -Wno-unknown-pragmas -Wno-padded -Wfloat-equal -Wconversion -Wlogical-op -Wundef -Wredundant-decls -Wshadow -Wstrict-overflow=2 -Wwrite-strings -Wpointer-arith -Wcast-qual -Wformat=2 -Wformat-truncation -Wmissing-include-dirs -Wcast-align -Wswitch-enum -Wsign-conversion -Wdisabled-optimization -Winvalid-pch -Wmissing-declarations -Wdouble-promotion -Wshadow -Wtrampolines -Wvector-operation-performance -Wshift-overflow=2 -Wnull-dereference -Wduplicated-cond -Wshift-overflow=2 -Wnull-dereference -Wduplicated-cond -Wcast-align=strict -fno-builtin -Wno-pedantic -fPIC -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DNO_ERRNO -DIFNAN_CHECK -DGDTOA_NO_ASSERT -DNO_FENV_H -nostdinc -fno-builtin -nostdinc++ -D_GNU_SOURCE -D_LIBCPP_FRAMEWORK_FORCE_PTHREAD -DDEBUG_ASSERT_NO_STDIO -Dgsl_CONFIG_DEFAULTS_VERSION=1 -Dgsl_CONFIG_NOT_NULL_EXPLICIT_CTOR=0 -isystem../subprojects/libc/printf/src -isystem../subprojects/libc/printf/src/printf -isystem../subprojects/libc/openlibm/src -isystem../subprojects/libc/openlibm/include -isystem../subprojects/libc/src/gdtoa/include -isystem../subprojects/libcpp/include/c++ -isystemsubprojects/libcpp/include/c++ -isystem../subprojects/libcpp/include/c++abi -isystemsubprojects/libcpp/include/c++abi -isystem../subprojects/libc/arch/x86_64/include -isystem../subprojects/libc/include -isystem../subprojects/etl/include -isystem../subprojects/libcpp/extensions -MD -MQ src/core/libcore.a.p/rtos_libcpp_threading.cpp.o -MF src/core/libcore.a.p/rtos_libcpp_threading.cpp.o.d -o src/core/libcore.a.p/rtos_libcpp_threading.cpp.o -c ../src/core/rtos/libcpp_threading.cpp
In file included from ../src/core/rtos/libcpp_threading.cpp:11:
subprojects/libcpp/include/c++/__external_threading:15:10: fatal error: pthread.h: No such file or directory
15 | #include <pthread.h>
| ^~~~~~~~~~~
compilation terminated.
[317/393] Compiling C++ object src/core/libcore_native.a.p/driver_internal_i2c.cpp.o
ninja: build stopped: subcommand failed.
make: *** [Makefile:55: default] Error 1
zsh: exit 2 make
Thanks @benner for the confirmation!
We are using posix_dep = dependency('threads')
, but this does not appear to be applying the -pthread
compiler argument like I expected (upon looking at compile_commands.json). So this appears to be accidentally working for me. I'll get it addressed.
edit: Looking through Meson's code, this might just be a MacOS specific case. But looking at the error messages, that flag still isn't present. Something is up.
Ok, dug into this more with a Linux VM, the real problem is elsewhere in the build architecture. There will be a libcpp change to address this, but I still need to figure out the proper approach.
https://github.com/embeddedartistry/libcpp/pull/52 will address the pthread.h failure. Now I see that the tests are segfaulting on Linux, so there is more work ahead for Linux (#7). I'll look into that on Monday.
https://github.com/embeddedartistry/libcpp/pull/52 has been merged. You will need to update the subproject dependency to pick up the changes.
Need to investigate pthread argument application in embvm-core. Failing to build on WSL. Also, side note, why isn't the no-unknown-pragma warning being applied?
Source of report: https://github.com/embvm/embvm-project-skeleton/issues/1#issuecomment-1206669274