[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GCC 4.3.3 can't link stdc++ statically on OS X
From: |
address@hidden |
Subject: |
Re: GCC 4.3.3 can't link stdc++ statically on OS X |
Date: |
Fri, 27 Mar 2009 11:40:07 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Mar 27, 10:25 am, Gregory Weston <u...@splook.com> wrote:
> In article
> <66f6b8c1-7f9d-4bc9-9f03-47dcc24e2...@z1g2000yqn.googlegroups.com>,
>
>
>
> "fft1...@gmail.com" <fft1...@gmail.com> wrote:
> > 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.
>
> Possibly this:
>
> <http://lists.apple.com/archives/Unix-porting/2006/Aug/msg00012.html>
I believe libstdc++-static.a that he is trying to link with is part of
the XCode solution. Nevertheless, I'm trying his approach (with libstdc
++.a, which is part of GCC).
I don't understand the words "Using gcc or ld, prelink the object
files into one big object"
I thought gcc and ld could only link object files into an executable,
dynamic library or an archive (static library). Did I not study the
man pages long enough or is he trying to say something else?