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

cmake install fails on CMAKE because SDL2.so isn't symlinked correctly. #2512

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 1 comment
Closed
Assignees
Milestone

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: HG 2.1
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2017-07-25 05:38:23 +0000, wrote:

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}")")

On 2017-08-03 00:30:41 +0000, wrote:

through expiriment ${CMAKE_CURRENT_BINARY_DIR} works better than SDL2_BINARY_DIR for out-of-source builds.

On 2017-08-09 05:25:34 +0000, Ryan C. Gordon wrote:

(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.

@slouken slouken removed the bug label May 11, 2022
@slouken slouken added this to the 2.24.0 milestone May 24, 2022
@madebr
Copy link
Contributor

madebr commented May 26, 2022

This already works in current master.

Tested using the following CMakeLists.txt:

cmake_minimum_required(VERSION 3.0)
project(oot C)

add_subdirectory(/home/maarten/projects/SDL SDL)

@madebr madebr closed this as completed May 26, 2022
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

3 participants