Skip to content

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

Merged
bluescarni merged 1 commit intoesa:masterfrom
jschueller:quiet
Sep 27, 2024
Merged

CMake: Find dependencies in QUIET mode from pagmo-config#583
bluescarni merged 1 commit intoesa:masterfrom
jschueller:quiet

Conversation

@jschueller
Copy link
Copy Markdown
Contributor

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

@bluescarni
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

@jschueller
Copy link
Copy Markdown
Contributor Author

done

@bluescarni
Copy link
Copy Markdown
Member

Cheers!

@bluescarni bluescarni merged commit 9519d7a into esa:master Sep 27, 2024
@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