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

Author Topic: Running on Mac OSX - unable to load library  (Read 10505 times)

0 Members and 1 Guest are viewing this topic.

Brendon

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
    • http://blendogames.com
Running on Mac OSX - unable to load library
« on: June 26, 2010, 07:42:39 pm »
I currently have SFMLNet running via Mono on Windows and Linux, and now I'm trying to get it going on Mac OSX.

When I run the program, I get this error:

Code: [Select]
Mono-INFO: DllImport attempting to load: 'csfml-graphics'.
Mono-INFO: DllImport error loading library 'dlopen(csfml-graphics, 9): Library not loaded: @executable_path/../Frameworks/csfml-window.framework/Versions/A/csfml-window
  Referenced from: .//csfml-graphics
  Reason: image not found'.

(release2.exe:439): Mono-WARNING **: DllImport unable to load library 'dlopen(libcsfml-graphics, 9): image not found'.


I've downloaded the SFML 1.6 sdks and copied the contents of SFML-1.6/lib, SFML-1.6/extlib/bin, and SFML-1.6/CSFML/lib into the corresponding Frameworks directory.  I also copied them into the /Library/Frameworks directory as described in the tutorial.

I'm running on OSX 10.4 and using the SFML 32-bit universal binaries.

I'm unclear as to why the program can't find the libraries. Any ideas?

My current directory structure:
Code: [Select]
Contents
       |
       |--MacOS   <-- where the executables are
       |
       |--Frameworks
              |
              |--csfml-audio.framework
              |--csfml-graphics.framework
              |--csfml-network.framework
              |--csfml-system.framework
              |--csfml-window.framework
              |--sfml-audio.framework
              |--sfml-graphics.framework
              |--sfml-network.framework
              |--sfml-system.framework
              |--sfml-window.framework
              |--SFML.framework
              |--sndfile.framework
              |--OpenAL.framework

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Running on Mac OSX - unable to load library
« Reply #1 on: June 26, 2010, 11:57:52 pm »
Note : you do no need to link against SFML.framework.

As for your issue, this is weird. Both ways should be fine (into the app and in the /Library/Frameworks directory), but none works. Are you sure the csfml-window framework IS in the directories you said ?

Otherwise, the only point I can think of is the way Mono loads frameworks. Looks like frameworks are being loaded manually with dlopen(), thus you should probably load the framework in the correct order :
sfml-system => sfml-network => sfml-audio => sfml-window => sfml-graphics => csfml-system => csfml-network => csfml-audio => csfml-window => csfml-window => csfml-graphics.

PS: you may be the first one trying to use SFML.NET on Mac OS X.
Want to play movies in your SFML application? Check out sfeMovie!

Brendon

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
    • http://blendogames.com
Running on Mac OSX - unable to load library
« Reply #2 on: June 27, 2010, 02:13:13 am »
You're right, Ceylo - I neglected to copy CSFML into my /Library/Frameworks directory. I copied them in, and it had an effect: the "missing sfml-graphics" message is now replaced with a "missing sfml-window" message.

Can you tell me how does one control the order in which frameworks are loaded?  I haven't done that before - I assumed frameworks were just called whenever a program's function needed it.


I decided to make a bare-bones SFML program to test if I can get anything on-screen.  It just creates a renderwindow and waits for the user to press ESC to quit.

I managed to get an empty cyan SFML window up that accepts keystrokes - so my barebones program does seem to be finding the sfml window framework.

But when I try to load an image or font, it crashes out saying it's unable to load the asset.  It seems the sfml graphics framework isn't loading for some reason.

Here's the output when I run the bare-bones program:
Code: [Select]
Mono-Message: gc took 0 usecs
Mono-INFO: Assembly Loader probing location: './mscorlib.dll'.
Mono-INFO: Image addref mscorlib 0xb107c0 -> /Users/bc/Desktop/airforte/MacOS/mscorlib.dll 0x200b800: 2

Mono-INFO: AOT failed to load AOT module /Users/bc/Desktop/airforte/MacOS/mscorlib.dll.dylib: dlopen(/Users/bc/Desktop/airforte/MacOS/mscorlib.dll.dylib, 9): image not found

