I'm developing an embedded device controlled by a python2.7 script. And I need to compile the source for both security (I don't want device users to mess with my sources) and performance (I'm working on an BeagleBone Black, ARM microPC, and it's pretty short on CPU/RAM).
I'm using Nuitka python compiler for this. I've tried compiling separate modules of my application and it works fine, I can transparently replace random .py with it's compiled .so analogue and it all works fine.
Yet if I try to compile whole application into solid blob - it doesn't work. Meaning that Nuitka compiles whole application with no problem, but when I try to run the resulting binary - I get Segmentation fault and that's it. No debug output, no clues on what's wrong.
So, any idea what is wrong with this thing and why it doesn't work?
Or at least how can I debug it and figure out why this segfault happens?
Did you try taking a look at the core file? That should give you an idea where the segmentation fault is happening.
Related
The program is a custom developed user interface and calculation tool built-in c++ and QT, it uses unfortunately a lot of different components, And I can't tell what's failing because of the nondescriptness of the error code.
Program compiles just fine and was working perfectly well before the update, unfortunately, this is a project I've been working on for quite a while and is quite large.
Thank you
Sorry for such an inane question
EDIT:
as for running it with a debugger, it does not get to that point, the program starts to launch, then dies with that error message, thank you
Edit:
code was 100% fine before the update, so was looking for advice, sorry
Looks like STATUS_INVALID_IMAGE_FORMAT to me. So it failed trying to load the *.exe file or some *.dll dependency.
To figure out which binary it had trouble loading you can use Gflags to enable loader snaps for your *.exe file.
Then when you start your exe file from within a debugger like WinDbg it should output the loader debugging info.
I would like to point out that I am still learning and it could be something obvious that I am missing.
But to the point:
For my assignment, we had to make a simple game that would display an interactive scene.
So I wrote all the code on my computer and everything works fine, the code compiles and the program runs exactly as intended.
I've decided to move it to my laptop because it is due tomorrow and now I got a problem.
When I try to compile exactly the same code, visual studio shows me an error at line:
_programID = glCreateProgram();
Which works perfectly fine on my desktop.
It says "Exception thrown at 0x00000000 in Project.exe: 0x00000005: Access violation executing location 0x00000000."
The code is literally the same on both machines.
Both machines use windows 10 and exactly the same version of visual studio.
I have also linked my libraries relative to the solution directory so it is not a problem with a wrong path.
What could be the case? I really don't understand why is this happening. I have copied the entire folder with all the libraries and additional header files that I use along with the project.
I thought maybe it is because I am using libraries compiled on my desktop? Does that matter?
Please help.
I write this in case somebody had a similar problem in the future:
The problem was with my graphics card driver on the laptop. After my last format I didn't install the drivers (didn't really think about it since I use my laptop only for office and simple visual studio stuff) and that was causing OpenGL functions to throw errors. Installing drivers fixed the problem.
Thank you very much #Humam Helfawi.
I'm running a c++ program from R using Rcpp and RcppArmadillo. My OS is windows 8. I use the cxxfunction to compile my code (Later I'll make a package directly instead, but for now I'm clueless about how to make a package). The issue is that R often crash while running my c++ code. There must be some segmentation faults because often it doesn't exactly crash at the same spot even with the same seed. Currently, I'm printing out stuff to the prompt but I feel like this is not the most efficient way to debug my program.
So I read a bit about how to debug c++ code in R and it seems that gdb is a good way to do it. So I downloaded mingwin32 which contains gdb for windows. When I run R using gdb it works fine and I can run all my code fine but when R crash gdb backtrace function returns 'no trace'. I have no idea why. I heard people say to add the option -g -Oo in the compilation, but I'm using cxxfunction to compile my c++ program and I don't know how to compile manually things in R. I also heard some people talk about changing cxxflags but I don't really understand what that is and how to change it.
So my questions are :
Should I use gdb or something else?
How do I get gdb to work with my R program?
Should I install linux on a separate partition to make everything simpler?
Thanks for the help.
I have written a C++ code that uses some of the Qt static libraries.
I compile the code using MSVS2010 (on Windows 7) and then run the created .exe-file on a second machine.
I have compiled the exact same code on the same machine 2 different times and the .exe code that is generated crashes on the second machine when that machine's (Windows XP) screen saver starts, I have compiled the same code another time (nothing has changed in the code or the compiler or its settings) and the generated .exe-file does work fine.
Has anybody an idea on what can cause this?
Is there a way I can debug this issue?
Could the fact that at different times maybe different other programs are open affect the compilation?
The problem is not with the compilation process (it will always produce the same binary provided you didn't change the sources) but with the execution environment.
There seems to be something on your second machine that makes your program crash intermittently (or it could well be that it has nothing to do with that second machine, and that your program crashes intermittently everywhere). To debug that, you may end up having to install a debugging environment on the second machine and hope the problem arises again, or you could also try to reproduce the crash on your development machine.
I'm really lost in here. Maybe some of you can point me to a right direction.
I'm developing a tool in ANSI C using GCC over MinGW. The tool is to be run only from command line. Probably only on windows machine. It elaborates some data locally and generates files for use by other programs. Basically it does a lot of math and a few file handling. Nothing really fancy. I didn't find it necessary posting the whole 1000+ lines here for examination...
I compile it with GCC -ansi making sure not even a single warning is present. Everything worked always well as the development evolved. But recently I started getting (almost) random segfaults. I checked for the last changes made, but found nothing. I removed the last changes completely coming back to when it perfectly worked. Still segfaults. I traced line by line. I went back to read and re-read the whole code searching for possible pointers/malloc errors. I simply can't find the reason for it to fail so often and so randomly.
So here is the strange thing - I compiled it with -g and run through GDB.
start MSYS
change dir where the program resides
$ gdb generatore.exe (the one compiled -g that fails)
$ run
And it perfectly works inside GDB. I went step by step. Line by line. Perfect. I tried stressing it with huge amounts of data. All works. Can't reproduce the error. But if the same executable is run from command line, it fails.
I suspect an unpredictable behavior with some pointer but I cannot find it anywhere.
Has anyone ever encountered anything similar? Where should I be checking? Also, I am not as familiar with GDB, since it runs smoothly, can I enforce the control somehow to find the reason it fails? Are any other free debugging solutions for windows you can advise me? How can I debug for unpredictable behaviors?
Thanks a lot for your attention,
maxim
There is a great free tool for catching all kind of runtime errors to do with pointers, memory allocations, deallocations, etc., which cannot be caught at compile time, so your compiler will not warn you about them: valgrind http://valgrind.org/. The problem is, AFAIK it doesn't run on Windows. However, if your program is pure ANSI C you should be able to build it and run it with valgrind on a Linux box.
I'm not 100% sure about it, but it should run OK in a virtual machine, so if you don't have a separate Linux computer you can try installing e.g. Ubuntu in Virtual Box or VmWare and try running your program with valgrind in it.