OpenGL odd link error

Hello there

I have really odd linking error in my cocos2dx_dir/cocos2dx/proj.linux/cocos2dx.mk
i have line:

SHAREDLIBS += -lglfw -lGLEW -lfontconfig -lpthread -lGL

When i want build my app for linux i have such linking error:

/usr/bin/ld: /home/.../linux/debug/libcocos2d.so: undefined reference to symbol 'glEnable'
/usr/bin/ld: note: 'glEnable' is defined in DSO /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/libGL.so so try adding it to the linker command line

But when i remove -lGL i don’t have any linking error and everything works fine i test it on 2 computers.

bump

Any one have such issue? I have this issue when i use CCTableView class

I have the same issue.
i got this fixed when I remove “-lGL” in cocos2dx/proj.linux/cocos2dx.mk.
this rule works fine with all the examples.
I’m using ubuntu 12.04 64bit.
I’m wondering why all the examples didn’t have this linking error excepts my project. My makefile was just copied and modified based on HelloCpp’s!

Hey, it’s a bug of ubuntu 64bit system.
How to Fix it:

cd /usr/lib/x86_64-linux-gnu/mesa
make sure that libGL.so port to the right library.

On my system, it’s

james@james-vm:/usr/lib/x86_64-linux-gnu$ ls -l libGL.so 
lrwxrwxrwx 1 root root 13 Oct  9  2012 libGL.so -> mesa/libGL.so
james@james-vm:/usr/lib/x86_64-linux-gnu$ cd mesa
james@james-vm:/usr/lib/x86_64-linux-gnu/mesa$ ls
ld.so.conf  libGL.so  libGL.so.1  libGL.so.1.2.0  libGL.so.8.0.18354.823166
james@james-vm:/usr/lib/x86_64-linux-gnu/mesa$ ls -l libGL.so
lrwxrwxrwx 1 root root 14 Oct  9  2012 libGL.so -> libGL.so.1.2.0
james@james-vm:/usr/lib/x86_64-linux-gnu/mesa$ ls -l libGL.so.1
libGL.so.1      libGL.so.1.2.0  
james@james-vm:/usr/lib/x86_64-linux-gnu/mesa$ ls -l libGL.so.1.2.0 
lrwxrwxrwx 1 root root 10 May  6 10:28 libGL.so.1.2.0 -> libGL.so.1
james@james-vm:/usr/lib/x86_64-linux-gnu/mesa$ ls -l libGL.so.1
lrwxrwxrwx 1 root root 25 Jan 22 12:37 libGL.so.1 -> libGL.so.8.0.18354.823166

Hi guys,

I am having a similar linkage error, but have not been able to resolve it

/usr/bin/ld: cocos2d-x-v3.0-pre-alpha0/lib/linux/debug/libextension.a(CCSkeleton.o): undefined reference to symbol 'glLineWidth'
/usr/bin/ld: note: 'glLineWidth' is defined in DSO /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libGL.so so try adding it to the linker command line
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libGL.so: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

I am not sure how to link this, this is what I have

mike@mike-laptop:/usr/lib/x86_64-linux-gnu/mesa
$ ls -l
total 376
-rw-r--r-- 1 root root     31 Jun 18 15:58 ld.so.conf
lrwxrwxrwx 1 root root     14 Jun 18 15:58 libGL.so -> libGL.so.1.2.0
lrwxrwxrwx 1 root root     14 Jun 18 15:58 libGL.so.1 -> libGL.so.1.2.0
-rw-r--r-- 1 root root 380808 Jun 18 15:58 libGL.so.1.2.0

Ok, now I’ve seemed to have messed something up that was working.

On a separate cocos2d-x project that wasnt including the Spine extension that was causing my error above, I can build but not run the app anymore (it was previously able to run)…

libGL error: failed to load driver: swrast
libGL error: Try again with LIBGL_DEBUG=verbose for more details.
cocos2d-x debug info [SDL Error: Unknown touch device, line: 90]
cocos2d-x debug info [Not totally ready :(]
cocos2d-x debug info [OpenGL 2.0 not supported]
cocos2d-x debug info [Assert failed: fail to init OpenGL extension ARB_vertex_buffer_object]
MyApp: ../platform/linux/CCEGLView.cpp:106: virtual void cocos2d::EGLView::setFrameSize(float, float): Assertion `0' failed.

I had made a symlink at /usr/lib/x86_64-linux-gnu/libGL.so.1 -> /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 attempting to fix my first issue, which it didn’t, so then I removed it, and now my system just crashes to a black screen and reboots my user account when I try to run my above app.

For anyone experiencing the same thing, this link describes some extra libs you need to install:

$ sudo apt-get install freeglut3 freeglut3-dev
$ sudo apt-get install binutils-gold

I am on Ubuntu 13.04 64bit