Re: libgcc_s.dylib dependency
Re: libgcc_s.dylib dependency
- Subject: Re: libgcc_s.dylib dependency
- From: "E. Wing" <email@hidden>
- Date: Thu, 22 Sep 2005 21:18:40 -0700
> libgcc_s is the shared version of libgcc. libgcc is linked into every
> non-static binary built by GCC, and includes various internal
> functions. In GCC 4.0, G++ always links against libgcc_s. As I
> understand things, the C++ throw/catch exception handling mechanism
> is implemented in libgcc, and linking to the shared version allows
> exceptions to be thrown & caught between different shared objects.
Yeah, for C++, that was the vague impression I got from internet
searches about libgcc_s...it did exception handling for C++. But this
doesn't address why my pure C-based stuff also gets linked to it,
using the gcc 4.0 that comes with Xcode 2.1, but not the gcc 4.0 that
comes with Xcode 2.0.
> > I would also like to
> > know if there is a way to remove the dependency using the the newer
> > versions of Xcode and gcc 4.0 (static linking?).
>
> In the build log, check to see how Xcode is launching GCC to link the
> binary. If it's using G++ and not GCC to link the binary, or if the "-
> shared-libgcc" option is being used, then the binary will be linked
> against libgcc_s.
Actually, for my big project, I was using Xcode, but for my test
cases, I built everything by hand on the command line avoiding Xcode
altogether. For 3 files, foolib.h, foolib.c, and main.c where
foolib.h:
void DoSomething();
foolib.c:
#include "foolib.h"
#include <stdio.h>
void DoSomething()
{
fprintf(stderr, "In DoSomething");
}
main.c:
#include "foolib.h"
int main()
{
DoSomething();
return 0;
}
here is my list of build instructions:
gcc -c foolib.c
gcc -dynamiclib -o libfoo.dylib foolib.o # builds the dylib
gcc -c main.c
gcc main.o -L./ -lfoo # builds a.out
otool -L libfoo.dylib tells me that libgcc_s is a dependency when
built using gcc 4.0 from Xcode 2.1, but not when using the one from
Xcode 2.0.
Thanks,
Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden