Horde3D

Next-Generation Graphics Engine
It is currently 23.02.2025, 13:49

All times are UTC + 1 hour




Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
PostPosted: 05.11.2008, 01:58 
Offline

Joined: 19.03.2008, 01:22
Posts: 79
All the internal Horde module state is stored in global variables as pointers. See egModules.cpp.


Top
 Profile  
Reply with quote  
PostPosted: 05.11.2008, 07:44 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
But those modules are initialized using a call to Modules::init, not using a static constructor. So this shouldn't be a problem as long as nobody calls init using a static constructor call, should it.


Top
 Profile  
Reply with quote  
PostPosted: 22.05.2009, 16:49 
Offline

Joined: 21.05.2009, 17:15
Posts: 2
Ok, i had the same problem and i solved it.
Just replace the extension loading code utOpengl.{cpp,h} with glew.
Patch for review purposes attached.


Attachments:
glew.patch [31.09 KiB]
Downloaded 916 times
Top
 Profile  
Reply with quote  
PostPosted: 22.05.2009, 23:09 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
smog wrote:
Ok, i had the same problem and i solved it.
Just replace the extension loading code utOpengl.{cpp,h} with glew.
Patch for review purposes attached.
That is perhaps a tad drastic...

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 24.05.2009, 21:08 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
If GLEW works it can't be so difficult to fix the problem. Unfortunately I can't help finding it since I don't have Linux running.


Top
 Profile  
Reply with quote  
PostPosted: 09.02.2010, 02:50 
Offline

Joined: 27.09.2008, 07:34
Posts: 35
The same stupid workaround works for me, Linux x86/x86_64, Slackware 13.0.


Top
 Profile  
Reply with quote  
PostPosted: 10.02.2010, 07:09 
Offline

Joined: 27.09.2008, 07:34
Posts: 35
I posted the question to GCC mailing list.


Top
 Profile  
Reply with quote  
PostPosted: 11.02.2010, 02:31 
Offline

Joined: 27.09.2008, 07:34
Posts: 35
And also to a more appropriate Binutils maling list.


Top
 Profile  
Reply with quote  
PostPosted: 11.02.2010, 15:36 
Offline

Joined: 27.09.2008, 07:34
Posts: 35
I've run gdb on h3dInit() call which causes the failure.
It appeared that call to glXGetProcAddressARB("glCreateShader") returns 0 when -lGL is the first, and a correct address when -lHorde3D is the first. The function is located in -lGL.
I wonder how this can cause the problem.


Top
 Profile  
Reply with quote  
PostPosted: 11.02.2010, 17:35 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
kornerr wrote:
I've run gdb on h3dInit() call which causes the failure.
It appeared that call to glXGetProcAddressARB("glCreateShader") returns 0 when -lGL is the first, and a correct address when -lHorde3D is the first. The function is located in -lGL. I wonder how this can cause the problem.
It is another manifestation of the same issue we were discussing on the QT thread. Linux/unix linkers are *really* pedantic about link order.

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 11.02.2010, 18:11 
Offline

Joined: 27.09.2008, 07:34
Posts: 35
Can you please be more concrete? Or point me to the docs?


Top
 Profile  
Reply with quote  
PostPosted: 11.02.2010, 20:02 
Offline

Joined: 15.06.2008, 11:21
Posts: 166
Location: Germany
Well, we maybe could try to resolve the libGL functions (e.g. glXGetProcAddressARB) via dlsym at runtime though.

http://www.opengroup.org/onlinepubs/009 ... dlsym.html

Maybe that way one can work around that issue. Just a guess.


Top
 Profile  
Reply with quote  
PostPosted: 12.02.2010, 04:29 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
kornerr wrote:
Can you please be more concrete? Or point me to the docs?
I don't have a reference to docs - it is something I learned in a compiler theory course a couple of years back, and subsequently ran afoul of in my own programming.

Basically, if you are using a single-pass linker (which you generally will be on linux), then the linker has to see references *before* it sees the actual symbol you are referencing. Since libHorde3D references symbols in libGL, -lHorde3D has to be specified before -lGL on link command line.

As phoenix64 mentioned, the dynamic linker doesn't suffer from this. IIRC, this is because you are always loading the referenced symbol into the referencing application.

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 12.02.2010, 15:34 
Offline

Joined: 15.06.2008, 11:21
Posts: 166
Location: Germany
Quote:
As phoenix64 mentioned, the dynamic linker doesn't suffer from this. IIRC, this is because you are always loading the referenced symbol into the referencing application.


In this case we are 100% using the dynamic linker.


Top
 Profile  
Reply with quote  
PostPosted: 12.02.2010, 21:34 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
phoenix64 wrote:
Well, we maybe could try to resolve the libGL functions (e.g. glXGetProcAddressARB) via dlsym at runtime though.
In all implementations I am aware, the OpenGL extension mechanism is just a thin wrapper around dlsym. I am not quite clear what you expect to gain by double indirection here?
phoenix64 wrote:
In this case we are 100% using the dynamic linker.
Yes, we should be, and if that is indeed the case, then I am not quite sure why this issue is present. However, since changing the link order fixes the issue, clearly there is some linker interaction occurring here that we don't realise.

Perhaps it is a side effect of prelinking? Or maybe the dynamic linker is loading in the wrong order and not correctly patching up the earlier symbol table entries?

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 95 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group