-
Notifications
You must be signed in to change notification settings - Fork 117
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
MinGW ld.lld: error: too many exported symbols #312
Comments
Is there any way to attach to this thread, a list of the generated symbols? The only way to diagnose this is to discover where the excess symbols come from. It's most likely due to unintentional symbol visibility, such as in-between templates in pybind11 being exported even though they are not intended as API. It must be specific to the build scenario, because the 64k symbol limit is a windows thing, so there must be a difference between the exported symbols resulting from msvc and clang under mingw. I'm also not in a set up to check this, unfortunately. |
I'll try to look into it when I find some more time.
It looks like it's only clang, the gcc build is also fine. |
Poking around, this looks suspect: Imath/src/python/PyImath/PyImathExport.h Line 15 in 7355971
Changing that, however to |
OTOH, defining |
Looking at the CMake related options of the whole |
the python bindings don't need exhaustive symbol exporting, only enough that the modules can be dloaded by python itself. that patch you found (https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-imath/0002-fix-openexr-clang-build.patch) probably needs to be applied here. And if there's more you discovered, then those as well. Can you list the others that come up? (perhaps as an attached text file if it's too huge to post in a message?) |
That's the only one I know, apparently OpenEXR doesn't build w/ Clang without it. |
Makes sense. These flags in combination with the visibility hidden attribute should lead to the same behavior as using dllexport in a file when compiling on Windows. By default on Windows all symbols are exported, the exception being when dllexport is found in a file, which means that only that which is declared with dllexport is exported. By setting the platform_visibility_available definition, it uses visibility("default") instead, which does not trigger the same behavior; you need the visibility=hidden compile flag to restrict exports to those where it's declared. One possible fix I'm working on based off of #324 is to see if it causes issues to simply remove the declarations from locations where it's problematic, and assume compilation with the |
This is from building 3.1.7 in CLANG64 environment (Clang 16.0.1 currently):
The text was updated successfully, but these errors were encountered: