Linking Derelict3 D with OS X

I just want to do a little test with GLFW3 D binding. I create a new package using

dub init glfw3Test

      

Then I wrote a small test in the glfw3Test \ source \ app.d file

import derelict.glfw3.glfw3;

void main() 
{
    // Load the GLFW 3 library.
    DerelictGLFW3.load();
    if(DerelictGLFW3.isLoaded)
    {
    // Do something cool!

    }
}

      

And I modified the default JSON:

{
"name": "glfw3Test",
"dependencies":
{
    "derelict-glfw3": "~master"
},
"configurations": [
    {
        "name": "glfw3Test",
        "targetType": "executable"
    }
]   
}

      

I built with dub build

, everything went fine, but when I started running the executable, I got the following errors:

derelict.util.exception.SharedLibLoadException@../../../.dub/packages/derelict-util-1.0.2/source/derelict/util/exception.d(35): Failed to load one or more shared libraries:
libglfw.3.dylib - dlopen(libglfw.3.dylib, 2): image not found
libglfw3.dylib - dlopen(libglfw3.dylib, 2): image not found

      

I also tried to compile my application manually without using DUB, but I always had the same problem.

You seem to be looking for the GLFW3 shared library, but I thought the lib was statically linked by an inline process.

I'm on OS X 10.10 with Xcode 6 installed (DMD compiler 2.065)

+3


source to share


1 answer


I noticed that the default GLFW3 build process (using cmake) does not create dylib files. So I rebuilt GLFW with the following option:

cmake -D BUILD_SHARED_LIBS=ON

      



And then I created make install

, so now the libglfw.dylib file is correctly installed in / usr / local / lib

Thanks @duselbaer for noticing this issue.

+2


source







All Articles