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 doesn't correctly install libSDL2.dylib Mac OS #2956

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

CMake doesn't correctly install libSDL2.dylib Mac OS #2956

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.1
Reported for operating system, platform: Mac OS X (All), x86_64

Comments on the original bug report:

On 2018-08-18 21:47:30 +0000, Drew Pirrone-Brusse wrote:

Created attachment 3285
A patch that resolves this issue.

When running cmake --build . --target install, libSDL2.dylib is not correctly installed on Mac OS.

A patch has been included that fixes this issues.

Repro Steps

  1. Set up next-to-source build and install directories,
    mkdir build install; cd build
  2. Configure CMake (installing to a dummy directory),
    cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=../install
  3. Build, but don't install,
    cmake --build .
  4. Note a .dylib that has been built,
    ls -l libSDL2.dylib
    -rwxr-xr-x  1 drew  staff   1.4M Aug 18 13:37 libSDL2.dylib*
    
  5. Install,
    cmake --build . --target install
  6. Take a second look at that .dylib,
    ls -l libSDL2.dylib
    lrwxr-xr-x  1 drew  staff    17B Aug 18 13:39 libSDL2.dylib@ -> libSDL2-2.0.dylib
    

Notes

The root issue are the target properties set on the SDL2 target for the APPLE environment. MACOSX_RPATH 1 is the only property set, and without VERSION, SOVERSION, or OUTPUT_NAME, the -2.0 suffix isn't added to the generated dylib.

This patch file also modifies the proceeding create_symlink call that expects to target the generated .dylib in a couple ways;

  1. Use CMake's CMAKE_SHARED_LIBRARY_SUFFIX constant to choose between .so, .dylib, etc., rather than guessing based on platform.
  2. The SDL target's OUTPUT_NAME is used in place of a hard-coded string. This doesn't immediately affect anything, but should the target's output name change in the future, the create_symlink call won't need to be updated.
  3. Add the SOPOSTFIX ("d" for debug builds, "" for everything else) to the symlink's name to keep the symlink for debug builds distinct from the symlink for release builds.

This is a possible duplicate of or corollary to 3713.

On 2018-09-23 23:39:54 +0000, Drew Pirrone-Brusse wrote:

Created attachment 3309
The same patch as previously, built from release-2.0.8

The first patch I posted was cut from what was then master. I had cause to re-build the patch off of release-2.0.8, and decided that might be worth recording here.

On 2018-09-24 15:45:22 +0000, Sam Lantinga wrote:

Patch added, thanks!
https://hg.libsdl.org/SDL/rev/c0b17b32b95e

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