gcc 4.0.0 cannot be bootstrap-ed if ./configure was run with --enable-static --disable-shared. This is due to the bug in "gcc/config/darwin.h". 317 /* -dynamiclib implies -shared-libgcc just like -shared would on linux. */ 318 #define REAL_LIBGCC_SPEC \ 319 "%{static|static-libgcc:-lgcc}\ 320 %{!static:%{!static-libgcc:\ 321 %{!Zdynamiclib:%{!shared-libgcc:-lgcc}\ 322 %{shared-libgcc:-lgcc_s -lgcc}} %{Zdynamiclib:-lgcc_s -lgcc}}}" The REAL_LIBGCC_SPEC states that libgcc.a AND libgcc_eh.a are required for static gcc. (Probably copied from linux or i386 or any other spec files.) However, in powerpc-apple-darwin7.7.0 (and possibly any of powerpc*-*-darwin*) this "libgcc_eh.a" is not build during the bootstrap procedure (and also not required). So, after the first xgcc is build, bootstarp fails at stage1 by the following error: /usr/lib/ld: can't locate file for: -lgcc_eh To fix, simply sed -e 's/ -lgcc_eh//' the gcc/config/darwin.h file.
(In reply to comment #0) > This is due to the bug in "gcc/config/darwin.h". > > 317 /* -dynamiclib implies -shared-libgcc just like -shared would on linux. */ > 318 #define REAL_LIBGCC_SPEC \ > 319 "%{static|static-libgcc:-lgcc}\ > 320 %{!static:%{!static-libgcc:\ > 321 %{!Zdynamiclib:%{!shared-libgcc:-lgcc}\ > 322 %{shared-libgcc:-lgcc_s -lgcc}} %{Zdynamiclib:-lgcc_s -lgcc}}}" I'm sorry. I attached my "EDITED" version of "gcc/config/darwin.h". The original one can be viewed at http://sources.redhat.com/cgi-bin/cvsweb.cgi/gcc/gcc/config/darwin.h?cvsroot=gcc&only_with_tag=MAIN 317 /* -dynamiclib implies -shared-libgcc just like -shared would on linux. */ 318 #define REAL_LIBGCC_SPEC \ 319 "%{static|static-libgcc:-lgcc -lgcc_eh}\ 320 %{!static:%{!static-libgcc:\ 321 %{!Zdynamiclib:%{!shared-libgcc:-lgcc -lgcc_eh}\ 322 %{shared-libgcc:-lgcc_s -lgcc}} %{Zdynamiclib:-lgcc_s -lgcc}}}"
Really only building static is not supported on darwin. I will look into the problem but only after a week if no one else has looked into this.
(In reply to comment #2) > Really only building static is not supported on darwin. I will look into the problem but only after a week > if no one else has looked into this. Yes, I totally agree to your comment. It is not possible to create a "completely static gcc binary" on darwin. However, if gcc is built with gcc's shared libraries (i.e. --enable-shared), g++ and gfortran produces binaries that require libgcc_s.dylib for runtime. In order to distribute gfortran compiled binaries, it is troublesome to handle with libgcc_s.dylib. So, what I mean by static gcc is "gcc which produces binaries free of shared-gcc-libraries".
(In reply to comment #3) > (In reply to comment #2) > > Really only building static is not supported on darwin. I will look into the > problem but only after a week > > if no one else has looked into this. > So, what I mean by static gcc is "gcc which produces binaries free of > shared-gcc-libraries". And that is a problem, libgcc_s is required for correct running in terms of exceptions. Also it is not hard to cp libgcc_s with libgfortran and such. Also telling people to set DYLD_LIBRARY_PATH is not hard, people do it all the time on linux and almost all other unix OS's.
Caused by: 2004-11-03 Andrew Pinski <pinskia@physics.uc.edu> * config/darwin.h (REAL_LIBGCC_SPEC): Define to use shared libgcc for shared libraries.
*** This bug has been marked as a duplicate of 26510 ***