Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: On OSX and SFML 2.2, either statically link or bundle Framework inside .app ?  (Read 2153 times)

0 Members and 1 Guest are viewing this topic.

jakov

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
I have tried, for weeks now, to compile and link SFML on OSX, on my little game.

It now compiles and links, but when I run the program, it will not start unless the SFML Framework is installed in the system libraries on the Mac.

I have tried changing all sorts of settings in Xcode, I have tried macdylibbundler, otool etc.

Anything to make the app look for the SFML inside the .app directory.


To no avail.

It is always something with the @rpath. I found on some forum for another game that SFML changed from @executable_path to @rpath from version 2.1 to 2.2 or something, could that be related.

Is there some recommended way to make an SFML app on OSX look for SFML inside the .app directory instead of in system libraries? Or, some way to build SFML statically. Building statically, although frowned upon for some reason, always solves everything... :)




Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Have you tried the official templates for Xcode?
SFML / OS X developer

jakov

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
That was the one I started out with and tweaked to get where I am.

But very good point, I will start over with the official plain vanilla template once more and then come back here with my finding.

Does this generally work for you?  I mean starting an SFML 2.2 (or 2.3, I upgraded to that yesterday) app on an OSX computer where SFML is not installed in the system libraries.

On a side note I am really attached to SFML, currently we have almost the exact same code for OSX, Linux and Windows. (Hoping to support iOS too once I get OSX working fully.)


« Last Edit: May 22, 2015, 12:14:15 pm by jakov »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Those templates work fine. If they don't, then I need to fix them -- but I'm currently not aware of any issues so you should be safe.

Regarding 2.3, make sure to fix the installation: http://en.sfml-dev.org/forums/index.php?topic=18126.msg130379#msg130379
SFML / OS X developer

jakov

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Thank you so much. Will try when I have the chance.

jakov

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
So, I installed SFML 2.3 and the prereqs, like FLAC etc. Then I patched it as instructed. Created a new vanilla SFML from the template.

And lo and behold, it actually worked on plain Mac without SFML installed.

So, I have some homework to do obviously. Thanks for pointing me in the right direction. I will come back here if I totally get stuck in the "real" app I am trying to make, but on the whole we can consider this issue closed.

jakov

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Yes, confirmed! It works with SFML 2.3, after patching of course.

All I had to then was to copy missing extlibs into .app/Contents/Frameworks/ and it runs on any vanilla Mac without SFML installed in sys libs or frameworks.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Fantastic!  :)
SFML / OS X developer