rust-cross / cargo-zigbuild

Compile Cargo project with zig as linker
MIT License
1.45k stars 52 forks source link

How to get _GLIBCXX_USE_CXX11_ABI to 1 ? #263

Closed blackrez closed 1 month ago

blackrez commented 1 month ago

Hello,

I'm using cargo lambda to build aws lambda function with rust. The cross compilation with cargo zig works very nicely, I have one little issue. When I build duckdb-rs, the compilation works. For some context, duckdb is a memory database and it use an extension system that acts like dynamic librairies.

At the execution, duckdb detects that I use an old glibc but this is not the case (I use Amazon linux 2023)

In the duckdb code, they use this code to detect old glibc

#if !defined(_GLIBCXX_USE_CXX11_ABI) || _GLIBCXX_USE_CXX11_ABI == 0
    if (os == "linux") {
        postfix = "_gcc4";
    }
#endif

How I can get _GLIBCXX_USE_CXX11_ABI defined or equals to 1 (or find a better system to detect gilbc version) with cargo zig ?

note : without cross compilation it detects correctly the glib version.

Thanks for your help