Mono-INFO: Assembly Loader loaded assembly from location: './mscorlib.dll'.
Mono-INFO: Config attempting to parse: '/Users/bc/Desktop/airforte/MacOS/mscorlib.dll.config'.
Mono-INFO: Config attempting to parse: '/Library/Frameworks/Mono.framework/Versions/2.6.4/etc/mono/assemblies/mscorlib/mscorlib.config'.
Mono-INFO: Config attempting to parse: '/Users/bc/.mono/assemblies/mscorlib/mscorlib.config'.
Mono-INFO: Assembly mscorlib 0xb107c0 added to domain test.exe, ref_count=1

Mono-INFO: Config attempting to parse: '/Library/Frameworks/Mono.framework/Versions/2.6.4/etc/mono/config'.
Mono-INFO: Config attempting to parse: '/Users/bc/.mono/config'.
Mono-INFO: Assembly Loader probing location: 'test.exe'.
Mono-INFO: Image addref test 0xb17a30 -> /Users/bc/Desktop/airforte/MacOS/test.exe 0x200b400: 3

Mono-INFO: Assembly test 0xb17a30 added to domain test.exe, ref_count=1

Mono-INFO: AOT failed to load AOT module /Users/bc/Desktop/airforte/MacOS/test.exe.dylib: dlopen(/Users/bc/Desktop/airforte/MacOS/test.exe.dylib, 9): image not found

Mono-INFO: Assembly Loader loaded assembly from location: 'test.exe'.
Mono-INFO: Config attempting to parse: '/Users/bc/Desktop/airforte/MacOS/test.exe.config'.
Mono-INFO: Config attempting to parse: '/Library/Frameworks/Mono.framework/Versions/2.6.4/etc/mono/assemblies/test/test.config'.
Mono-INFO: Config attempting to parse: '/Users/bc/.mono/assemblies/test/test.config'.
Mono-INFO: Assembly Loader probing location: 'test.exe'.
Mono-INFO: AOT failed to load AOT module /Users/bc/Desktop/airforte/MacOS/test.exe.dylib: dlopen(/Users/bc/Desktop/airforte/MacOS/test.exe.dylib, 9): image not found

Mono-INFO: Assembly Ref addref test 0xb17a30 -> mscorlib 0xb107c0: 2

Mono-INFO: Assembly Loader probing location: '/Users/bc/Desktop/airforte/MacOS/sfmlnet-graphics.dll'.
Mono-INFO: Image addref sfmlnet-graphics 0xb1a4e0 -> /Users/bc/Desktop/airforte/MacOS/sfmlnet-graphics.dll 0x2022400: 2

Mono-INFO: Assembly sfmlnet-graphics 0xb1a4e0 added to domain test.exe, ref_count=1

Mono-INFO: AOT failed to load AOT module /Users/bc/Desktop/airforte/MacOS/sfmlnet-graphics.dll.dylib: dlopen(/Users/bc/Desktop/airforte/MacOS/sfmlnet-graphics.dll.dylib, 9): image not found

Mono-INFO: Assembly Loader loaded assembly from location: '/Users/bc/Desktop/airforte/MacOS/sfmlnet-graphics.dll'.
Mono-INFO: Config attempting to parse: '/Users/bc/Desktop/airforte/MacOS/sfmlnet-graphics.dll.config'.
Mono-INFO: Config attempting to parse: '/Library/Frameworks/Mono.framework/Versions/2.6.4/etc/mono/assemblies/sfmlnet-graphics/sfmlnet-graphics.config'.
Mono-INFO: Config attempting to parse: '/Users/bc/.mono/assemblies/sfmlnet-graphics/sfmlnet-graphics.config'.
Mono-INFO: Assembly Ref addref test 0xb17a30 -> sfmlnet-graphics 0xb1a4e0: 2

Mono-INFO: Assembly Loader probing location: '/Users/bc/Desktop/airforte/MacOS/sfmlnet-window.dll'.
Mono-INFO: Image addref sfmlnet-window 0xb0de10 -> /Users/bc/Desktop/airforte/MacOS/sfmlnet-window.dll 0x2022800: 2

