statically compiling

Discussion in 'C++' started by fangee, Jan 18, 2007.

  1. fangee

    fangee Guest

    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.
     
    fangee, Jan 18, 2007
    #1
    1. Advertising

  2. On Jan 18, 11:23 am, fangee <> wrote:
    > 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).

    --
    Erik Wikström
     
    =?iso-8859-1?q?Erik_Wikstr=F6m?=, Jan 18, 2007
    #2
    1. Advertising

  3. fangee

    Lionel B Guest

    On Thu, 18 Jan 2007 10:23:51 +0000, fangee wrote:

    > 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,

    --
    Lionel B
     
    Lionel B, Jan 18, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    17
    Views:
    1,739
    Chris Riesbeck
    Nov 3, 2003
  2. puzzlecracker
    Replies:
    9
    Views:
    1,773
    puzzlecracker
    Dec 30, 2005
  3. joe martin
    Replies:
    3
    Views:
    402
    Francis Glassborow
    Jul 16, 2003
  4. LinuxN00b

    Statically Linking Libraries

    LinuxN00b, Aug 6, 2003, in forum: C++
    Replies:
    1
    Views:
    371
    Thomas Matthews
    Aug 6, 2003
  5. Replies:
    5
    Views:
    668
    Matt Wharton
    Dec 9, 2004
Loading...

Share This Page