help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GCC 4.3.3 can't link stdc++ statically on OS X


From: address@hidden
Subject: GCC 4.3.3 can't link stdc++ statically on OS X
Date: Fri, 27 Mar 2009 05:41:27 -0700 (PDT)
User-agent: G2/1.0

Compiling the standard Hello World with

g++ -static-libgcc hello.cpp

Results in a binary that's linked dynamically to libstdc++.6.dylib.

I want that library linked statically, so I tried the insanely geeky
Linux-inspired workaround:

http://www.trilithium.com/johan/2005/06/static-libstdc/

$ a=`g++ -print-file-name=libstdc++.a`
$ d=`dirname $a`
$ g++ -static-libgcc -L${d} hello.cpp
$ otool -L a.out

This shows a.out still linked dynamically to libstdc++.6.dylib

Any tips? Is this a bug? I know that Xcode has its own solution, but I
don't use Xcode.

Incidentally,

$ g++ -static hello.cpp

does not work either:

/var/tmp//ccUH32ei.s:136:FATAL:incompatible feature used:
directive .non_lazy_symbol_pointer (must specify "-dynamic" to be
used)

I'm using Darwin version 8.11


reply via email to

[Prev in Thread] Current Thread [Next in Thread]