Author Topic: Solarus XD fails to execute on Mac OS X: dyld: Library not loaded: /usr/local/li  (Read 3208 times)


  • Newbie
  • *
  • Posts: 1
    • View Profile
$ /Users/rousseau/Downloads/Solarus\
dyld: Library not loaded: /usr/local/lib/libluajit-5.1.2.dylib
  Referenced from: /Users/rousseau/Downloads/Solarus
  Reason: image not found
Trace/BPT trap: 5

The libluajit-5.1.2.dylib is not present in /usr/local/lib but in Contents/Frameworks/libluajit-

I guess the error is at the compilation or link level because I have:
$ otool -L Solarus\
   @rpath/SDL2.framework/Versions/A/SDL2 (compatibility version 1.0.0, current version 3.1.0)
   /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 20.0.0)
   @rpath/SDL2_image.framework/Versions/A/SDL2_image (compatibility version 1.0.0, current version 1.0.0)
   @rpath/SDL2_ttf.framework/Versions/A/SDL2_ttf (compatibility version 11.0.0, current version 11.2.0)
   /System/Library/Frameworks/OpenAL.framework/Versions/A/OpenAL (compatibility version 1.0.0, current version 1.0.0)
   /usr/local/lib/libluajit-5.1.2.dylib (compatibility version 2.0.0, current version 2.0.2)
   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
   @rpath/libphysfs.1.dylib (compatibility version 1.0.0, current version 2.0.3)
   @rpath/Vorbis.framework/Versions/A/Vorbis (compatibility version 1.0.0, current version 1.0.0)
   @rpath/Ogg.framework/Versions/A/Ogg (compatibility version 1.0.0, current version 1.0.0)
   @rpath/libmodplug.1.dylib (compatibility version 2.0.0, current version 2.0.0)
   /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0)
   /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
   /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1056.13.0)

libphysfs.1.dylib is also in Contents/Frameworks/libphysfs.1.dylib and is referenced as @rpath/libphysfs.1.dylib in the binary. But libluajit-5.1.2.dylib is referenced with a complete path in /usr/local/lib/.

I can execute the game if I create a symbolic link from /usr/local/lib/libluajit-5.1.2.dylib to [...]/Contents/Frameworks/libluajit-


  • Newbie
  • *
  • Posts: 20
    • View Profile
It's my fault, I forgot to change this path when we recently switched from lua to luajit.

In case, if you want to properly fix this before the offical correction, you can change the "id" of the dylib with
$ install_name_tool -id @rpath/libluajit- libluajit-

At this point, if you did this on the system library (the one in /usr/local/lib), the dependency path of luajit will be automatically copied from this id when compiling Solarus, but since it is not your case, you also have to change the path directly on the Solarus binary with

$ install_name_tool -change /usr/local/lib/libluajit-5.1.2.dylib @rpath/libluajit- Solarus

@rpath represent a "special path" that will search first in @executable_path/../Frameworks, then into /Library/Framework if the library is not found, and then some others if I remember correctly.

Hope this helps :)
« Last Edit: July 22, 2014, 02:04:41 am by vlag »