acts-project / acts

Experiment-independent toolkit for (charged) particle track reconstruction in (high energy) physics experiments implemented in modern C++
https://acts.readthedocs.io
Mozilla Public License 2.0
103 stars 168 forks source link

Compiler flags seem to leak from pybind11 into our Python bindings #3770

Open andiwand opened 2 hours ago

andiwand commented 2 hours ago

I observed a couple of times that our Python bindings have extra compiler flags which are not set by us but most likely pybind11. I see for example -fvisibility=hidden in RelWithDebInfo which I cannot trace back to any of our CMake. I believe in the CI we even get -flto but could not reproduce this locally.

andiwand commented 2 hours ago

Might be related to https://github.com/acts-project/acts/pull/3768

paulgessinger commented 30 minutes ago

I think this direction is expected. The Python bindings target is created with pybinds helper functions and those set the respective properties.

The question for me is, if they spill over into other tagerts, which would be strange.

We don't link anything against the binding target (it links against some of our other libraries however), so I'm unsure how any flags could be propagated in that direction.

paulgessinger commented 27 minutes ago

pybind11's documentation says:

It sets default visibility to hidden, which is required for some pybind11 features and functionality when attempting to load multiple pybind11 modules compiled under different pybind11 versions. It also adds additional flags enabling LTO (Link Time Optimization) and strip unneeded symbols.

about the pybind11_add_module cmake function, which we use.

I'd have to check how they do this but I would assume it's just set on the Python module target.