Mono-INFO: Assembly sfmlnet-window 0xb0de10 added to domain test.exe, ref_count=1

Mono-INFO: AOT failed to load AOT module /Users/bc/Desktop/airforte/MacOS/sfmlnet-window.dll.dylib: dlopen(/Users/bc/Desktop/airforte/MacOS/sfmlnet-window.dll.dylib, 9): image not found

Mono-INFO: Assembly Loader loaded assembly from location: '/Users/bc/Desktop/airforte/MacOS/sfmlnet-window.dll'.
Mono-INFO: Config attempting to parse: '/Users/bc/Desktop/airforte/MacOS/sfmlnet-window.dll.config'.
Mono-INFO: Config attempting to parse: '/Library/Frameworks/Mono.framework/Versions/2.6.4/etc/mono/assemblies/sfmlnet-window/sfmlnet-window.config'.
Mono-INFO: Config attempting to parse: '/Users/bc/.mono/assemblies/sfmlnet-window/sfmlnet-window.config'.
Mono-INFO: Assembly Ref addref sfmlnet-graphics 0xb1a4e0 -> sfmlnet-window 0xb0de10: 2

Mono-INFO: Assembly Ref addref sfmlnet-window 0xb0de10 -> mscorlib 0xb107c0: 3

Mono-INFO: Assembly Ref addref sfmlnet-graphics 0xb1a4e0 -> mscorlib 0xb107c0: 4

Mono-INFO: Assembly Ref addref test 0xb17a30 -> sfmlnet-window 0xb0de10: 3

