setup-sdl icon indicating copy to clipboard operation
setup-sdl copied to clipboard

Fails to detect SDL2 library path when using CMake BundleUtilities in Mac builds

Open ccawley2011 opened this issue 7 months ago • 3 comments

BundleUtilities is used to automatically bundle shared libraries when generating packages, however it fails when building SDL2 using this action with the error can't open file: @rpath/libSDL2-2.0.0.dylib (No such file or directory).

Example build failure: https://github.com/ccawley2011/MouseMaze/actions/runs/14865298345/job/41740485473

ccawley2011 avatar May 06 '25 17:05 ccawley2011

I'm not a mac owner, so I'm probably not much of a help.

Isn't the issue you're trying to create a drag-n-drop bundle that links to SDL2 which is not part of the bundle? In other words, shouldn't you install the SDL2 library as well?

setup-sdl is a caching wrapper around cmake. It creates prefix'es are no different from cmake installs on your local systems.

madebr avatar May 06 '25 17:05 madebr

Isn't the issue you're trying to create a drag-n-drop bundle that links to SDL2 which is not part of the bundle? In other words, shouldn't you install the SDL2 library as well?

The purpose of fixup_bundle is to copy the required dylibs/frameworks into the bundle as needed. It works when using SDL2 installed via Homebrew, but not when using SDL2 built with setup-sdl.

ccawley2011 avatar May 06 '25 21:05 ccawley2011

Thanks for explaining it to me :)

So it looks like otool -l ${item} is failing: otool cannot find SDL2 based on the rpaths.

What if you add the location of SDL2 to fixup_bundle (there is a dirs argument)? Something like $<TARGET_FILE_DIR:SDL2::SDL2>

madebr avatar May 06 '25 21:05 madebr