Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

g++ 4.6.3 crashes when building code on 64 bit server

I have been developing a C++ application to run on a 64 bit Ubuntu 12.04. I develop the code on my 32 bit 12.04 Ubuntu laptop, then upload it to a git repository, pull it on the server and build the pulled source natively.

Until recently things worked well and I had no problems but today g++ 4.6.3 crashed when I tried to compile on the 64 bit server and I got an output telling me to submit a crash report (g++ 4.6.3 is the same version I have on my development machine also). The identical code did not cause a crash on my dev machine.

I am not asking why it crashed, but I would like to know what the problem was if possible. Does g++ produce any file logs when it encounters problems? As far as I can tell my code is doing nothing controversial, I am not creating templates, I simply use a couple of boost libraries, mysql++, openssl and some static libraries I have written myself. I really need to run this application every day so I want to fix this as soon as I can. I can think of the following ways to deal with things

  1. Try and find out what aspect of my code caused the compiler to crash and rewrite my code accordingly.
  2. Rent another server.
  3. Upgrade (or downgrade) g++ or create an additional g++ on the server and try that. I am reluctant to do this as I have read that you can ruin your system when upgrading g++ on Ubuntu.
  4. I use Eclipse to build everything on my dev machine and simply build code on my server using the Eclipse generated makefile that I have made part of the git project - I could write my own makefile in case something in there is causing the crash on the 64 bit server.

I would really welcome advice on how to proceed. I am not an expert on how compilers work internally and this is the first time I have encountered this kind of error so I am not quite sure what to do next.

like image 988
mathematician1975 Avatar asked Feb 18 '26 09:02

mathematician1975


1 Answers

I would really welcome advice on how to proceed

One reason for a crash might be hardware problem (faulty disk, disk controller, memory, or something else). This is hard to detect.

Another reason might be a compiler bug, but very unlikely.

What you can do is :

  • check the hardware of the server (run all possible checks you can think of). Try to compile many times on a different machine
  • make sure your system is not running out of virtual memory
  • upgrade or change the compiler, and see if it happens

There are various article explaining that g++ can crash because of HW problems :

  • crash during compiling - Most likely there is nothing wrong with your installation, your compiler or kernel. It very likely has something to do with your hardware. There are two exceptions to this "rule". You could be running low on virtual memory, or you could be installing Red Hat 5.x, 6.x or 7.x
  • crash during optimization
like image 156
BЈовић Avatar answered Feb 20 '26 21:02

BЈовић



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!