Thank you so much for maturin and cargo zigbuild. They are amazing tool!
I am trying to cross-compile pyoxigraph from Linux to macOS using Maturin and Zig. Cross-compilation works perfectly targetting other Linux architectures. Pyoxigraph has some C++ dependencies.
However, when I try to cross-compile to MacOS, I get compilation errors from the libcxx version shipped with Zig. It seems that some context like the __cplusplus env variable used by libcxx are not properly setup. The same errors happen for both x86_64-apple-darwin and aarch64-apple-darwin.
What is strange is that when I call the build script zigcxx-x86_64-apple-darwin.sh manually with the same arguments as what the build script prints I get a successful compilation.
I am not sure if it is a known problem or if there is a better place to report this issue.
Example:
running: ".cache/cargo-zigbuild/0.16.9/zigcxx-x86_64-apple-darwin.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-arch" "x86_64" "-I" "rocksdb/include/" "-I" "rocksdb/" "-I" "lz4/lib/" "-Wall" "-Wextra" "-std=c++17" "-Wno-invalid-offsetof" "-msse2" "-DNDEBUG=1" "-DLZ4=1" "-DOS_MACOSX" "-DROCKSDB_PLATFORM_POSIX" "-DROCKSDB_LIB_IO_POSIX" "-DROCKSDB_SUPPORT_THREAD_LOCAL" "-DHAVE_UINT128_EXTENSION=1" "-o" "oxigraph/target/x86_64-apple-darwin/debug/build/oxrocksdb-sys-0c32ab08ef7397d8/out/rocksdb/cache/cache_helpers.o" "-c" "rocksdb/cache/cache_helpers.cc"
cargo:warning=In file included from rocksdb/cache/cache_reservation_manager.cc:9:
cargo:warning=In file included from rocksdb/cache/cache_reservation_manager.h:12:
cargo:warning=In file included from oxigraph/venv/lib/python3.11/site-packages/ziglang/lib/libcxx/include/atomic:523:
cargo:warning=In file included from oxigraph/venv/lib/python3.11/site-packages/ziglang/lib/libcxx/include/__chrono/duration.h:14:
cargo:warning=In file included from oxigraph/venv/lib/python3.11/site-packages/ziglang/lib/libcxx/include/limits:107:
cargo:warning=In file included from oxigraph/venv/lib/python3.11/site-packages/ziglang/lib/libcxx/include/type_traits:421:
cargo:warning=In file included from oxigraph/venv/lib/python3.11/site-packages/ziglang/lib/libcxx/include/__functional/invoke.h:15:
cargo:warning=In file included from oxigraph/venv/lib/python3.11/site-packages/ziglang/lib/libcxx/include/__type_traits/apply_cv.h:16:
cargo:warning=In file included from oxigraph/venv/lib/python3.11/site-packages/ziglang/lib/libcxx/include/__type_traits/remove_reference.h:13:
cargo:warning=oxigraph/venv/lib/python3.11/site-packages/ziglang/lib/libcxx/include/cstddef:50:9: error: no member named 'nullptr_t' in the global namespace
I have found what triggered the error: zig c++ does not like when both include directories and SDKROOT are set. I unset SDKROOT and compilation works properly.
Thank you so much for maturin and cargo zigbuild. They are amazing tool!
I am trying to cross-compile
pyoxigraph
from Linux to macOS using Maturin and Zig. Cross-compilation works perfectly targetting other Linux architectures. Pyoxigraph has some C++ dependencies.However, when I try to cross-compile to MacOS, I get compilation errors from the libcxx version shipped with Zig. It seems that some context like the
__cplusplus
env variable used by libcxx are not properly setup. The same errors happen for bothx86_64-apple-darwin
andaarch64-apple-darwin
.What is strange is that when I call the build script
zigcxx-x86_64-apple-darwin.sh
manually with the same arguments as what the build script prints I get a successful compilation.It seems that zig is not properly setting up some global environment when called by the
cc
crate. Here is the build script from Oxigraph for the C++ dependencies.I am not sure if it is a known problem or if there is a better place to report this issue.
Example:
Environment variables as reported by
cc
:To reproduce:
Sorry disturbing you with this bad bug report.