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 build doesn't set -fvisibility=hidden while Autotools does #691

Closed
diizzyy opened this issue Feb 8, 2025 · 5 comments
Closed

CMake build doesn't set -fvisibility=hidden while Autotools does #691

diizzyy opened this issue Feb 8, 2025 · 5 comments

Comments

@diizzyy
Copy link
Contributor

diizzyy commented Feb 8, 2025

I'm going to assume that it has been overlooked, CMake provides a switch for this too.
https://cmake.org/cmake/help/latest/prop_tgt/LANG_VISIBILITY_PRESET.html can be used to toggle this

Tested on FreeBSD 14.2 (amd64) with PCRE2 10.45

@NWilson
Copy link
Member

NWilson commented Feb 8, 2025

Oops! I was vaguely aware of this from when I was doing some testing previously. I was lazy. When I added the CI checks for cmake --install I intended to add some assertions with nm that the so files have the expected symbols... but forgot.

I'll add some tests and fix it.

@diizzyy
Copy link
Contributor Author

diizzyy commented Feb 9, 2025

Sounds great, thanks!

@NWilson
Copy link
Member

NWilson commented Feb 10, 2025

@diizzyy What did you observe that was a problem? The CMakeLists.txt file includes the following: set(CMAKE_C_VISIBILITY_PRESET hidden)

When I run with verbose build I can see that -fvisibility=hidden is passed on the command args to GCC, on Linux. Is this a specific FreeBSD issue with CMake?

@diizzyy
Copy link
Contributor Author

diizzyy commented Feb 10, 2025

Grr.. My build env had some unintended cruft, I re-checked and it works as intended. I apologize for the noise

@diizzyy diizzyy closed this as completed Feb 10, 2025
@NWilson
Copy link
Member

NWilson commented Feb 12, 2025

In #693 I added additional testing, to verify the contents of the .so files are as expected. This did actually discover an issue with the CMake build on Solaris, so I'm glad I did it.

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

No branches or pull requests

2 participants