-
Notifications
You must be signed in to change notification settings - Fork 223
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
Linking fails if SPIRV-Tools is installed separately and found as a cmake package #2358
Comments
Thanks for the report. Until last year, this project's cmake configuration wasn't even considering |
Hi @svenvh, thanks for the quick response. While the fix proposed #2370 seems reasonable for the Ubuntu system package, there might be a misunderstanding in what my configuration was when I encountered the problem. I wasn't actually using the Ubuntu 22.04 system package for SPIRV-Tools. I was compiling everything from source, including LLVM.
Now I'm using a standard Ubuntu 22.04 system config (inside a Docker container) to build these packages. First, I build and install LLVM. Then, I build and install SPIRV-Tools via And in this case, the fix in #2370 doesn't help, because I do get the |
The unresolved symbols are part of the SPIRV-Tools C++ API. What seems odd to me is that those don't have any symbol visibility markings (unlike the C API in |
I can confirm that this single-line change to
So either SPIRV-Tools doesn't consider the C++ stuff part of the public API (which doesn't really make sense) or someone forgot to configure the correct symbol visibility for the C++ header (which sounds more likely). So we consider this to be a bug in SPIRV-Tools? Do you want to create an issue with them? |
Thanks for confirming the fix! I have created KhronosGroup/SPIRV-Tools#5591 to fix this in SPIRV-Tools. |
The SPIRV-Tools fix has just been merged, so closing this; but please reopen if you are still seeing issues. |
Linking fails if SPIRV-Tools is compiled first, installed, and found as a cmake package by SPIRV-LLVM-Translator.
I build both SPIRV-LLVM-Translator and SPIRV-Tools within a standard Ubuntu 22.04 environment.
The used versions are:
If I build and install SPIRV-Tools first, and try to build SPIRV-LLVM-Translator next, cmake will successfully find the SPIRV-Tools cmake package and set up include paths and linker flags appropriately. But the final link step will fail:
After some investigation, I think this is because SPIRV-LLVM-Translator tries linking against
SPIRV-Tools-shared
, which has default-hidden symbol visibility, but SPIRV-LLVM-Translator references symbols that are regarded as private. Hence, linking fails.From my current understanding, only the symbols marked as
SPIRV_TOOLS_EXPORT
in https://github.com/KhronosGroup/SPIRV-Tools/blob/main/include/spirv-tools/libspirv.h are accessible when linking againstSPIRV-Tools-shared
, hence the current usage here seems wrong (and it should beSPIRV-Tools-static
instead).If I change the cmake config to link against
SPIRV-Tools-static
instead (which has full public symbol visibility), linking succeeds.See also KhronosGroup/SPIRV-Tools#3909 and https://github.com/KhronosGroup/SPIRV-Tools/blob/b7413609cf2d5adccc877d71a1d67ec43bea07c0/CMakeLists.txt#L162.
The text was updated successfully, but these errors were encountered: