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

Set symbol visibility to hidden by default on macOS and Linux #27384

Closed

Conversation

kduske
Copy link
Contributor

@kduske kduske commented Oct 21, 2022

Describe the pull request

  • What does your PR fix?

Fixes linker warnings when linking against libraries with inconsistent visibility settings (main project has symbols hidden, linked library has symbols visible).

  • Which triplets are supported/not supported? Have you updated the CI baseline?

    osx, linux, no

  • Does your PR follow the maintainer guide?

    Maybe -- I'll double check.

  • If you have added/updated a port: Have you run ./vcpkg x-add-version --all and committed the result?

    I am still working on this PR

@kduske
Copy link
Contributor Author

kduske commented Oct 22, 2022

@Neumann-A There are a few failures that are due to libraries not exporting symbols. I'm not sure that the list is exhaustive because I don't know what the CI tests entail. Is there a test for each library where a program links against it?

Assuming that the list is complete, we could fix these libraries by changing their ports to set symbol visibility to default explicitly -- essentially the opposite of what I did for poly2tri here.

I did see some warnings about CMP0063 not being set even though I set it in the toolchain files. I'd have to investigate why this happens.

There is one particularly nasty caveat however, and it has to do with different compilers merge typeinfo objects for multiple instances of identical types. I don't fully understand this and I'm probably using the wrong terms, but this stackoverflow question and the answers explain it quite well: https://stackoverflow.com/questions/19496643/using-clang-fvisibility-hidden-and-typeinfo-and-type-erasure

I have seen this problem in action and it can be very subtle and hard to diagnose. I worry that a lot of vcpkg users might run into this and will have to spend a lot of time diagnosing it if we just turn it on for every library. What do you think?

@FrankXie05 FrankXie05 added the category:port-bug The issue is with a library, which is something the port should already support label Oct 24, 2022
@Cheney-W
Copy link
Contributor

Cheney-W commented Nov 3, 2022

Is work still being done for this PR?

@kduske
Copy link
Contributor Author

kduske commented Nov 12, 2022

@Cheney-W Not from my side. I'm not sure if @Neumann-A wants to follow up on this, though.

@Neumann-A
Copy link
Contributor

Just close. Was worth a try ;)

@kduske kduske closed this Nov 12, 2022
@kduske kduske deleted the default-symbol-visibility-hidden branch November 12, 2022 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants