Skip to content

Conversation

@uyoyo0
Copy link

@uyoyo0 uyoyo0 commented Sep 29, 2025

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.

@NobodyXu
Copy link
Contributor

Hmm does enabling Build::cpp not working?

@uyoyo0
Copy link
Author

uyoyo0 commented Sep 29, 2025

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.

@NobodyXu
Copy link
Contributor

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

@uyoyo0
Copy link
Author

uyoyo0 commented Oct 7, 2025

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

@NobodyXu
Copy link
Contributor

NobodyXu commented Oct 8, 2025

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?

Copy link
Contributor

@madsmtm madsmtm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to think it's fine to add this, AIX is kind of a weird target (with a whole other set of C compilers), not surpised that it requires something like this.

But I guess we could ping powerpc64-ibm-aix target maintainers and see what they think?
@daltenty @gilamn5tr @amy-kwan

Btw @uyoyo0, what compiler are you using? Is this only a problem when using XL, or is it needed when using Clang too?

}
}
// On aix we must also link libc++abi when using libc++
if self.get_target()?.os == "aix" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
if self.get_target()?.os == "aix" {
if target.os == "aix" {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants