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

Author Topic: Mac - Issues  (Read 5597 times)

0 Members and 1 Guest are viewing this topic.

tihare

  • Newbie
  • *
  • Posts: 7
    • View Profile
Mac - Issues
« on: August 18, 2009, 06:40:24 pm »
I'm currently responsible for porting an existing codebase from PC - Mac.  Because of this I decided to use Codeblocks, I converted the Visual studio project to Codeblocks, and compiled and runs fine on the PC.  My next step was to do the same on the Mac.  

What I tried to do was port the SFML project files from Visual studio to Codeblocks, which worked, I replaced the Win32 folders with the Unix/Cocoa ones, I managed to get it to compile, but it wouldn't link, rather than mess too much with it, I decided to use the Xcode project files, and then link with Codeblocks.  I compiled SFML with Xcode, and added the frameworks to the Linker settings(in Codeblocks), and everything linked!  However, when I try to execute the application it says:


dyld:  LIbrary not loaded: @executable_path/../Frameworks/sfml-audio-d.framework/Versions/A/sfml-audio-d

If I take the audio of the linker, then it just does it for the next one in the list, so it's nothing specific about the audio itself, rather I don't know what I'm doing.


Any help would be greatly appreciated.  Let me point out that I have never used a Mac prior to this porting process, I'm a complete noob when it comes to the Mac.  Xcode looks so klunky otherwise I could probably port the entire project to Xcode, but it might take quite some time, time of course that I don't have.  


Thanks

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Mac - Issues
« Reply #1 on: August 18, 2009, 07:53:44 pm »
Quote from: "tihare"
However, when I try to execute the application it says:

dyld: LIbrary not loaded: @executable_path/../Frameworks/sfml-audio-d.framework/Versions/A/sfml-audio-d

Does it prevent you from launching the application ?
Want to play movies in your SFML application? Check out sfeMovie!

tihare

  • Newbie
  • *
  • Posts: 7
    • View Profile
Mac - Issues
« Reply #2 on: August 18, 2009, 08:29:22 pm »
Well, then it says.

machine:~ user$ /code/app/executable ; exit;
dyld: Library not loaded: @executable_path/../Frameworks/sfml-audio-d.framework/Versions/A/sfml-audio-d
  Referenced from: /code/app/executable
  Reason: image not found
Trace/BPT trap
logout

[Process completed]


I edited the above text to strip out some information.  If I run it through the finder, I see this message, if I run it through Codeblocks, I can't really see what's going on, but I don't get complaining about not loading a library, but I don't see anything pop up or seem to execute either.

When I built the SFML libraries with Xcode I used debug, and from what I could tell this should be static, so I'm a bit puzzled when it can't find a library, as it should be linked with the executable.  I know that I don't want to use dll's if possible.  Debug/Release appear to be static, while Development seems to be dll is that correct?

tihare

  • Newbie
  • *
  • Posts: 7
    • View Profile
Mac - Issues
« Reply #3 on: August 18, 2009, 08:48:53 pm »
All it says when executing in Codeblocks is:

Executing: /code/app/folder/exe (in /code/app/folder)

It appears that it's exiting right after execution, but there is no message saying there was a problem.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Mac - Issues
« Reply #4 on: August 19, 2009, 02:13:45 am »
Did you follow the Mac OS X tutorial ?
http://www.sfml-dev.org/tutorials/1.5/start-osx.php

What you told me shows that you did not install the SFML frameworks. And there is no static library. All the frameworks (Development, Debug, Release) are dynamic libraries. But as you can put the frameworks in your application, providing static versions is rather useless.
Want to play movies in your SFML application? Check out sfeMovie!

tihare

  • Newbie
  • *
  • Posts: 7
    • View Profile
Mac - Issues
« Reply #5 on: August 19, 2009, 11:35:45 pm »
Quote from: "Ceylo"
Did you follow the Mac OS X tutorial ?
http://www.sfml-dev.org/tutorials/1.5/start-osx.php

What you told me shows that you did not install the SFML frameworks. And there is no static library. All the frameworks (Development, Debug, Release) are dynamic libraries. But as you can put the frameworks in your application, providing static versions is rather useless.


I had looked at it, but since I was using Codeblocks, it was all greek to me, remember, I know nothing about macs and development.

I managed to create the entire application project to Xcode(major pain), and I got it to compile and link, and got the same type of errors(of course).


warning: Unable to read symbols for "@executable_path/../Frameworks/sfml-audio.framework/Versions/A/sfml-audio" (file not found).
warning: Unable to read symbols from "sfml-audio" (not yet mapped into memory).
warning: Unable to read symbols for "@executable_path/../Frameworks/sfml-graphics.framework/Versions/A/sfml-graphics" (file not found).
warning: Unable to read symbols from "sfml-graphics" (not yet mapped into memory).
warning: Unable to read symbols for "@executable_path/../Frameworks/sfml-network.framework/Versions/A/sfml-network" (file not found).
warning: Unable to read symbols from "sfml-network" (not yet mapped into memory).
warning: Unable to read symbols for "@executable_path/../Frameworks/sfml-system.framework/Versions/A/sfml-system" (file not found).
warning: Unable to read symbols from "sfml-system" (not yet mapped into memory).
warning: Unable to read symbols for "@executable_path/../Frameworks/sfml-window.framework/Versions/A/sfml-window" (file not found).
warning: Unable to read symbols from "sfml-window" (not yet mapped into memory).


Ok, so can I ask why it's dll vs. static?  Is there anyway to use static?  and if not, I was reading the tutorial what exactly am I adding to this copy phase thing?  

I know that I don't want to have to install sfml to the users drive, I would rather just have everything contained and it just works right out of the box.  

Thanks for all your help

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Mac - Issues
« Reply #6 on: August 20, 2009, 02:33:57 pm »
Quote from: "tihare"
I managed to create the entire application project to Xcode(major pain), and I got it to compile and link, and got the same type of errors(of course).

If you installed the SFML frameworks, even with these warnings your application should work. But I think your purpose is now to make your application distributable, isn't it ?

And this is where the Copy File Build Phase becomes useful..
Quote from: "tihare"
Ok, so can I ask why it's dll vs. static?  Is there anyway to use static?  and if not, I was reading the tutorial what exactly am I adding to this copy phase thing?

I know that I don't want to have to install sfml to the users drive, I would rather just have everything contained and it just works right out of the box.

Mac OS X applications are nothing more than directories with a .app extension. This means you can put both the executable, resources and libraries in it, and the user will always only see the application as a file.

So... why dynamic library vs static library ? On the one hand because you can put the dynamic library in the bundle application (which means still ONE "file" for the user), and on the other hand for ease reasons : all the libraries on Mac OS X are dynamic, thus if I was providing static versions, you'd have to care about all the dependencies, I can't do all the ar stuff (cf. Compiling SFML (with CodeBlocks)). With dynamic version, links to these dependencies are already saved in the dynamic libraries.

Note : you can consider the directories with .framework extension as the dynamic libraries.

Now about your copy file build phase, add it to your application's target, select "Frameworks" for the target of your phase, and drop the frameworks you're using in it. Build your application. If everything went well, you'll find your frameworks in your_app.app/Contents/Frameworks and you can distribute your application.
Want to play movies in your SFML application? Check out sfeMovie!

tihare

  • Newbie
  • *
  • Posts: 7
    • View Profile
Mac - Issues
« Reply #7 on: August 20, 2009, 06:47:20 pm »
Quote from: "Ceylo"
Quote from: "tihare"
I managed to create the entire application project to Xcode(major pain), and I got it to compile and link, and got the same type of errors(of course).

If you installed the SFML frameworks, even with these warnings your application should work. But I think your purpose is now to make your application distributable, isn't it ?

And this is where the Copy File Build Phase becomes useful..
Quote from: "tihare"
Ok, so can I ask why it's dll vs. static?  Is there anyway to use static?  and if not, I was reading the tutorial what exactly am I adding to this copy phase thing?

I know that I don't want to have to install sfml to the users drive, I would rather just have everything contained and it just works right out of the box.

Mac OS X applications are nothing more than directories with a .app extension. This means you can put both the executable, resources and libraries in it, and the user will always only see the application as a file.

So... why dynamic library vs static library ? On the one hand because you can put the dynamic library in the bundle application (which means still ONE "file" for the user), and on the other hand for ease reasons : all the libraries on Mac OS X are dynamic, thus if I was providing static versions, you'd have to care about all the dependencies, I can't do all the ar stuff (cf. Compiling SFML (with CodeBlocks)). With dynamic version, links to these dependencies are already saved in the dynamic libraries.

Note : you can consider the directories with .framework extension as the dynamic libraries.

Now about your copy file build phase, add it to your application's target, select "Frameworks" for the target of your phase, and drop the frameworks you're using in it. Build your application. If everything went well, you'll find your frameworks in your_app.app/Contents/Frameworks and you can distribute your application.


Thanks for your help Ceylo, my head is in PC land, where all things are different.  To show you the noobness, I got the copy phase working and for the longest time couldn't figure out where the files were going, if they are getting copied.  Until I opened the file(show contents) and walla!  It's just a single file, which is pretty damn slick I must say.  

I managed to get all of those 5 errors to go, and of course is replaced by one more.

Dyld Error Message:

Library not loaded: @execuatable_path/../Frameworks/sndfile.framework/Versions/A/sndfile
Referenced from /code/app/bin/app.app/Contents/MacOS/app
Reason: image not found

I don't know what's referencing the file, I tried taking out the framework sfml-audio.framework, and I still get it, I'm a bit confused on that, but I feel like I'm getting closer to actually testing and fixing the application.


Thanks again

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Mac - Issues
« Reply #8 on: August 20, 2009, 07:39:59 pm »
You forgot one note :
Quote
none of the SFML modules requires a library which is not already installed by default on Mac OS X, except the Audio module which requires the OpenAL and libsndfile libraries. So you'll have to provide them together with your applications (see the extlibs/bin directory of the downloaded disk image).
Want to play movies in your SFML application? Check out sfeMovie!

tihare

  • Newbie
  • *
  • Posts: 7
    • View Profile
Mac - Issues
« Reply #9 on: August 20, 2009, 08:07:59 pm »
Yeah, I saw that, I managed to get it to work, I'm not sure how really.  I accidentally deleted my frameworks folder in my project, so I rebuilt everything again, and re-added the frameworks and it works!  


Is OpenAL installed with the mac by default?, because I didn't install it, and I see it in the System/Library/Frameworks.  So I don't think I would have to include it in the copy phase?  I should just be able to include the libsnd to the copy phase and I shouldn't have to install anything right?  I'm just really concerned that I can distribute the one file and have it work when someone clicks it.  Installing stuff is another step and one more thing I don't know how to do on the Mac.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Mac - Issues
« Reply #10 on: August 20, 2009, 09:08:08 pm »
There is one more sentence on the tutorial : "Note that you can find the OpenAL framework in the system's folders, however the version delivered with Mac OS X 10.4 is not working well, that's why we provide a recompiled version with SFML."

So it depends on whether you want your app to work on Mac OS X 10.4 or not.


Installing an application on Mac OS X means... copying it anywhere on the hard disk, usually in /Applications.
Want to play movies in your SFML application? Check out sfeMovie!

tihare

  • Newbie
  • *
  • Posts: 7
    • View Profile
Mac - Issues
« Reply #11 on: August 20, 2009, 10:03:10 pm »
Ok, but if one didn't include the SFML framework within the app, one would have to install them into the /Library/Frameworks folder?  I'm guessing one could make an applescript to do that?  Because, telling someone to move framework files over manually isn't elegant for a lot of folks.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Mac - Issues
« Reply #12 on: August 20, 2009, 11:39:32 pm »
Indeed one could make a script, but why bother with it when you can pack everything in the application ?
Want to play movies in your SFML application? Check out sfeMovie!