View previous topic :: View next topic |
Author |
Message |
lordolin
Joined: 16 Nov 2005 Posts: 3
|
Posted: Wed Nov 16, 2005 8:07 pm Post subject: Problems compiling example.d Linux |
|
|
Hello !
The solution must be trivial
I compiled the dmd libs and copied them to
/lib and /usr/lib. Now, when I try dmd example.d
or build example.d I get :
-----------------------------------------------------------------------------------------------------------
gcc derelict/glfw/glfw.o example.o derelict/util/loader.o derelict/util/exception.o -o example -lphobos -lpthread -lm
derelict/util/loader.o(.gnu.linkonce.t_D8derelict4util6loader22Platform_LoadSharedLibFAaZC8derelict4util6loader9SharedLib+0x15): In function `_D8derelict4util6loader22Platform_LoadSharedLibFAaZC8derelict4util6loader9SharedLib':
: undefined reference to `dlopen'
derelict/util/loader.o(.gnu.linkonce.t_D8derelict4util6loader24Platform_UnloadSharedLibFC8derelict4util6loader9SharedLibZv+0xf): In function `_D8derelict4util6loader24Platform_UnloadSharedLibFC8derelict4util6loader9SharedLibZv':
: undefined reference to `dlclose'
derelict/util/loader.o(.gnu.linkonce.t_D8derelict4util6loader16Platform_GetProcFC8derelict4util6loader9SharedLibAaZPv+0x19): In function `_D8derelict4util6loader16Platform_GetProcFC8derelict4util6loader9SharedLibAaZPv':
: undefined reference to `dlsym'
collect2: ld returned 1 exit status
--- errorlevel 1
==================================================
PLZ HEEEELP !!!
PS: I copied the util directory into the derelictGLFW direvctory
If i do not do this I get :
================================================
root:# build example.d
gcc derelict/glfw/glfw.o example.o derelict/util/loader.o derelict/util/exception.o -o example -lphobos -lpthread -lm
gcc: derelict/util/loader.o: No such file or directory
gcc: derelict/util/exception.o: No such file or directory
--- errorlevel 1
-================================================
Regards, Oliver |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Thu Nov 17, 2005 2:25 am Post subject: Re: Problems compiling example.d Linux |
|
|
lordolin wrote: | Hello !
----------------------------------------------------------------------------------------------------------
gcc derelict/glfw/glfw.o example.o derelict/util/loader.o derelict/util/exception.o -o example -lphobos -lpthread -lm
derelict/util/loader.o(.gnu.linkonce.t_D8derelict4util6loader22Platform_LoadSharedLibFAaZC8derelict4util6loader9SharedLib+0x15): In function `_D8derelict4util6loader22Platform_LoadSharedLibFAaZC8derelict4util6loader9SharedLib':
: undefined reference to `dlopen'
derelict/util/loader.o(.gnu.linkonce.t_D8derelict4util6loader24Platform_UnloadSharedLibFC8derelict4util6loader9SharedLibZv+0xf): In function `_D8derelict4util6loader24Platform_UnloadSharedLibFC8derelict4util6loader9SharedLibZv':
: undefined reference to `dlclose'
derelict/util/loader.o(.gnu.linkonce.t_D8derelict4util6loader16Platform_GetProcFC8derelict4util6loader9SharedLibAaZPv+0x19): In function `_D8derelict4util6loader16Platform_GetProcFC8derelict4util6loader9SharedLibAaZPv':
: undefined reference to `dlsym'
collect2: ld returned 1 exit status
--- errorlevel 1
==================================================
|
See all of the 'undefined references' to functions named dl* (dlopen, dlclose, and dlsym)? These are not Derelict functions. You need to link to libdl. That is the API Derelict uses to load dynamic libraries on Linux.
There's no need to move the DerelictUtil stuff to the DerelictGLFW directory. As long as all of the Derelict modules are on the import path and you are linking to libderelictGLFW and libderelictUtil, everything should be fine. I suggest you create a common 'derelict' directory and copy all off the Derelict*/derelict directories to it (i.e. DerelictGLFW/derelict, DerelictUtil/derelict). This will ensure that all of the derelict modules are in a common directory you can easily add to your import path. |
|
Back to top |
|
|
lordolin
Joined: 16 Nov 2005 Posts: 3
|
Posted: Thu Nov 17, 2005 6:08 pm Post subject: |
|
|
Hi !
I did the following.
build example.d -full dl.a
which results in an executable file.
When running it I get:
===========================================
Error: Failed to load shared library Failed to load shared library libglfw.so
===========================================
Now this makes sense cause I only have libglfw.a BUT I tried for
some time to make a shared libglfw without success.
So I would appreciate to know HOW TO MAKE A SHARED LIB !!!
THX , oliver |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Thu Nov 17, 2005 10:58 pm Post subject: |
|
|
Even though it's beyond the scope of Derelict, John Reimer was kind enough to write up instructions on how to build a GLFW shared library on Linux. You can find it in the DerelictGLFW documentation. |
|
Back to top |
|
|
lordolin
Joined: 16 Nov 2005 Posts: 3
|
Posted: Fri Nov 18, 2005 11:54 am Post subject: |
|
|
Thanx a lot !!!
Now I can start coding some games !!
regards, Oliver |
|
Back to top |
|
|
JJR
Joined: 22 Feb 2004 Posts: 1104
|
Posted: Fri Nov 18, 2005 2:54 pm Post subject: |
|
|
I really need to update Derelict.glfw for the latest 2.5 release of glfw. The instructions for building shared libraries on Linux would also need to updated.
Like Mike mentions, the C glfw project has no option to build a shared library version on Linux. The windows version of glfw, on the other hand, does. I've made several requests to the glfw author to support Linux shared libraries; unfortunately, my requests remain unanswered.
My solution, then, was to modify the C glfw source and makefile to support a linux *.so build. It worked as a stop-gap solution, but I had to disable some CPU detection code in glfw 2.4.2 in order to make it work. As far as my tests showed, everything worked fine despite this. I'm not sure what changes will be necessary to make the new 2.5 version operate correctly.
A word of warning: if you do use the linux version of Derelict.glfw and manage to build your own libglfw.so with which it will interface, be prepared that the end-users of your product will have no access to a libglfw.so. You will either have to provide those users with the .so library and a means to install it, or you will have to provide the same instructions for how to build it. Not a simple matter either way. Thus, the Linux version of Derelict.glfw is really an unsupported interface until the glfw author supplies the shared library as a build option.
I also have converted a number of the glfw demos to work with Derelict.glfw. They should work on both win32 and Linux. I'll try to include them in the next update if time permits.
-JJR |
|
Back to top |
|
|
|