FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

weird linux error

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
404FileNotFound



Joined: 20 Aug 2005
Posts: 18

PostPosted: Sat Aug 20, 2005 2:17 am    Post subject: weird linux error Reply with quote

I'm using dmd 0.129 on ubuntu linux and I get the following error when trying to compile a simple test program (the only thing it does is call DerelictSDL_Load() ).
Code:
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 gaf exit-status 1 terug

Compiling derelictSDL and derelictUtil worked ok I think, Does anyone know what Im doing wrong here and how I can fix it?
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Sat Aug 20, 2005 1:19 pm    Post subject: Reply with quote

Yep. You are not linking with linux's libdl shared library. Notice that the undefined symbols are dlopen, dlclose, dlsym, etc.

You won't see these errors when compiling Derelict to a library because you haven't actually performed a link stage at that point.

To fix this, just add "-L-ldl" to your dmd project command line. That should direct the linker to search dl library to locate the required symbols.

Another option is to add that same flag to dmd.conf's DFLAGS line. That way you don't have to remember to add it to your dmd command line each time. The dynamic loader library is usually important to most d programs anyway.

Hope that helps.

-JJR
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Sat Aug 20, 2005 1:29 pm    Post subject: Reply with quote

In fact, to make things easier, all the linux versions of the derelict examples should be updated to include a pragma (lib, "dl") for the build process. They probably won't work otherwise. Yet, I'm not sure if dmd on linux supports the same directive. The build tool's equivalent pragma would suffice, if that were the case.

-JJR
Back to top
View user's profile Send private message
404FileNotFound



Joined: 20 Aug 2005
Posts: 18

PostPosted: Sun Aug 21, 2005 12:28 am    Post subject: Reply with quote

Thanks that worked. I was using some eclipse plugin so I couldn't really add something to the cmd line, but I added it to the dmd.conf file and that did the trick.
Back to top
View user's profile Send private message
404FileNotFound



Joined: 20 Aug 2005
Posts: 18

PostPosted: Mon Aug 22, 2005 5:36 am    Post subject: Reply with quote

Ok so I've got another question Smile
is it possible to use opengl from derelictSDL? I noticed there isn't a sdl_opengl.h wrapper. Or am I supposed to use derelictGL for this?
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Mon Aug 22, 2005 5:41 am    Post subject: Reply with quote

404FileNotFound wrote:
Ok so I've got another question Smile
is it possible to use opengl from derelictSDL? I noticed there isn't a sdl_opengl.h wrapper. Or am I supposed to use derelictGL for this?


Yes, just use DerelictGL.

sdl_opengl.h exists because of the platform differences between OpenGL headers in the C world. For example, on Windows gl.h requires types defined in windows.h, and on Mac the path is non-standard. sdl_opengl.h hides all of this. We don't need that in DerelictSDL because all of the types and declarations you need are available in DerelictGL. SDL creates the OpenGL context for you, and then you can make gl calls through any means available (DerelictGL, another gl binding for D, or perhaps even a C library you've linked to).
Back to top
View user's profile Send private message Send e-mail
404FileNotFound



Joined: 20 Aug 2005
Posts: 18

PostPosted: Mon Aug 22, 2005 6:05 am    Post subject: Reply with quote

Ok thanks a bunch, I'll try that
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group