statically compiling

F

fangee

Hi everybody,
I'm facing a problem trying to statically compile a simple c++ prog,
something like:
int main(){
return 1;
}

Using g++ 2.95.4 (I must use this to compile a much more complex
program) this way I get the following output:

$ g++ -static tmp.cpp

/usr/bin/../lib/libc.a(syslog.o): In function `__vsyslog_chk':
(.text+0x6dd): undefined reference to `_Unwind_Resume'
/usr/bin/../lib/libc.a(syslog.o): In function `__vsyslog_chk':
(.text+0x6f2): undefined reference to `_Unwind_Resume'
/usr/bin/../lib/libc.a(syslog.o): In function `openlog':
(.text+0x803): undefined reference to `_Unwind_Resume'
/usr/bin/../lib/libc.a(syslog.o): In function `closelog':
(.text+0x874): undefined reference to `_Unwind_Resume'
/usr/bin/../lib/libc.a(syslog.o):(.eh_frame+0x12): undefined
reference to `__gcc_personality_v0'
/usr/bin/../lib/libc.a(backtrace.o): In function `backtrace':
(.text+0x54): undefined reference to `_Unwind_Backtrace'
/usr/bin/../lib/libc.a(backtrace.o): In function `backtrace_helper':
(.text+0x10a): undefined reference to `_Unwind_GetIP'
/usr/bin/../lib/libc.a(backtrace.o): In function `backtrace_helper':
(.text+0x12f): undefined reference to `_Unwind_GetGR'
/usr/bin/../lib/libc.a(backtrace.o): In function `backtrace_helper':
(.text+0x13a): undefined reference to `_Unwind_GetCFA'
/usr/bin/../lib/libc.a(iofclose.o):(.eh_frame+0x11): undefined
reference to `__gcc_personality_v0'
/usr/bin/../lib/libc.a(iofflush.o): In function `fflush':
(.text+0xdc): undefined reference to `_Unwind_Resume'
/usr/bin/../lib/libc.a(iofflush.o):(.eh_frame+0x12): undefined
reference to `__gcc_personality_v0'
/usr/bin/../lib/libc.a(iofwrite.o): In function `fwrite':
(.text+0x126): undefined reference to `_Unwind_Resume'
/usr/bin/../lib/libc.a(iofwrite.o):(.eh_frame+0x12): undefined
reference to `__gcc_personality_v0'
/usr/bin/../lib/libc.a(wfileops.o): In function `_IO_wfile_underflow':
(.text+0x125d): undefined reference to `_Unwind_Resume'
/usr/bin/../lib/libc.a(wfileops.o):(.eh_frame+0x12): undefined
reference to `__gcc_personality_v0'
/usr/bin/../lib/libc.a(fileops.o): In function `_IO_file_fopen':
(.text+0x1f13): undefined reference to `_Unwind_Resume'
/usr/bin/../lib/libc.a(fileops.o): In function `_IO_file_underflow':
(.text+0x2108): undefined reference to `_Unwind_Resume'
/usr/bin/../lib/libc.a(fileops.o):(.eh_frame+0x12): undefined
reference to `__gcc_personality_v0'
collect2: ld returned 1 exit status

Statically compiling the same program with g++ 4.1.2 all works fine.

On my system (ubuntu linux 6.10 kernel 2.6.17-10-386) I've got the
following libstdc++:
/usr/lib/libstdc++-3-libc6.2-2-2.10.0.a
/usr/lib/libstdc++-3-libc6.2-2-2.10.0.so
/usr/lib/libstdc++.so.5.0.7
/usr/lib/libstdc++.so.6.0.8

Any suggestion?
Thanks,
f.
 
?

=?iso-8859-1?q?Erik_Wikstr=F6m?=

Hi everybody,
I'm facing a problem trying to statically compile a simple c++ prog,
something like:
int main(){
return 1;
}

Using g++ 2.95.4 (I must use this to compile a much more complex
program) this way I get the following output:

$ g++ -static tmp.cpp

/usr/bin/../lib/libc.a(syslog.o): In function `__vsyslog_chk':
(.text+0x6dd): undefined reference to `_Unwind_Resume' [snip]
collect2: ld returned 1 exit status

Statically compiling the same program with g++ 4.1.2 all works fine.

Well, either you are not trying to compile the code given above, or you
have some problem with your compiler, in which case you should turn to
a newsgroup dedicated to that subject (gnu.g++.help).
 
L

Lionel B

Hi everybody,
I'm facing a problem trying to statically compile a simple c++ prog,
something like:
int main(){
return 1;
}

Using g++ 2.95.4 (I must use this to compile a much more complex
program) this way I get the following output:

$ g++ -static tmp.cpp

/usr/bin/../lib/libc.a(syslog.o): In function `__vsyslog_chk':

[snip more errors]
Statically compiling the same program with g++ 4.1.2 all works fine.

[snip]

You must be aware that g++ 2.95.x is pretty ancient and not terribly
standards-compliant. That said, it looks as if the problem may be with
your gcc 2.95.4 compiler setup and hence off-topic here (the C++ *code* is
valid); I'd suggest asking on a newsgroup for your compiler/OS.

Regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

linux g++ compile error 1
building 32-bit on 64-bit system 10
ld usage 2
Freeze statically 1
Errors with enums 4
C/C++ link problems 2
Undefined Reference to Main 2
Unresolved Symbols from C++ Code 3

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top