Visit Our UNIX and Linux User Community


Help with Compiling large source file using g++


 
Thread Tools Search this Thread
Top Forums Programming Help with Compiling large source file using g++
# 1  
Old 08-13-2009
Computer Help with Compiling large source file using g++

HI All,

I m compiling a 27 MB cpp file and compiler crashes.
My enviroment : RH 9, compiler g++

how i m compiling
g++ -fPIC -DWITH_OPENSSL -DWITH_COOKIES -c soapC.cpp

it took almost 30 -32 to throw error like report bug etc. I will post the same error, but if can any body tell how to compile large cpp file, is there any option/flag for g++ , i tried man g++ ,but couldn't find. It almost compile 97% of the file and then crashes throwing error.

Thanks & Regards.
# 2  
Old 08-13-2009
Try the obvious solution: split it into multiple .cpp files and compile each on it's own. The dependencies between will have to be resolved by the linker, which will be called later anyways.
# 3  
Old 08-13-2009
I have my doubts that a 27 megabyte source-file was generated by hand, so splitting it up may be as big a problem as compiling it...

You may be just plain running out of memory. Check how much swapping is happening while you're trying to build it.

Try playing with -O levels, it may be able to compile better without optimizations.

You could also split up the phases to prevent gcc trying to pipe them between multiple instances of itself. At the very least it would save you a bit of work on having to restart it completely from scratch every time it fails.
Code:
CXXFLAGS="-DWITH_OPENSLL -DWITH_COOKIES -fPIC"
# Preprocess
g++ ${CXXFLAGS} -E soapC.cpp -o soapC.i
# Compile
g++ ${CXXFLAGS} -c soapC.i -o soapC.o
# Link
g++ soapC.o -o soapC


Last edited by Corona688; 08-13-2009 at 01:04 PM..

Previous Thread | Next Thread
Test Your Knowledge in Computers #253
Difficulty: Easy
The Defense Advanced Research Projects Agency (DARPA) is an agency of the United States Department of Defense originally designed by the Jefferson Airplane Company.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Error in compiling .cpp file

I get this error, defaults.cpp: In member function ‘int Defaults::GetIntDefault(const std::string&)’: defaults.cpp:68: error: ‘atoi’ was not declared in this scope defaults.cpp: In member function ‘real_t Defaults::GetRealDefault(const std::string&)’: defaults.cpp:76: error: ‘atof’ was not... (1 Reply)
Discussion started by: bstephens
1 Replies

2. Shell Programming and Scripting

Compiling source code issue

Need assistance in compile a source code with PERL flags Compile source code CDFconvert-2.2.3 which requires Fortran 90,Perl interpreter , Perl/TK module , NetCDF library , Gempak I have all the above required libraries . Issue is when compiling the source code it looks for local... (4 Replies)
Discussion started by: ajayram_arya
4 Replies

3. Programming

Compiling C++ source file

I am trying to compile a c++ source file print_options.cpp and getting lot of errors g++ -I/media/ios120/chrisd/research/tomso-branches/tomso_12_05 /media/ios120/chrisd/research/tomso-branches/tomso_12_05/libs/program_options/print_options.cpp In file included from... (2 Replies)
Discussion started by: kristinu
2 Replies

4. UNIX for Dummies Questions & Answers

environment variables for compiling from source

Hello, I was trying to istall Gdkpixbuff 2.26.1 in my laptop ubuntu 11.10, when I did: ./configure and I got these error message *** 'pkg-config --modversion glib-2.0' returned 2.33.1, but GLIB (2.30.0) was found! If pkg-config was correct, then it is best *** to remove the old version of GLib.... (1 Reply)
Discussion started by: yifangt
1 Replies

5. UNIX for Advanced & Expert Users

Compiling Samba from Source on AIX, Active Directory, LDAP, Kerberos

Hello, I asked this question in the AIX subforum but never received an answer, probably because the AIX forum is not that heavily trafficked. Anyway, here it is.. I have never had any issues like this when compiling applications from source. When I try to compile samba-3.5.0pre2, configure runs... (9 Replies)
Discussion started by: raidzero
9 Replies

6. AIX

Compiling samba from source in AIX 5.3

Hello all. I have never had any issues like this when compiling applications from source. When I try to compile samba-3.5.0pre2, configure runs with no issues, but when the time comes to make, this happens: make: make 1254-025 There must be an existing description file or specify a target. ... (4 Replies)
Discussion started by: raidzero
4 Replies

7. UNIX Desktop Questions & Answers

Solaris 10 - Compiling package from source? Different from pkgadd?

Hey everyone, I'm using a SPARC based Solaris 10 5/09 machine and want to install PHP support to it. I already have mysql and apache( came with OS, just started the proccess) installed, so this is the last thing before I can get to learning development :) However, there's something I'm not sure... (1 Reply)
Discussion started by: agummad
1 Replies

8. Programming

Problem compiling c file on unix

HI, I have a proc installation. On running the following 3 commands, I successfully get 3 C files. proc char_map=string util.pc proc char_map=string FDRFeedMain.pc proc char_map=string NonMons.pc This gives me util.c FDRFeedMain.c NonMons.c Now when i try to compile the... (6 Replies)
Discussion started by: allah_waris45
6 Replies

9. Programming

I have C++ exe file( no source code) and need to run many large dataset under unix, b

I have C++ exe file( no source code) and need to run many large dataset under unix, but how to know the memeroy usage for one dataset?http://www.codeproject.com/script/Forums/Images/New.gif I think "top" is not good and if using the profiler, it seems no free download, any ideas? (1 Reply)
Discussion started by: Danielwang1986
1 Replies

10. HP-UX

bash...Not found through where(compiling source file)

Hi i have compiled and installed bash 3.2 on my hp-ux parisc its in path /usr/local/pkg/bash/bin/bash .....When im search for this bash (through whereis bash) im not findind but other which i hve done in same procedure( gettext,m4) ..Im able to find through whereis search option can any1... (3 Replies)
Discussion started by: vasanthan
3 Replies

Featured Tech Videos