• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Which libgcc do I need to use? (link probs in CW project)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Which libgcc do I need to use? (link probs in CW project)


  • Subject: Re: Which libgcc do I need to use? (link probs in CW project)
  • From: Markus Hitter <email@hidden>
  • Date: Fri, 6 May 2005 23:26:43 +0200


Am 06.05.2005 um 19:21 schrieb Sean McBride:

I have found that the solution is to add libgcc.a to the CW project,
which XCode no doubt does implicitly.

gcc links against libgcc.a by default and Xcode uses gcc as the default C compiler so, roughly, "yes".



However, I'm not sure about all this... which libgcc to use?

Try gcc's --verbose flag to see which subcommands gcc actually issues. Compiling a trivial one-file tool on the command line might be convenient.


Here on Mac OS X 10.3.9 with Xcode 1.5 installed and the default compiler set to 3.3, I get:

Nobile:~$ gcc --verbose bla.c
[...]
ld -arch ppc -dynamic -o a.out -lcrt1.o -lcrt2.o -L/usr/lib/gcc/darwin/3.3 -L/usr/lib/gcc/darwin -L/usr/libexec/gcc/darwin/ppc/3.3/../../.. /var/tmp//ccvOP7qP.o -lgcc -lSystem |
c++filt


The "-lgcc" tells you it uses a library named "libgcc.dylib", then "libgcc.a". The -L flags form a list where to find this library. ld will pick up the first it finds. See the ld man page.


there is a libgcc.a, libgcc_s.1.dylib, and libgcc_s.1.0.dylib, the .a versions also
seem to have gcc-version-dependant variants.

My system shows only two, effectively:

Nobile:~$ locate libgcc | xargs ls -l
-r--r--r-- 1 root wheel 130216 11 Jun 2004 /usr/lib/gcc/darwin/3.1/libgcc.a
-r--r--r-- 1 root wheel 133660 6 Oct 2004 /usr/lib/gcc/darwin/3.3/libgcc.a
lrwxr-xr-x 1 root wheel 27 6 May 22:56 /usr/lib/libgcc.a -> gcc/darwin/default/libgcc.a
Nobile:~$ ls -l /usr/lib/gcc/darwin/default
lrwxr-xr-x 1 root wheel 3 6 May 22:56 /usr/lib/gcc/darwin/default -> 3.3



To summarize, /usr/lib/libgcc.a ist the one you want. Don't change the default gcc compiler between compiling your libs and the entire app.



What is libgcc anyway? :)

A bunch of low level stuff which gcc developers think it fits neither into the C runtime nor in one of the higher level libraries.




Hope That Helps,
Markus

- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/



_______________________________________________
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


References: 
 >Which libgcc do I need to use? (link probs in CW project) (From: "Sean McBride" <email@hidden>)

  • Prev by Date: Re: if(pitiful == XcodeSCC(CVS | subversion)...
  • Next by Date: Re: if(pitiful == XcodeSCC(CVS | subversion)...
  • Previous by thread: Which libgcc do I need to use? (link probs in CW project)
  • Next by thread: if(pitiful == XcodeSCC(CVS | subversion)...
  • Index(es):
    • Date
    • Thread