libGL problem in RenderStarlanes(), RenderSystems() and Init

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Post Reply
Message
Author
Farmer
Krill Swarm
Posts: 13
Joined: Thu Feb 21, 2008 11:47 pm

libGL problem in RenderStarlanes(), RenderSystems() and Init

#1 Post by Farmer »

Hi!

Ok, i just updated to the newest svn-version (2594) and configured, built and installed GiGi and configured freeorion without any problems. But when i try to build freeorion, i get this:

Code: Select all

g++ -o freeorion -pthread combat/Combat.o Empire/Empire.o Empire/EmpireManager.o Empire/ResourcePool.o network/Message.o network/MessageQueue.o network/Networking.o network/boost/error_code.o UI/StringTable.o universe/Building.o universe/Condition.o universe/ConditionParser1.o universe/ConditionParser2.o universe/ConditionParser.o universe/Effect.o universe/EffectParser.o universe/Enums.o universe/Fleet.o universe/Meter.o universe/ParserUtil.o universe/Planet.o universe/PopCenter.o universe/Predicates.o universe/ResourceCenter.o universe/Ship.o universe/ShipDesign.o universe/Special.o universe/System.o universe/Tech.o universe/TopLevelParsers.o universe/UniverseObject.o universe/ValueRef.o universe/ValueRefParser.o util/DataTable.o util/GZStream.o util/MultiplayerCommon.o util/OptionsDB.o util/Order.o util/OrderSet.o util/Process.o util/Random.o util/Serialize.o util/SitRepEntry.o util/VarText.o util/Version.o util/binreloc.o util/Directories.o util/XMLDoc.o client/ClientApp-human.o client/ClientFSMEvents-human.o client/human/HumanClientFSM-human.o client/human/HumanClientApp-human.o client/human/HumanClientAppSoundOpenAL-human.o client/human/chmain-human.o network/ClientNetworking-human.o UI/About-human.o UI/BuildDesignatorWnd-human.o UI/ClientUI-human.o UI/CUIControls-human.o UI/CUIDrawUtil-human.o UI/CUIStyle-human.o UI/CUIWnd-human.o UI/FleetButton-human.o UI/FleetWnd-human.o UI/GalaxySetupWnd-human.o UI/InGameMenu-human.o UI/InfoPanels-human.o UI/IntroScreen-human.o UI/LinkText-human.o UI/CombatWnd-human.o UI/MapWnd-human.o UI/MultiplayerLobbyWnd-human.o UI/OptionsWnd-human.o UI/DesignWnd-human.o UI/ProductionWnd-human.o UI/ResearchWnd-human.o UI/ServerConnectWnd-human.o UI/SidePanel-human.o UI/SitRepPanel-human.o UI/SystemIcon-human.o UI/TechTreeWnd-human.o UI/TurnProgressWnd-human.o universe/Universe-human.o util/AppInterface-human.o UI/EncyclopediaDetailPanel-human.o -L/usr/lib -L/usr/local/lib -L/usr/lib/graphviz -lpython2.5 -lGiGiSDL -lIL -lILU -lGiGi -lboost_signals-gcc41-mt-1_34_1 -lboost_filesystem-gcc41-mt-1_34_1 -lboost_thread-gcc41-mt-1_34_1 -lGL -lGLU -lfreetype -lz -lSDL -lboost_serialization-gcc41-mt-1_34_1 -lboost_iostreams-gcc41-mt-1_34_1 -lboost_python-gcc41-mt-1_34_1 -lopenal -lalut -lvorbisfile -lvorbis -lm -logg -lgraph -lcdt -lgvc -llog4cpp -lnsl -llog4cpp
UI/MapWnd-human.o: In function `MapWnd::RenderStarlanes()':
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1846: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1852: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1824: undefined reference to `glBindBuffer'
UI/MapWnd-human.o: In function `MapWnd::RenderSystems()':
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1759: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1765: undefined reference to `glBindBuffer'
UI/MapWnd-human.o:/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1782: more undefined references to `glBindBuffer' follow
UI/MapWnd-human.o: In function `MapWnd::InitTurn(int)':
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1048: undefined reference to `glDeleteBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1059: undefined reference to `glDeleteBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1070: undefined reference to `glDeleteBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1123: undefined reference to `glGenBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1124: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1128: undefined reference to `glBufferData'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1145: undefined reference to `glGenBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1146: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1150: undefined reference to `glBufferData'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1167: undefined reference to `glGenBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1168: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1172: undefined reference to `glBufferData'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1240: undefined reference to `glGenBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1241: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1245: undefined reference to `glBufferData'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1253: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1222: undefined reference to `glGenBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1223: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1227: undefined reference to `glBufferData'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1204: undefined reference to `glGenBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1205: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1209: undefined reference to `glBufferData'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1186: undefined reference to `glGenBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1187: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1191: undefined reference to `glBufferData'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1079: undefined reference to `glDeleteBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1095: undefined reference to `glDeleteBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1087: undefined reference to `glDeleteBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1103: undefined reference to `glDeleteBuffers'
collect2: ld returned 1 exit status
scons: *** [freeorion] Error 1
scons: building terminated because of errors.
Kroddn told me that might happen due to a missing -lGL and it doesnt find the libGL, which is, of course, installed:

Code: Select all

sudo find / -name '*libGL.so*'
Password:
/usr/lib/libGL.so.1
/usr/lib/fglrx/libGL.so.1.xlibmesa
/usr/lib/fglrx/libGL.so.1.2.xlibmesa
/usr/lib/libGL.so.1.2
/usr/lib/libGL.so
Despite adding the -lGL manually, the same error occures...

Do you have any ideas what could be the cause for this?

tzlaine
Programming Lead Emeritus
Posts: 1092
Joined: Thu Jun 26, 2003 1:33 pm

Re: libGL problem in RenderStarlanes(), RenderSystems() and Init

#2 Post by tzlaine »

AFAIK, the Mesa GL implementation does not include those functions (it is GL version 1.3 or so). You need to actually install the appropriate driver for your video card, which will provide a libGL with a more complete implementation (you need GL version 1.5 or later).

Farmer
Krill Swarm
Posts: 13
Joined: Thu Feb 21, 2008 11:47 pm

Re: libGL problem in RenderStarlanes(), RenderSystems() and Init

#3 Post by Farmer »

I am not sure whether i understood you right, but i am not using the mesa drivers. I have installed the latest available fglrx-driver for my video card...otherwise i wouldnt be able to play tremulous ;-)
And freeorion did run some revisions ago. Maybe i just messed up the libGL-versions?

EDIT: btw...how do i see the actual version of libLG, since its not an installable packet?

tzlaine
Programming Lead Emeritus
Posts: 1092
Joined: Thu Jun 26, 2003 1:33 pm

Re: libGL problem in RenderStarlanes(), RenderSystems() and Init

#4 Post by tzlaine »

Run glxinfo. Somewhere in the top 15 lines or so, you should see OpenGL version: [your version here]. If it is < 1.5, you need to update your drivers, whether you're using Mesa or something else. FO's code changed to use some OpenGL 1.5 functions, which is why it has stopped working for you.

User avatar
kroddn
Static Linker
Posts: 347
Joined: Thu Jun 28, 2007 10:28 am

Re: libGL problem in RenderStarlanes(), RenderSystems() and Init

#5 Post by kroddn »

Reinstall the fglrx drivers. Maybe the distribution update system has installed mesa libs over the fglrx ones.

Farmer
Krill Swarm
Posts: 13
Joined: Thu Feb 21, 2008 11:47 pm

Re: libGL problem in RenderStarlanes(), RenderSystems() and Init

#6 Post by Farmer »

Code: Select all

OpenGL version string: 2.0.6334 (8.34.8)
Mhh...its that?

tzlaine
Programming Lead Emeritus
Posts: 1092
Joined: Thu Jun 26, 2003 1:33 pm

Re: libGL problem in RenderStarlanes(), RenderSystems() and Init

#7 Post by tzlaine »

If you have GL version 2.0, you should be fine with your current drivers. Now you just need to make sure you link the right libGL into FreeOrion. Look at the output of ldd on freeorion and glxinfo.

Code: Select all

ldd `which glxinfo`
and

Code: Select all

ldd freeorion
should match. If not, that's your problem. Fixing it is up to you, I'm afraid.

User avatar
loonycyborg
Compilation Expert
Posts: 219
Joined: Thu Jul 06, 2006 10:30 pm
Location: Russia/Moscow

Re: libGL problem in RenderStarlanes(), RenderSystems() and Init

#8 Post by loonycyborg »

Although fglrx may support OpenGL 2.0, it may provide it only through OpenGL extensions mechanism. IMO GLEW should be used on all platforms, not only on windows..
In Soviet Russia, forum posts YOU!!

User avatar
kroddn
Static Linker
Posts: 347
Joined: Thu Jun 28, 2007 10:28 am

Re: libGL problem in RenderStarlanes(), RenderSystems() and Init

#9 Post by kroddn »

tzlaine wrote:

Code: Select all

ldd freeorion
should match. If not, that's your problem. Fixing it is up to you, I'm afraid.
He will not be able to do that, because he does not get a working binary ;-)

Try the latest statically linked version!

On my system:

Code: Select all

(etch)root@buero2:/data1/archiv/games/freeorion/FreeOrion.ok# dpkg -S /usr/lib/libGL.so
libgl1-mesa-dev: /usr/lib/libGL.so
So, installing mesa is okay.

Farmer
Krill Swarm
Posts: 13
Joined: Thu Feb 21, 2008 11:47 pm

Re: libGL problem in RenderStarlanes(), RenderSystems() and Init

#10 Post by Farmer »

Code: Select all

ldd freeorion/FreeOrion/freeorionca | grep libGL
        libGL.so.1 => /usr/lib/libGL.so.1 (0xb7a06000)

Code: Select all

ldd `which glxinfo` | grep libGL
        libGL.so.1 => /usr/lib/libGL.so.1 (0xb7e59000)

Code: Select all

dpkg -S /usr/lib/libGL.so.1
Umleitung durch xorg-driver-fglrx von: /usr/lib/libGL.so.1
Umleitung durch xorg-driver-fglrx zu: /usr/lib/fglrx/libGL.so.1.xlibmesa
xorg-driver-fglrx, libgl1-mesa-glx: /usr/lib/libGL.so.1
EDIT: I tried the statically linked version (2595) and got this after starting a new game:

Code: Select all

./freeorion: symbol lookup error: ./freeorion: undefined symbol: glGenBuffers
EDIT: No further comments on this?

Farmer
Krill Swarm
Posts: 13
Joined: Thu Feb 21, 2008 11:47 pm

Re: libGL problem in RenderStarlanes(), RenderSystems() and Init

#11 Post by Farmer »

Since there is not so much going on lately in this section, i may push this a little bit. I updated my fglrx drivers from 8.34.8 to 8.37.6 and OpenGL from 2.0.6334 to 2.0.6473....still the same error in the vpn version and the statically linked:

Code: Select all

UI/MapWnd-human.o: In function `MapWnd::RenderStarlanes()':
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1838: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1844: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1817: undefined reference to `glBindBuffer'
UI/MapWnd-human.o: In function `MapWnd::RenderSystems()':
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1752: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1758: undefined reference to `glBindBuffer'
UI/MapWnd-human.o:/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1775: more undefined references to `glBindBuffer' follow
UI/MapWnd-human.o: In function `MapWnd::InitTurn(int)':
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1043: undefined reference to `glDeleteBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1054: undefined reference to `glDeleteBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1065: undefined reference to `glDeleteBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1118: undefined reference to `glGenBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1119: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1123: undefined reference to `glBufferData'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1140: undefined reference to `glGenBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1141: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1145: undefined reference to `glBufferData'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1098: undefined reference to `glDeleteBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1162: undefined reference to `glGenBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1163: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1167: undefined reference to `glBufferData'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1090: undefined reference to `glDeleteBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1074: undefined reference to `glDeleteBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1082: undefined reference to `glDeleteBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1235: undefined reference to `glGenBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1236: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1240: undefined reference to `glBufferData'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1248: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1217: undefined reference to `glGenBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1218: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1222: undefined reference to `glBufferData'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1199: undefined reference to `glGenBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1200: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1204: undefined reference to `glBufferData'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1181: undefined reference to `glGenBuffers'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1182: undefined reference to `glBindBuffer'
/home/runge/freeorion/FreeOrion/UI/MapWnd.cpp:1186: undefined reference to `glBufferData'
Im still wondering, why its only grumping about the three objects: glBindBuffer, glBufferData and glGenBuffers....but nothing else? i believe you are using more than these 3 from openGL in freeorion? And all have a "Buffer" in their name...

