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

MSVC CMake build fails with BUILD_SHARED_LIBS=1 #3482

Closed
ben-clayton opened this issue Jul 1, 2020 · 0 comments
Closed

MSVC CMake build fails with BUILD_SHARED_LIBS=1 #3482

ben-clayton opened this issue Jul 1, 2020 · 0 comments

Comments

@ben-clayton
Copy link
Contributor

Related to #3214 (comment), attempting to build with BUILD_SHARED_LIBS enabled, fails to link:

  FAILED: source/opt/SPIRV-Tools-opt.dll source/opt/SPIRV-Tools-opt.lib 
  cmd.exe /C "cd . && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_dll --intdir=source\opt\CMakeFiles\SPIRV-Tools-opt.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1424~1.283\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\SPIRV-Tools-opt.rsp  /out:source\opt\SPIRV-Tools-opt.dll /implib:source\opt\SPIRV-Tools-opt.lib /pdb:source\opt\SPIRV-Tools-opt.pdb /dll /version:0.0 /machine:x64 /debug /INCREMENTAL   && cd ."
  LINK Pass 1: command "C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1424~1.283\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\SPIRV-Tools-opt.rsp /out:source\opt\SPIRV-Tools-opt.dll /implib:source\opt\SPIRV-Tools-opt.lib /pdb:source\opt\SPIRV-Tools-opt.pdb /dll /version:0.0 /machine:x64 /debug /INCREMENTAL /MANIFEST /MANIFESTFILE:source\opt\CMakeFiles\SPIRV-Tools-opt.dir/intermediate.manifest source\opt\CMakeFiles\SPIRV-Tools-opt.dir/manifest.res" failed (exit code 1104) with the following output:
C:\src\SPIRV-Tools\out\build\x64-Debug\LINK : fatal error LNK1104: cannot open file 'source\SPIRV-Tools.lib'

Tested on Microsoft Visual Studio Community 2019 - Version 16.4.5, using the builtin CMake build system.

s-perron pushed a commit that referenced this issue Jul 27, 2020
Rename the `${SPIRV_TOOLS}` target to `${SPIRV_TOOLS}-static` and alias `${SPIRV_TOOLS}` to either `${SPIRV_TOOLS}-static` or `${SPIRV_TOOLS}-shared` depending on `BUILD_SHARED_LIBS`.

Re-point all internal uses of `${SPIRV_TOOLS}` to `${SPIRV_TOOLS}-static`.

`${SPIRV_TOOLS}-static` is explicitly renamed to just `${SPIRV_TOOLS}` to ensure the name does not change from current behavior.

Build the `SPIRV-Tools-*` libraries as static, as this is what they always were.

Force the external targets `gmock` and `effcee` to be built statically. These either do not support being built as shared libraries, or require special flags.

Issue: #3482
dnovillo pushed a commit to dnovillo/SPIRV-Tools that referenced this issue Aug 19, 2020
Rename the `${SPIRV_TOOLS}` target to `${SPIRV_TOOLS}-static` and alias `${SPIRV_TOOLS}` to either `${SPIRV_TOOLS}-static` or `${SPIRV_TOOLS}-shared` depending on `BUILD_SHARED_LIBS`.

Re-point all internal uses of `${SPIRV_TOOLS}` to `${SPIRV_TOOLS}-static`.

`${SPIRV_TOOLS}-static` is explicitly renamed to just `${SPIRV_TOOLS}` to ensure the name does not change from current behavior.

Build the `SPIRV-Tools-*` libraries as static, as this is what they always were.

Force the external targets `gmock` and `effcee` to be built statically. These either do not support being built as shared libraries, or require special flags.

Issue: KhronosGroup#3482
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

1 participant