Mono-INFO: DllImport attempting to load: 'csfml-graphics'.
Mono-INFO: DllImport loading location: 'libcsfml-graphics.dylib'.
Mono-INFO: DllImport error loading library: 'dlopen(libcsfml-graphics.dylib, 9): image not found'.
Mono-INFO: DllImport loading location: 'libcsfml-graphics.so'.
Mono-INFO: DllImport error loading library: 'dlopen(libcsfml-graphics.so, 9): image not found'.
Mono-INFO: DllImport loading location: 'libcsfml-graphics.bundle'.
Mono-INFO: DllImport error loading library: 'dlopen(libcsfml-graphics.bundle, 9): image not found'.
Mono-INFO: DllImport loading library: './libcsfml-graphics.dylib'.
Mono-INFO: DllImport error loading library 'dlopen(./libcsfml-graphics.dylib, 9): image not found'.
Mono-INFO: DllImport loading library: './libcsfml-graphics.so'.
Mono-INFO: DllImport error loading library 'dlopen(./libcsfml-graphics.so, 9): image not found'.
Mono-INFO: DllImport loading library: './libcsfml-graphics.bundle'.
Mono-INFO: DllImport error loading library 'dlopen(./libcsfml-graphics.bundle, 9): image not found'.
Mono-INFO: DllImport loading: 'csfml-graphics'.
Mono-INFO: Searching for 'sfRenderWindow_Clear'.
Mono-INFO: Probing 'sfRenderWindow_Clear'.
Mono-INFO: Found as 'sfRenderWindow_Clear'.
Mono-INFO: DllImport attempting to load: 'csfml-graphics'.
Mono-INFO: DllImport loading location: 'libcsfml-graphics.dylib'.
Mono-INFO: DllImport error loading library: 'dlopen(libcsfml-graphics.dylib, 9): image not found'.
Mono-INFO: DllImport loading location: 'libcsfml-graphics.so'.
Mono-INFO: DllImport error loading library: 'dlopen(libcsfml-graphics.so, 9): image not found'.
Mono-INFO: DllImport loading location: 'libcsfml-graphics.bundle'.
Mono-INFO: DllImport error loading library: 'dlopen(libcsfml-graphics.bundle, 9): image not found'.
Mono-INFO: DllImport loading library: './libcsfml-graphics.dylib'.
Mono-INFO: DllImport error loading library 'dlopen(./libcsfml-graphics.dylib, 9): image not found'.
Mono-INFO: DllImport loading library: './libcsfml-graphics.so'.
Mono-INFO: DllImport error loading library 'dlopen(./libcsfml-graphics.so, 9): image not found'.
Mono-INFO: DllImport loading library: './libcsfml-graphics.bundle'.
Mono-INFO: DllImport error loading library 'dlopen(./libcsfml-graphics.bundle, 9): image not found'.
Mono-INFO: DllImport loading: 'csfml-graphics'.
Mono-INFO: Searching for 'sfRenderWindow_Create'.
Mono-INFO: Probing 'sfRenderWindow_Create'.
Mono-INFO: Found as 'sfRenderWindow_Create'.
Mono-INFO: DllImport attempting to load: 'csfml-graphics'.
Mono-INFO: DllImport loading location: 'libcsfml-graphics.dylib'.
Mono-INFO: DllImport error loading library: 'dlopen(libcsfml-graphics.dylib, 9): image not found'.
Mono-INFO: DllImport loading location: 'libcsfml-graphics.so'.
Mono-INFO: DllImport error loading library: 'dlopen(libcsfml-graphics.so, 9): image not found'.
Mono-INFO: DllImport loading location: 'libcsfml-graphics.bundle'.
Mono-INFO: DllImport error loading library: 'dlopen(libcsfml-graphics.bundle, 9): image not found'.
Mono-INFO: DllImport loading library: './libcsfml-graphics.dylib'.
Mono-INFO: DllImport error loading library 'dlopen(./libcsfml-graphics.dylib, 9): image not found'.
Mono-INFO: DllImport loading library: './libcsfml-graphics.so'.
Mono-INFO: DllImport error loading library 'dlopen(./libcsfml-graphics.so, 9): image not found'.
Mono-INFO: DllImport loading library: './libcsfml-graphics.bundle'.
Mono-INFO: DllImport error loading library 'dlopen(./libcsfml-graphics.bundle, 9): image not found'.
Mono-INFO: DllImport loading: 'csfml-graphics'.
Mono-INFO: Searching for 'sfRenderWindow_GetInput'.
Mono-INFO: Probing 'sfRenderWindow_GetInput'.
Mono-INFO: Found as 'sfRenderWindow_GetInput'.
Mono-INFO: DllImport attempting to load: 'csfml-graphics'.
Mono-INFO: DllImport loading location: 'libcsfml-graphics.dylib'.
Mono-INFO: DllImport error loading library: 'dlopen(libcsfml-graphics.dylib, 9): image not found'.
Mono-INFO: DllImport loading location: 'libcsfml-graphics.so'.
Mono-INFO: DllImport error loading library: 'dlopen(libcsfml-graphics.so, 9): image not found'.
Mono-INFO: DllImport loading location: 'libcsfml-graphics.bundle'.
Mono-INFO: DllImport error loading library: 'dlopen(libcsfml-graphics.bundle, 9): image not found'.
Mono-INFO: DllImport loading library: './libcsfml-graphics.dylib'.
Mono-INFO: DllImport error loading library 'dlopen(./libcsfml-graphics.dylib, 9): image not found'.
Mono-INFO: DllImport loading library: './libcsfml-graphics.so'.
Mono-INFO: DllImport error loading library 'dlopen(./libcsfml-graphics.so, 9): image not found'.
Mono-INFO: DllImport loading library: './libcsfml-graphics.bundle'.
Mono-INFO: DllImport error loading library 'dlopen(./libcsfml-graphics.bundle, 9): image not found'.
Mono-INFO: DllImport loading: 'csfml-graphics'.
Mono-INFO: Searching for 'sfRenderWindow_GetDefaultView'.
Mono-INFO: Probing 'sfRenderWindow_GetDefaultView'.
Mono-INFO: Found as 'sfRenderWindow_GetDefaultView'.
Mono-INFO: DllImport attempting to load: 'csfml-graphics'.
Mono-INFO: DllImport loading location: 'libcsfml-graphics.dylib'.
Mono-INFO: DllImport error loading library: 'dlopen(libcsfml-graphics.dylib, 9): image not found'.
Mono-INFO: DllImport loading location: 'libcsfml-graphics.so'.
Mono-INFO: DllImport error loading library: 'dlopen(libcsfml-graphics.so, 9): image not found'.
Mono-INFO: DllImport loading location: 'libcsfml-graphics.bundle'.
Mono-INFO: DllImport error loading library: 'dlopen(libcsfml-graphics.bundle, 9): image not found'.
Mono-INFO: DllImport loading library: './libcsfml-graphics.dylib'.
Mono-INFO: DllImport error loading library 'dlopen(./libcsfml-graphics.dylib, 9): image not found'.
Mono-INFO: DllImport loading library: './libcsfml-graphics.so'.
Mono-INFO: DllImport error loading library 'dlopen(./libcsfml-graphics.so, 9): image not found'.
Mono-INFO: DllImport loading library: './libcsfml-graphics.bundle'.
Mono-INFO: DllImport error loading library 'dlopen(./libcsfml-graphics.bundle, 9): image not found'.
Mono-INFO: DllImport loading: 'csfml-graphics'.
Mono-INFO: Searching for 'sfImage_CreateFromFile'.
Mono-INFO: Probing 'sfImage_CreateFromFile'.
Mono-INFO: Found as 'sfImage_CreateFromFile'.
Failed to load image "icon.png". Reason : Unable to open file

