Segmentation fault in Linux

nobody wrote on Sunday, April 17, 2005:

Hi I porting my Framework to Linux and after alot of trouble managed to get it to compile.

However i get a segmentation fault upon using glGetString(GL_VENDOR); The exact same code works and compiles fine in Windows. I have Also installed the latest ATI drivers and using fglrxinfo shows vendor as ATI which i assume is obtained through the use of glGetString(GL_VENDOR);

Could it be that GLFW is causing this to happen? Some GL Test programs which came with the drivers work fine.

marcus256 wrote on Sunday, April 17, 2005:

Sorry, but these are very vague pointers. It could be that GLFW is doing something wrong, but it could also be a number of other things. Just because it works on another system doesn’t mean that your code is right (that’s actually the worst assumption a programmer can make - yet we all do it, all the time…).

The best advice I can give is to use standard debugging practices (use breakpoints/printfs, change the order in which you do things, comment out your code to a bare minimum where you can reproduce the bug, etc. etc.) Then, IF you find that GLFW is causing your problems, I would be more than happy to correct the bug.

nobody wrote on Monday, April 18, 2005:

Alright thanks for replying, ill take a look at it, still investigating. Just out of curiosity, what are the exact libraries i should link to in Linux? Someone mentioned that multiple libraries might be causing this problem.

I am using ATI Radeon 9600 and have installed the latest drivers. Im have this feeling that Linux does not have the same functionality as the OpenGL32.dll in Windows which automatically uses the ICD if available before falling back to Software. Perhaps im just linking it with the wrong stuff?

nobody wrote on Monday, April 18, 2005:

Alright i solved the problem, i was just linking with the wrong library files. After taking a look at your Tutorial for linux, and linking with those files, i got it working!

However, some minor issues/questions remain.
1) When i attempt to create a fullscreen window, the resolution of the screen does not change, only the drawing area resolution changes.
Pic:
http://img217.echo.cx/my.php?image=fullscreenproblem1ab.jpg

2)Im using the codeBlocks IDE in Linux and when i link to glfw using -lglfw, the linker doesnt complain but gives me undefined references to all the glfw functions. It could be a CodeBlocks issue i guess. But everything else used with -l seems to work fine.

3)(Linux Question) If i were to distribute the executable, would people with nVidia cards/diff ATI cards still recieve hardware acceleration or are they required to link to the GL.a provided by their driver?

Once again thanks for making cross-platform a reality for me. I would never have bothered with doing OS specific code myself to port my library, i would probably have gone the all Windows route and stuck to C#/DX and locked myself away from all other platforms.

marcus256 wrote on Friday, April 22, 2005:

I’m not sure if I can answer all questions, but I’ll try…

1) Interesting. Two questions: does compile.sh (run by ‘make x11’) report that the XFree86VidMode extension is supported? Is your system a laptop or a multi-monitor system?

2) Not sure. Sorry. Have you placed libglfw.a in your lib path so that the compiler can find it?

3) The exe should work. You do -lGL, which links with a shared library, meaning that whatever libGL.so is available on the target system will be used. I also try to make GLFW as binary compatible as possible across different Linux distros (e.g. the VidMode extension is queried at run time - which may actually be what’s failing in your first question).

nobody wrote on Friday, April 22, 2005:

1) Well i cant remember. I only remember downloading my drivers by installing some XOrg package which i understand is an extension of the XFree86.

It’s a desktop using Radeon 9600 which i think supports multi-monitor.

2) Well libglfw.a is in my usr/lib folder. Also if the library was not found, the linker/compiler wld usually give me a file not found error, but in this case, it just gives me linking errors.
But if i link directly to the libglfw.a file, all is fine.

3)So is this something which is not supported in GLFW or is it bcos im doing something wrong. Im a total noob to Linux.