question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make setup_pybind11 include -fvisibility=hidden in extra_compile_args

See original GitHub issue

Without that flag, one gets warnings per https://pybind11.readthedocs.io/en/stable/faq.html#someclass-declared-with-greater-visibility-than-the-type-of-its-field-someclass-member-wattributes.

It’s probably just a matter of adding it after -std=c++11 in https://github.com/tbenthompson/cppimport/blob/a2f85f355897badc1a94042802da916820e0657e/cppimport/templating.py#L25 (but before + cfg['compiler_args'] to allow a user to overwrite that if they really, really want to).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tbenthompsoncommented, Feb 8, 2019

Yeah. I noticed and fixed it, but you caught it in the 90 seconds in between commit 1 and 2… You’re super on top of things!

0reactions
anntzercommented, Feb 8, 2019

Uh, I think you got the commit wrong: you added -fvsisibility=default to setup_pybind11, but I was suggesting to add -fvisibility=hidden to setup_pybind11 and then in your project which does need default visibility, add -fvisibility=default.

Read more comments on GitHub >

github_iconTop Results From Across the Web

C++ -fvisibility=hidden -fvisibility-inlines-hidden - Stack Overflow
-fvisibility=hidden makes all your symbols hidden by default. What you then have to do, is choose which functions you want to be visible...
Read more >
Visibility - GCC Wiki
Put simply, it hides most of the ELF symbols which would have previously (and unnecessarily) been public. This means: It very substantially ...
Read more >
Simple C++ Symbol Visibility Demo - LabJack
This post gives a demonstration/test of the dangers of using default visibility for symbols in C++ shared libraries.
Read more >
Visibility in shared objects - IBM
Functions with hidden visibility have a local scope and cannot be called from ... ALL is used to make all functions visible by...
Read more >
169017 – backtrace() does not resolve symbols when ...
c -Wl,--export-dynamic */ /* Fails: cc -o backtrace backtrace.c -fvisibility=hidden -Wl,--export-dynamic */ #include <stdio.h> #include <unistd.h> #include < ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found