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

Author Topic: Mono with OSX  (Read 5115 times)

0 Members and 1 Guest are viewing this topic.

Radnen

  • Newbie
  • *
  • Posts: 17
    • View Profile
Mono with OSX
« on: July 31, 2013, 04:17:39 am »
So I'm having trouble getting SFML to run under Mono on OSX. I added config files to the dlls, but I don't know if I did it right.

I add csfml-graphics-2.dll.config to the exe directory, and add the libsfml-graphics.2.dylib to it.
The config looks like this:
<configuration>
    <dllmap dll="csfml-window-2.dll.config" target="libsfml-graphics.2.dylib">
</configuration>
 

It should work; any ideas?
« Last Edit: July 31, 2013, 06:31:05 am by Radnen »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Mono with OSX
« Reply #1 on: July 31, 2013, 07:45:12 am »
And what happens?
Laurent Gomila - SFML developer

Radnen

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Mono with OSX
« Reply #2 on: July 31, 2013, 07:50:21 am »
The standard DLLNotFoundException: "csfml-graphics-2.dll". I thoroughly read through the dllmap tutorial on the mono website and the above *should* work.

Now the only other change I made is to use the name you used in the DllImport sections:
<configuration>
    <dllmap dll="csfml-graphics-2" target="libsfml-graphics.2.dylib" />
</configuration>
 

But that is not working. It doesn't even attempt to load the dylib or dll. I put the dylib file into the same folder as the executable, btw.

Edit: I got somewhere!

I added the config to the sfml-graphics-2.dll file instead and it now looks for the correct dylib file. But now I'm again getting a DllNotFoundException on the dylib file... hmm maybe a misspelling? I'm getting closer.

Edit: impossible.
Mono: DllImport error loading library '/Users/user/code/Engine/Engine/bin/Debug/libsfml-graphics.2.dylib': 'dlopen(/Users/user/code/Engine/Engine/bin/Debug/libsfml-graphics.2.dylib, 9): image not found'.

That is the exact path where the dylib is!! What is going on here!?

Edit:
I realized it was libsfml-graphics.2.0.dylib. I made that change... and still it complains that it doesn't exist.

Okay.. now I have this:
Mono: DllImport unable to load library 'dlopen(libsfml-graphics.2.0.dylib, 9): Library not loaded: @executable_path/../Frameworks/libsfml-window.2.dylib
  Referenced from: /Users/user/code/Engine/Engine/bin/Debug/libsfml-graphics.2.0.dylib
 
« Last Edit: July 31, 2013, 08:52:05 am by Radnen »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Mono with OSX
« Reply #3 on: July 31, 2013, 10:41:23 am »
Not that I know anything about Mono but
Quote
I realized it was libsfml-graphics.2.0.dylib. I made that change...
Did you do the same for the window, system and audio module ?
SFML / OS X developer

Radnen

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Mono with OSX
« Reply #4 on: July 31, 2013, 11:59:23 am »
Yes, I did the same for them. I noticed in the lib folder of the OSX 2.0 binary release that there are libsfml-graphics.2.0.dylib and libsfml-graphics.2.dylib. I don't understand the difference. Also the error I'm getting:

Mono: DllImport unable to load library 'dlopen(libsfml-graphics.2.0.dylib, 9): Library not loaded: @executable_path/../Frameworks/libsfml-window.2.dylib
  Referenced from: /Users/user/code/Engine/Engine/bin/Debug/libsfml-graphics.2.0.dylib
 

Seems to suggest that the mono libraries call other stuff from another library and I don't know where to begin with resolving that. For example, in the libsfml-window-2.0.dylib, libsfml-system.2.dylib is referenced but really not used by the .Net files. I begin to wonder if SFML.net is OSX compatible? I remember getting SFML.net to work in Linux by using .so files, but this seems different.[/code]

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Mono with OSX
« Reply #5 on: July 31, 2013, 01:01:11 pm »
Mono: DllImport unable to load library 'dlopen(libsfml-graphics.2.0.dylib, 9): Library not loaded: @executable_path/../Frameworks/libsfml-window.2.dylib
  Referenced from: /Users/user/code/Engine/Engine/bin/Debug/libsfml-graphics.2.0.dylib
 

Unless I am totally mistaken, but SFML.NET does not use the SFML but rather it uses CSFML. So trying to tell mono to load a C++ dll is not going to work too well. I think you need to build CSFML and then tell mono to load that instead.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Mono with OSX
« Reply #6 on: July 31, 2013, 01:05:08 pm »
@Radnen, if you think the issue comes from the load path (@executable_path), look at JSFML building instruction. Maybe you need to do the same. https://github.com/pdinklag/JSFML/wiki/Building-JSFML
SFML / OS X developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Mono with OSX
« Reply #7 on: July 31, 2013, 01:16:33 pm »
Quote
SFML.NET does not use the SFML but rather it uses CSFML
Good catch! I didn't notice he was trying to map CSFML DLLs to SFML dylibs.
Laurent Gomila - SFML developer

Radnen

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Mono with OSX
« Reply #8 on: July 31, 2013, 08:12:34 pm »
Hmm, so those dylib files were the C++ source! :P

So I guess I have to build the csfml source into dylib files and use that.

Edit: same issue,
Mono: DllImport error loading library 'libcsfml-window.2.0.dylib': 'dlopen(libcsfml-window.2.0.dylib, 9): Library not loaded: @executable_path/../Frameworks/libsfml-window.2.dylib
  Referenced from: /Users/user/code/Engine/Engine/bin/Debug/libcsfml-window.2.0.dylib
  Reason: image not found'.
 
« Last Edit: July 31, 2013, 08:20:51 pm by Radnen »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Mono with OSX
« Reply #9 on: July 31, 2013, 08:23:50 pm »
My last comment doesn't apply only to SFML. You need to play around with install_name or something.
SFML / OS X developer

Radnen

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Mono with OSX
« Reply #10 on: July 31, 2013, 11:40:09 pm »
I don't understand. I would first need to obtain a file named: libsfml-window.2.dylib

For me to even play around. I don't see that file anywhere in the sources... Well I do but it's like 1kb and I don't think it's even a proper dylib... right? I put it into ../Frameworks/ folder and still nothing happens.