Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Find dependencies in QUIET mode from pagmo-config #583

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

jschueller
Copy link
Contributor

only when pagmo is used as a client library, not when configuring pagmo itself

@bluescarni
Copy link
Member

@jschueller thanks for the PR, LGTM.

Regarding the clang>=17 issues on OSX, this seems hairy and I will try to explain to the best of my understanding what is going on.

The issue is a std::bad_cast exception being thrown during (de)serialisation of problems/algorithms/etc. In pagmo, we employ the boost::serialization library, which we use to (de)serialize derived classes via pointers to their bases. For this to work, RTTI is used, and boost::serialization needs to register a caster between base and derived classes in some internal global state, and to perform std::dynamic_casts at runtime.

This has been working great for years in pagmo, but somehow, for reasons I cannot understand, it has stopped working since the clang 17 upgrade. I have run in the same issue in another project of mine, where I also have started pinning clang on osx:

https://github.com/conda-forge/heyoka.py-feedstock/blob/main/recipe/conda_build_config.yaml

According to my testing in this other project, the issue arises only on x86_64, apparently osx_arm64 is fine.

It looks like this is a quite difficult issue to debug and pin down. Perhaps someone with deep toolchain knowledge (pinging @isuruf and @h-vetinari ) could chime in...

@bluescarni
Copy link
Member

bluescarni commented Sep 26, 2024

Ok maybe not so difficult to diagnose after all. See:

https://releases.llvm.org/17.0.1/tools/clang/docs/ReleaseNotes.html#c-language-changes

Improved code generation for dynamic_cast to a final type. Instead of dispatching to the runtime library to compare the RTTI data, Clang now generates a direct comparison of the vtable pointer in cases where the ABI requires the vtable for a class to be unique. This optimization can be disabled with -fno-assume-unique-vtables. This optimization is not yet implemented for the MS C++ ABI.

And:

llvm/llvm-project#71196

I will try the suggested workaround...

@bluescarni
Copy link
Member

@jschueller would you like to rebase/merge master back into this PR so I can merge this?

@jschueller
Copy link
Contributor Author

done

@bluescarni
Copy link
Member

Cheers!

@bluescarni bluescarni merged commit 9519d7a into esa:master Sep 27, 2024
8 checks passed
@jschueller jschueller deleted the quiet branch September 27, 2024 12:01
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.

2 participants