Creating STL exception leads to segfault

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
atomaki
Posts: 7
Joined: Tue Mar 22, 2016 5:56 am

Re: Creating STL exception leads to segfault

Post by atomaki »

My bad, I had to test plain openGL application before asking here...
Problem is not related to Irrlich. I've got same results (segfault before main) with application compiled only with -lGL -lglut.

Yes, my CPU is 32-bit

Code: Select all

~/$ uname -a
Linux g 3.13.0-83-generic #127-Ubuntu SMP Fri Mar 11 00:26:47 UTC 2016 i686 i686 i686 GNU/Linux
 

Code: Select all

$ cat main3.cc 
#include <stdexcept>
#include <GL/glut.h>
 
int main(int argc, char** argv){
if (argc != 1) {
  throw std::runtime_error("err");
}
glutInit(&argc, argv);
return 0;
}
 

Code: Select all

$ g++ -g -O0 -Wall -Wextra -std=c++11  -o main main3.cc -lGL -lglut && ./main
Segmentation fault (core dumped)
 

Code: Select all

(gdb) r
Starting program: /home/j/github/space-game/main 
 
Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) bt full
#0  0x00000000 in ?? ()
No symbol table info available.
#1  0xb5d3dfe1 in init () at dlerror.c:177
No locals.
#2  0xb5d3e42e in _dlerror_run (operate=operate@entry=0xb5d3de10 <dlsym_doit>, args=args@entry=0xbffff160) at dlerror.c:129
        result = <optimized out>
#3  0xb5d3de98 in __dlsym (handle=0x0, name=0xb7c9cfe5 "posix_memalign") at dlsym.c:70
        args = {handle = 0x0, name = 0xb7c9cfe5 "posix_memalign", who = 0xb7c794bc, sym = 0x0}
        result = <optimized out>
#4  0xb7c794bc in ?? () from /usr/lib/nvidia-304/libGL.so.1
No symbol table info available.
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
 
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Creating STL exception leads to segfault

Post by hendu »

And so confirming it's Nvidia.
atomaki
Posts: 7
Joined: Tue Mar 22, 2016 5:56 am

Re: Creating STL exception leads to segfault

Post by atomaki »

True. Looks like a bug related to NVidia. I've found sworkaround on this site: https://bugs.launchpad.net/ubuntu/+sour ... ug/1248642
(post #18)

explicitly specifying the path to NVIDIA's libGL using gcc's -L flag:

Code: Select all

 
g++ -g -O0 -Wall -Wextra -std=c++11  -o main main3.cc -L/usr/lib/nvidia-304/ -lGL -lglut
 
in this case app runs fine, no segfaults.

I'm very appreciate your help, guys! Thanks
Post Reply