cc-rs icon indicating copy to clipboard operation
cc-rs copied to clipboard

Add missing C++ ABI linker flag for AIX

Open uyoyo0 opened this issue 3 months ago • 5 comments

This PR resolves a linking failure when building C++ code on AIX. For example, when working with a downstream crate like cxx, cargo test fails during the linking stage with the following error:

ld: 0711-317 ERROR: Undefined symbol: __xlcxx_personality_v1

The current implementation links against libc++ but we additionally need it to link against libc++abi which is what this patch does.

uyoyo0 avatar Sep 29 '25 13:09 uyoyo0

Hmm does enabling Build::cpp not working?

NobodyXu avatar Sep 29 '25 14:09 NobodyXu

Hmm does enabling Build::cpp not working?

It correctly identifies libc++ but the issue is that it fails to identify and link libc++abi which contains symbols for things such as exception handling.

uyoyo0 avatar Sep 29 '25 14:09 uyoyo0

It correctly identifies libc++ but the issue is that it fails to identify and link libc++abi which contains symbols for things such as exception handling.

That's strange, based on my experience of using c++ with gcc/clang, using the c++ compiler automatically link in stdc++ and other stuff required, including exception handling.

cc @madsmtm wdyt

NobodyXu avatar Sep 30 '25 08:09 NobodyXu

Hi @NobodyXu @madsmtm, just a friendly ping to see if you've had the chance to look further into this.

uyoyo0 avatar Oct 07 '25 15:10 uyoyo0

Still not sure if aix needs cxxabi, because usually linking with libstdc++ or libcxx is suffice

https://stackoverflow.com/questions/20357033/usr-lib-x86-64-linux-gnu-libstdc-so-6-version-cxxabi-1-3-8-not-found

Maybe you didn't add cxxabi to LD_LIBRARY_PATH or it's not in the path where the dynamic linkr can find?

NobodyXu avatar Oct 08 '25 08:10 NobodyXu