First Tutorial/Example Causing A Segfault
-
- Posts: 7
- Joined: Mon Jul 01, 2013 5:58 pm
First Tutorial/Example Causing A Segfault
Hi!
I have no idea what I've done wrong. It's all been set up correctly and it compiles fine, no warnings or errors.
The program gets as far as "IVideoDriver* driver = device->getVideoDriver();" before throwing up a segfault. Something there is causing it, and I'm concerned it's something to do with the pointer, but I don't see how it can be anything I've done...
All the other examples work fine, as do the different rendering modes, and I've tried changing EDT_SOFTWARE to others to test and I get the same result.
Currently I really don't have any idea how I can get more info on the problem, debug is being fiddly, I can isolate down to that line but can't get into the function call to see where it's going. If anyone has any ideas that'd be brilliant, otherwise I'm stuck forever! :p
Thanks, Jon.
I have no idea what I've done wrong. It's all been set up correctly and it compiles fine, no warnings or errors.
The program gets as far as "IVideoDriver* driver = device->getVideoDriver();" before throwing up a segfault. Something there is causing it, and I'm concerned it's something to do with the pointer, but I don't see how it can be anything I've done...
All the other examples work fine, as do the different rendering modes, and I've tried changing EDT_SOFTWARE to others to test and I get the same result.
Currently I really don't have any idea how I can get more info on the problem, debug is being fiddly, I can isolate down to that line but can't get into the function call to see where it's going. If anyone has any ideas that'd be brilliant, otherwise I'm stuck forever! :p
Thanks, Jon.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: First Tutorial/Example Causing A Segfault
Probably your device is not correctly created, and the pointer is simply void.
Re: First Tutorial/Example Causing A Segfault
Assuming he's doing exactly what's in the tutorial, that shouldn't be the case though, should it hybrid? It has the "if (!device) {return 1;}" in there, I think.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: First Tutorial/Example Causing A Segfault
Well, getVideoDriver simply returns the pointer from inside the device. The device might have a problem e.g. when running fullscreen with unsupported dimensions. This would also affect other drivers as well. But a more common cause could be a problem later on, where themodels are loaded. Maybe you use an optimized release version, which can lead to segfaults at different places
-
- Posts: 7
- Joined: Mon Jul 01, 2013 5:58 pm
Re: First Tutorial/Example Causing A Segfault
The setWindowCaption line seems to be nullifying the device, it seems... as potentially is addStaticText, getMesh... etc. later on.
So, looking like some sort of library access issue, or what?
So, looking like some sort of library access issue, or what?
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: First Tutorial/Example Causing A Segfault
In that case you either use the wrong dll, or at least some mismatching ones. If your head does not match your dll, code will access wrong areas and overwrite stuff in your data.
-
- Posts: 7
- Joined: Mon Jul 01, 2013 5:58 pm
Re: First Tutorial/Example Causing A Segfault
That's what I thought. Hmmm...
I have the most recent stable download and I'm obviously using the header in the include folder, and the libs and the dll from the gcc folder (I've gathered that's what I want if compiling with g++ although I may be making a terrible mistake...).
As a note I'm actually using Netbeans as my IDE.
Any glaringly obvious mistakes I've made there?
I have the most recent stable download and I'm obviously using the header in the include folder, and the libs and the dll from the gcc folder (I've gathered that's what I want if compiling with g++ although I may be making a terrible mistake...).
As a note I'm actually using Netbeans as my IDE.
Any glaringly obvious mistakes I've made there?
Re: First Tutorial/Example Causing A Segfault
Are you on linux? do you have more than one irrlicht on your computer? did you install the irrlicht dlls at some point? is maybe netbeans looking for headers or libs from the other version?
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
-
- Posts: 7
- Joined: Mon Jul 01, 2013 5:58 pm
Re: First Tutorial/Example Causing A Segfault
I'm actually on Win7, although I'd rather be running a Linux distro for this. No space on the drive for a separate partition though.
And no, I only have 1 single set of Irrlicht stuff. I've obviously just got the wrong thing somewhere, which is confusing me because there's only one single version of the header file, and I'm sure I have the right libs and dll to match...
And no, I only have 1 single set of Irrlicht stuff. I've obviously just got the wrong thing somewhere, which is confusing me because there's only one single version of the header file, and I'm sure I have the right libs and dll to match...
Re: First Tutorial/Example Causing A Segfault
I have tried several times to compile and run irrlicht 1.8 with mingw on Windows 7, but with many troubles. It always threw SEG_FAULT on every irrlicht function. Only solution - recompile engine from sources, and then use new dll and lib file. But in this case I didn't make it work with DirectX, only with OpenGL.
That is why now I using Visual Studio 2010 Express, and it works fine.
That is why now I using Visual Studio 2010 Express, and it works fine.
-
- Posts: 7
- Joined: Mon Jul 01, 2013 5:58 pm
Re: First Tutorial/Example Causing A Segfault
Thanks for that! That's the issue I'm experiencing, obviously, for whatever reason.
As far as I can read, if I want to recompile the engine to be compatible with DirectX I need to do more, but I'm happy recompiling it just to use OpenGL.
I hate to sound a total noob but I really don't have experience compiling full libraries, so I have no idea where I'd even start recompiling Irrlicht, and don't understand why that would help either. (Unless you're saying specifically recompiled with MinGW, in which case that would make sense. Still don't know how I'd go about that though.) I'm not a fan of Visual Studio.
Thanks so far for all your help, you've been great.
As far as I can read, if I want to recompile the engine to be compatible with DirectX I need to do more, but I'm happy recompiling it just to use OpenGL.
I hate to sound a total noob but I really don't have experience compiling full libraries, so I have no idea where I'd even start recompiling Irrlicht, and don't understand why that would help either. (Unless you're saying specifically recompiled with MinGW, in which case that would make sense. Still don't know how I'd go about that though.) I'm not a fan of Visual Studio.
Thanks so far for all your help, you've been great.
Re: First Tutorial/Example Causing A Segfault
Irrlicht can be compiled from sources very easy. Just checkout it from svn
svn://svn.code.sf.net/p/irrlicht/code/trunk
then in folder source/Irrlicht there are many preconfigured projects(for Visual Studio and Code::Block): Irrlicht.sln, irrlicht.cbp,Irrlicht10.0.vcxproj. Just open it with the IDE and press "build".
May be you should install DirectX9 SDK before compiling, if you want DirectX available...
that is all. After that in folder /bin/ you will find Irrlicht.dll and in folder /lib/ you will find ittlicht.lib files.
svn://svn.code.sf.net/p/irrlicht/code/trunk
then in folder source/Irrlicht there are many preconfigured projects(for Visual Studio and Code::Block): Irrlicht.sln, irrlicht.cbp,Irrlicht10.0.vcxproj. Just open it with the IDE and press "build".
May be you should install DirectX9 SDK before compiling, if you want DirectX available...
that is all. After that in folder /bin/ you will find Irrlicht.dll and in folder /lib/ you will find ittlicht.lib files.
-
- Posts: 7
- Joined: Mon Jul 01, 2013 5:58 pm
Re: First Tutorial/Example Causing A Segfault
Aha! I shall attempt to compile it using VS and report back on my progress.
Thank you very much... hopefully this will work.
EDIT: Well, I tried compiling but unfortunately it seems to be set up to use the DirectX stuff, so I'll either have to download that, or ask that someone sends me a fresh from-source irrlicht.h and irrlicht.dll and I see if they work. :\ No idea what MinGW's issue is, and I'd much rather use NetBeans than VS. I'm awkward.
Thank you very much... hopefully this will work.
EDIT: Well, I tried compiling but unfortunately it seems to be set up to use the DirectX stuff, so I'll either have to download that, or ask that someone sends me a fresh from-source irrlicht.h and irrlicht.dll and I see if they work. :\ No idea what MinGW's issue is, and I'd much rather use NetBeans than VS. I'm awkward.
Re: First Tutorial/Example Causing A Segfault
hi,
you also can uncomment #define _IRR_COMPILE_WITH_DIRECT3D_9_ in IrrCompileConfig.h to deactivate dx support if you dont need it.
regards
zerochen
you also can uncomment #define _IRR_COMPILE_WITH_DIRECT3D_9_ in IrrCompileConfig.h to deactivate dx support if you dont need it.
regards
zerochen
Re: First Tutorial/Example Causing A Segfault
You need to use a matching compiler and libs. Never use some downloaded DLL.