We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3713 - cmake install fails on CMAKE because SDL2.so isn't symlinked correctly.
Summary: cmake install fails on CMAKE because SDL2.so isn't symlinked correctly.
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.6
Depends on:
Blocks:
 
Reported: 2017-07-25 05:38 UTC by kdavison
Modified: 2017-08-09 05:25 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kdavison 2017-07-25 05:38:23 UTC
Overiew:
When performing an out-of-source CMAKE build the symlink libSDL2.* is not created correctly and as a consequence 'make install' fails.

Steps
1. build SDL using CMAKE with an out-of-source build
   Example structure:
   - artifact
   - build.tmp
   - CMakeLists.txt (contains add_subdirectory(SDL2))
   + SDL2
     - sdl stuff

2. from build.tmp:
   cmake -DCMAKE_INSTALL_PREFIX=../artifact ../

3. make install

Expected Result:
SDL2 installs libraries + source includes

Actual Result:
  CMake Error at SDL2/cmake_install.cmake:155 (file):
    file INSTALL cannot find
    "build.tmp/SDL2/libSDL2.so".
  Call Stack (most recent call first):
    cmake_install.cmake:39 (include)
which is because libSDL2.so was created in ${CMAKE_BINARY_DIR} instead of ${CMAKE_BINARY_CURRENT_DIR}.
Additionally libSDL2.so is linked a to file that doesn't exist, because the path is incorrect.

Other Information:
SDL Version 2.0.5.1.5 on Ubuntu 16.04 with CMAKE

Proposed Fix: (works on my local system)
in CMakeLists.txt:1675
replace
    install(CODE "
      execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
      \"libSDL2-2.0.${SOEXT}\" \"libSDL2.${SOEXT}\")")
with
    install(CODE "
      execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
      \"${SDL2_BINARY_DIR}/libSDL2-2.0.${SOEXT}\" \"${SDL2_BINARY_DIR}/libSDL2.${SOEXT}\")")
Comment 1 kdavison 2017-08-03 00:30:41 UTC
through expiriment ${CMAKE_CURRENT_BINARY_DIR} works better than SDL2_BINARY_DIR for out-of-source builds.
Comment 2 Ryan C. Gordon 2017-08-09 05:25:34 UTC
(Sorry if you get a lot of copies of this email, we're touching dozens of bug reports right now.)

Tagging a bunch of bugs as target-2.0.6.

This means we're in the final stretch for an official SDL 2.0.6 release! These are the bugs we really want to fix before shipping if humanly possible.

That being said, we don't promise to fix them because of this tag, we just want to make sure we don't forget to deal with them before we bless a final 2.0.6 release, and generally be organized about what we're aiming to ship. After some debate, we might just remove this tag again and deal with it for a later release.

Hopefully you'll hear more about this bug soon. If you have more information (including "this got fixed at some point, nevermind"), we would love to have you come add more information to the bug report when you have a moment.

Thanks!
--ryan.