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

Author Topic: SFML 2.0 - Issue distributing builds to any other Macs  (Read 4717 times)

0 Members and 1 Guest are viewing this topic.

PixelMuffin

  • Newbie
  • *
  • Posts: 18
    • View Profile
SFML 2.0 - Issue distributing builds to any other Macs
« on: July 13, 2012, 09:08:29 am »
Hi. I have seen a few other threads about this around but not for the latest version of Xcode (4.3.3) and the latest version of Mac OSX 10.7.4. I am using the RC 2.0 build on the SFML website. I can get it to build fine but when it comes time to send it to anyone else, I get something like this:



Now, the other threads I have found, like http://en.sfml-dev.org/forums/index.php?topic=7196.0, deal with different versions of Xcode and MacOSX. The person I am sending the build to is using the exact same version of OSX I am using.

So, taking apart the error, I can see the he doesn't have the library. I have tried creating projects with the frameworks option check and unchecked with no luck.

My other idea was to build SFML whereas I had simply installed it and used a template. But I am not sure what kind of difference that will make seeing as how it works great on this version of my OS.

For some reason, the library isn't being linked. Maybe I am being an idiot and forgot to check an option but I have looked in the .app bundle of my application and see all of the Frameworks included. I am at a loss here.

I tried to do my research before posting and genuinely was unable to find an answer so I hope this hasn't been answered exactly before.

Thank you for your time and again, you guys do fantastic work.

Cheers!

Acrobat

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: SFML 2.0 - Issue distributing builds to any other Macs
« Reply #1 on: July 13, 2012, 09:35:40 am »
add build phase to copy dylib's into your application

PixelMuffin

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: SFML 2.0 - Issue distributing builds to any other Macs
« Reply #2 on: July 13, 2012, 09:52:15 am »
add build phase to copy dylib's into your application

Thank you for the reply! I am new to Xcode and am unfamiliar how to do this. I found the build phases. I assume what you're referring to is link binary with libraries. Or is it Target Dependencies? Which ones do I include?

Under the Mac OS X 10.7 dropdown, I see a number of .dylibs as well as the SFML.framework. I assume I just include the .dylibs. I have 3 kinds of each, for example:

libsfml-audio.dylib
libsfml-audio.2.dylib
libsfml-audio.2.0.dylib

Which of those naming formats do I want?

Thanks! :D
« Last Edit: July 13, 2012, 10:07:12 am by PixelMuffin »

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: SFML 2.0 - Issue distributing builds to any other Macs
« Reply #3 on: July 13, 2012, 10:09:42 am »
For some reason, the library isn't being linked. Maybe I am being an idiot and forgot to check an option but I have looked in the .app bundle of my application and see all of the Frameworks included. I am at a loss here.
Looks like the frameworks are being copied in your app by a build phase, but you're linking your app against the dylibs, not the frameworks. You can either link your app against the framework or change the build phase so that it copies the dylibs instead of the frameworks.
Want to play movies in your SFML application? Check out sfeMovie!

PixelMuffin

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: SFML 2.0 - Issue distributing builds to any other Macs
« Reply #4 on: July 13, 2012, 10:17:24 am »
Ceylo, I would like to link against the dylibs and when I go into build phases and go to link binary with libraries, I see them but i see three version of them. The audio one looks like:

libsfml-audio.dylib
libsfml-audio.2.dylib
libsfml-audio.2.0.dylib

Which of those do I want?

Thanks :D

Acrobat

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: SFML 2.0 - Issue distributing builds to any other Macs
« Reply #5 on: July 13, 2012, 10:31:31 am »
not sure, try all of them

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: SFML 2.0 - Issue distributing builds to any other Macs
« Reply #6 on: July 13, 2012, 10:43:24 am »
libsfml-audio.2.0.dylib is a symbolic link to libsfml-audio.2.dylib which is a symbolic link to libsfml-audio.dylib. Thus the best would be to copy all of them while preserving the links.

In your report it's written :
Dyld Error Message:
    Library not loaded: @executable_path/../Frameworks/libsfml-system.2.dylib
    Referenced from: ...

Thus actually it's looking for the file with ".2".
The "Link Binary With Libraries" build phase just tells Xcode which libraries are to be linked against your app. It won't copy anything.

To copy files, you must have a "Copy Files" build phase. Create one if it doesn't exist (but I doubt it). Select "Frameworks" as Destination and add the dylibs to the list of files that are to be copied.
Want to play movies in your SFML application? Check out sfeMovie!

PixelMuffin

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: SFML 2.0 - Issue distributing builds to any other Macs
« Reply #7 on: July 13, 2012, 10:47:23 am »
libsfml-audio.2.0.dylib is a symbolic link to libsfml-audio.2.dylib which is a symbolic link to libsfml-audio.dylib. Thus the best would be to copy all of them while preserving the links.

In your report it's written :
Dyld Error Message:
    Library not loaded: @executable_path/../Frameworks/libsfml-system.2.dylib
    Referenced from: ...

Thus actually it's looking for the file with ".2".
The "Link Binary With Libraries" build phase just tells Xcode which libraries are to be linked against your app. It won't copy anything.

To copy files, you must have a "Copy Files" build phase. Create one if it doesn't exist (but I doubt it). Select "Frameworks" as Destination and add the dylibs to the list of files that are to be copied.

Fantastic. New to Xcode so your help has been invaluable. I will ship my .app out in the morning for testing and get a response tomorrow. In the meantime, thank you very much!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 - Issue distributing builds to any other Macs
« Reply #8 on: July 13, 2012, 10:48:14 am »
Quote
libsfml-audio.2.0.dylib is a symbolic link to libsfml-audio.2.dylib which is a symbolic link to libsfml-audio.dylib.
Actually it is the other way round:
- libsfml-audio.dylib is a symbolic link to libsfml-audio.2.dylib
- libsfml-audio.2.dylib is a symbolic link to libsfml-audio.2.0.dylib
- libsfml-audio.2.0.dylib is the actual library

What it means:
- by linking to libsfml-audio.dylib, you use whatever-version-you-have-installed of sfml-audio (don't care about the version)
- by linking to libsfml-audio.2.dylib, you explicitely force linking to a version with major number 2, but with any minor version number (2.x) -- systems where only version 3.x or 1.x of the library is present won't link.
- by linking to libsfml-audio.2.0.dylib, you explicitely force linking to a version with major number 2 and minor number 0, any other version (1.2, 2.5, 3.1, ...) won't link.
Laurent Gomila - SFML developer

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: SFML 2.0 - Issue distributing builds to any other Macs
« Reply #9 on: July 13, 2012, 10:50:12 am »
Actually it is the other way round:
Woops, you're right.
Want to play movies in your SFML application? Check out sfeMovie!

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 2.0 - Issue distributing builds to any other Macs
« Reply #10 on: July 13, 2012, 11:57:54 am »
BTW, there is one more bug with these templates.  ;D

(Fix on github in a few minutes)
SFML / OS X developer