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

Compiling Problem : identifier 'DerelictGLContext'

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



Joined: 05 Nov 2009
Posts: 19

PostPosted: Fri Nov 06, 2009 12:48 pm    Post subject: Compiling Problem : identifier 'DerelictGLContext' Reply with quote

When compiling DerelictGL, this repeats many times:

derelict/opengl/gl.d:216: Error: identifier 'DerelictGLContext' is not defined
derelict/opengl/gl.d:216: Error: DerelictGLContext is used as a type

I am now wondering if it is a problem with my toolchain, since I have a similar error compiling GtkD http://www.dsource.org/forums/viewtopic.php?t=4827

Any suggestions on where to look?

DSSS version 0.75
gcc version 4.1.3 20080428 (prerelease (gdc 0.24, using dmd 1.020))

FreeBSD 8.0-RC2[/url]
Back to top
View user's profile Send private message
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Sat Nov 07, 2009 6:34 am    Post subject: Reply with quote

Look at http://www.dsource.org/projects/derelict/browser/trunk/DerelictGL/derelict/opengl/gl.d line 52. There isn't any freebsd version statement. Do you know what it should be, same as linux ?
Back to top
View user's profile Send private message
tbone



Joined: 05 Nov 2009
Posts: 19

PostPosted: Sat Nov 07, 2009 10:37 am    Post subject: Reply with quote

Yeah, GLXContext should work.

I can't find that symbol directly in libGL.so, but it might dlopen another library.

Another note for FreeBSD that we ran into in gtkd was linking against -ldl, which isn't required for freebsd since dlopen() and family is in libc.
Back to top
View user's profile Send private message
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Sun Nov 08, 2009 5:02 am    Post subject: Reply with quote

I added a version statement for freebsd: http://www.dsource.org/projects/derelict/changeset/390
Back to top
View user's profile Send private message
tbone



Joined: 05 Nov 2009
Posts: 19

PostPosted: Sun Nov 08, 2009 11:43 am    Post subject: Reply with quote

hmm, its still bitching about GLXContext

It is in the headers, but isn't a symbol in the library, so I don't understand how D is suppose to find it (it works on my linux box which has (nearly) the same headers and libGL.so).

The only thing that I can figure that differs between the linux box and freebsd box is the location of the libraries. The linux box has them in /usr/lib, the freebsd box has them in /usr/local/lib
Back to top
View user's profile Send private message
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Sun Nov 08, 2009 2:11 pm    Post subject: Reply with quote

But it compiles now?
Back to top
View user's profile Send private message
tbone



Joined: 05 Nov 2009
Posts: 19

PostPosted: Sun Nov 08, 2009 2:12 pm    Post subject: Reply with quote

No, it doesn't.

That is why I was trying to figure out where D gets the symbols at compile time.
Back to top
View user's profile Send private message
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Sun Nov 08, 2009 2:35 pm    Post subject: Reply with quote

How about now?
Back to top
View user's profile Send private message
tbone



Joined: 05 Nov 2009
Posts: 19

PostPosted: Sun Nov 08, 2009 6:00 pm    Post subject: Reply with quote

Sweet, that compiles now
Back to top
View user's profile Send private message
aldacron



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

PostPosted: Sun Nov 08, 2009 7:25 pm    Post subject: Reply with quote

Good work, guys Very Happy I've always been curious if Derelict would work out of the box on FreeBSD. I suppose this answers that question!

@doob: I'm wondering about this line:
Code:

pragma(link, "c"); // the dl* functions are in libc on freebsd


Not that it hurts anything, but doesn't the compiler link libc in automatically? I assume you don't have a FreeBSD box to find out for sure. I suppose I should see about FreeBSD support in VirtualBox so I can get up to speed on this stuff.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
tbone



Joined: 05 Nov 2009
Posts: 19

PostPosted: Sun Nov 08, 2009 7:28 pm    Post subject: Reply with quote

Yeah, FreeBSD does link in libc automaticly, so the pragma isn't needed.

I haven't had a chance to test Derelict yet, I can only confirm it'll compile, which is half the problem of porting most of the time. When I get a chance to test it, I'll post here.
Back to top
View user's profile Send private message
tbone



Joined: 05 Nov 2009
Posts: 19

PostPosted: Sun Nov 08, 2009 9:47 pm    Post subject: Reply with quote

A quick patch to make stuff compile & link properly:

Code:

Index: DerelictUtil/derelict/util/loader.d
===================================================================
--- DerelictUtil/derelict/util/loader.d (revision 393)
+++ DerelictUtil/derelict/util/loader.d (working copy)
@@ -64,13 +64,7 @@
     // for people using DSSS, tell it to link the executable with libdl
     version(build)
     {
-        version (freebsd)
-        {
-               pragma(link, "c"); // the dl* functions are in libc on freebsd
-        }
-
-        else
-               pragma(link, "dl");
+       version(linux) pragma(link, "dl")
     }
 }

@@ -290,6 +284,9 @@
             }
             else version (linux) {
                 libNameString = linLibs;
+            }
+            else version(freebsd) {
+                libNameString = linLibs;
             }
             else version(darwin) {
                 libNameString = macLibs;


Although I think I'd change linLibs to nixLibs (following your other naming convention).


The problem I am having now is segfaults inside of the SDL library:

Code:

#0  0x080e3934 in SDL_ClearError ()
#1  0x2835b96f in SDL_Init () from /usr/local/lib/libSDL.so
#2  0x08093a13 in _D4main4initFZv ()
#3  0x08093aca in _Dmain ()
#4  0x080c0844 in _D9dgccmain211_d_run_mainUiPPaPUAAaZiZi2goMFZv ()
    at ../.././../gcc-4.1-20080428/libphobos/internal/dgccmain2.d:83
#5  0x080c0902 in _d_run_main (argc=1, argv=0xbfbfec5c, main_func=0x8093ab2 <_Dmain>)
    at ../.././../gcc-4.1-20080428/libphobos/internal/dgccmain2.d:93
#6  0x080bd348 in main (argc=205504, argv=0x0)
    at ../.././../gcc-4.1-20080428/libphobos/internal/cmain.d:5
Back to top
View user's profile Send private message
tbone



Joined: 05 Nov 2009
Posts: 19

PostPosted: Sun Nov 08, 2009 9:49 pm    Post subject: Reply with quote

The example I am trying to compile is from http://dmedia.dprogramming.com/?n=Tutorials.SdlGlTutorial3?action=sourceblock&ref=3
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