PDA

View Full Version : g++ hangs while compiling large c++ source file



vikas.sood
March 17th, 2014, 08:36 AM
Hi All,

I am trying to access the eBay webservices with gSoap toolkit using c++.

1. I run the wsdl2h tool
wsdl2h -I ../../packages/gsoap-2.8/gsoap/WS/ -f -k -o eBaySvc.h ./eBaySvc.wsdl

eBay wsdl can be downloaded from "https://developer.ebay.com/webservices/latest/ebaySvc.wsdl"

2. I run the soapcpp2 tool
soapcpp2 -C -L -I ../../packages/gsoap-2.8/gsoap/import -I ../../packages/gsoap-2.8/gsoap/custom -w -x eBayScv.h

The soapC.cpp file generated is 18 M in size. It basically contains xml serialization code generated by gSoap. The trouble begins when i compile the code.

g++ just hangs up and never quits compiling this file. May be it runs out of memory but when i see with top command enough swap seems to be free.

I tried compiling with --param ggc-min-expand=0 --param ggc-min-heapsize=8192 (i did some search on google) but no luck. and result is still the same.

My dev environment is Ubuntu 12.04 64 bit ruuning as a virtual machine. But i compile all my code with -m32. All works well untill i ran into trying to access ebay service.

I think the problem is g++ trying to compile a very large c++ source file.

Has anyine else faced this kind of problem? Any solutions?

Regards,
Vikas Sood

spjackson
March 18th, 2014, 01:32 PM
I downloaded that wsdl and followed the same steps as you (except I'm using gsoap from the repository with /usr/include/gsoap). I got a source file soapC.cpp of 18,141,535 bytes. soapC.cpp was successfully compiled in 3m 12s, but during the compilation, the compiler reached a maximum virtual size of 1.8GB.

I did this on a 7 year old machine with 2GB ram running Ubuntu 10.04 64-bit (and compiled for 64-bit).

Based on experience from the depths of time, I'd would say that if the compilation of a single translation unit requires more than your physical ram, such that the compiler is forced to swap, then you are in trouble.

How much ram have you allocated to your VM? If it's less than 2GB, can you increase it?

I could do some more experiments if you provide more details about your set up (Ubuntu version etc.)