Unhandled Exception: SFML.LoadingFailedException: Failed to load image from file icon.png
  at SFML.Graphics.Image..ctor (System.String filename) [0x00000] in <filename unknown>:0
  at WindowTest.Game1.Main () [0x00000] in <filename unknown>:0
 

Brendon

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
    • http://blendogames.com
Running on Mac OSX - unable to load library
« Reply #3 on: June 28, 2010, 04:52:41 am »
I made some progress on getting SFMLNet & Mono on the Mac OSX. My barebones test project is now able to load and display a sprite!

Apparently, the graphics library is loading fine.  The problem was that the game is searching for assets from the desktop, not the executable folder.  I'm going to take a look into why this is happening.

My next hurdle is to figure out how why the audio isn't working. When I include audio function calls in my test program, the game crashes out with "unable to load libcsfml-audio".  I copied over OpenAL and the sndfile frameworks, but it didn't have any effect.

Edit: Just got audio working. For some reason, it works when csfml-audio is copied to the desktop (where the game is currently searching for assets).

Ashenwraith

  • Sr. Member
  • ****
  • Posts: 270
    • View Profile
Running on Mac OSX - unable to load library
« Reply #4 on: June 28, 2010, 03:30:37 pm »
That's really cool that you are emulating Mac OS. Hopefully if it can be emulated better maybe Laurent might be able to work on compatibility some.

Would be great to hear about your experiences with SFML vs XNA.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Running on Mac OSX - unable to load library
« Reply #5 on: June 28, 2010, 04:18:41 pm »
Usually frameworks don't need to be loaded in a specific order. But here it does look like Mono loads the framework manually with dlopen(), that's why I told you you may need to load these frameworks in a specific order. I don't know how Mono resolves the dependencies, and you're having weird issues (like the image/framework that needs to be copied in your desktop).

I almost don't know Mono and I really cannot help you more on this technical issue.
Want to play movies in your SFML application? Check out sfeMovie!

Brendon

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
    • http://blendogames.com
Running on Mac OSX - unable to load library
« Reply #6 on: June 29, 2010, 12:59:46 am »
No problem, Ceylo. You're right in how the load order is important - when I try to play sound effect prior to displaying a sprite, the game crashes out. I have to first create the renderwindow, then draw a sprite, then play a sound - that seems to load the frameworks in an agreeable way.

I figured out how to make the game load assets from appropriate directories. I just have to package my game into a Mac App Bundle. The game now correctly looks for assets in the ../Resources directory.

Now that my barebones test project is functioning nicely, now I'm going to cross my fingers and tackle my actual game.

Brendon

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
    • http://blendogames.com
Running on Mac OSX - unable to load library
« Reply #7 on: July 01, 2010, 09:56:33 pm »
Success! My game now works.  I now have SFMLNet running via Mono on my Mac osx.

I'm new to Macs, so this was certainly a learning experience. I was hitting a brick wall until I learned about the Mac's application bundle structure.  Once I created the folder structure in the proper way, the porting went fairly smoothly.

I've posted links to the demo in the SFML Projects board: http://www.sfml-dev.org/forum/viewtopic.php?p=18417

 

anything