If you have any idea what could be wrong, i would be very pleased to hear it - and if you need more info, say it please...or just tell me where i find a forum that would suit my question :(

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: libGL problem in RenderStarlanes(), RenderSystems() and Init

#12 Post by Geoff the Medio »

As far as I know, yhe buffer-related stuff was added in later versions of OpenGL than the rest of the gl commands used in FO. You appear to have a new enough version, though I don't know much about such issues in linux.

Regardless, you could try making some modifications to the code and rebuilding it. In MapWnd.ccp, there are a number of preprocessor blocks like so:

#ifdef FREEORION_WIN32
...
#else
...
#endif

For example, starting at line 1110 of MapWnd.cpp :

Code: Select all

#ifdef FREEORION_WIN32
        glGenBuffersARB(1, &name);
        glBindBufferARB(GL_ARRAY_BUFFER_ARB, name);
        glBufferDataARB(GL_ARRAY_BUFFER_ARB,
                        it->second.size() * sizeof(float),
                        &it->second[0],
                        GL_STATIC_DRAW_ARB);
#else
        glGenBuffers(1, &name);
        glBindBuffer(GL_ARRAY_BUFFER, name);
        glBufferData(GL_ARRAY_BUFFER,
                     it->second.size() * sizeof(float),
                     &it->second[0],
                     GL_STATIC_DRAW);
#endif
The win32 version use altered names for the functions that you're having issues with. You probably don't want to actually define FREEORION_WIN32, but you might edit out all the #ifdef blocks to use the version that is used if FREEORION_WIN32 is defined. This might help get things working or compiling... Or not. It's probably worth a try though.

Farmer
Krill Swarm
Posts: 13
Joined: Thu Feb 21, 2008 11:47 pm

Re: libGL problem in RenderStarlanes(), RenderSystems() and Init

#13 Post by Farmer »

Thanks for the tip, i will try it after the weekend!

User avatar
loonycyborg
Compilation Expert
Posts: 219
Joined: Thu Jul 06, 2006 10:30 pm
Location: Russia/Moscow

Re: libGL problem in RenderStarlanes(), RenderSystems() and Init

#14 Post by loonycyborg »

You can also try using GLEW.
1. apt-get install libglew-dev
2. Include glew.h unconditionally:
Edit all files that have

Code: Select all

#ifdef FREEORION_WIN32
#include <GL/glew.h>
#endif
change it to

Code: Select all

#include <GL/glew.h>
3. Add -lGLEW to linker flags.
In Soviet Russia, forum posts YOU!!

Post Reply