no joy with 20050723 gcc-4.1 snapshot

Dominique Dhumieres dominiq@lps.ens.fr
Sun Aug 21 15:35:00 GMT 2005


Summary of my understanding of the previous threads (starting on July, 26):

MaxOS 10.3.* requires "ld .. . -lSystem -lmx"
while MaxOS 10.4.* requires "ld ...  -lmx -lSystem" (Unix way of life, 
isn't it?-).

If the order is reversed, ld produces many warning about "multiple 
definitions of symbol xxx" or "... suggest use of -bind_at_load, ...".

At that time I wrongly put the blame on gcc/config/rs6000/darwin8.h
because of the line

> ...
> %{!m64:%:version-compare(>< 10.3 10.4 mmacosx-version-min= -lmx)} -lSystem}"
> ...

Geoffrey Keating pointed out that this file was not used for 10.3, but 
rather darwin7.h which ends with:

> ...
> /* Machine dependent libraries.  Include libmx when compiling for
>    Darwin 7.0 and above, but before libSystem, since the functions are
>    actually in libSystem but for 7.x compatibility we want them to be
>    looked for in libmx first.  Include libmx by default because otherwise
>    libstdc++ isn't usable.  */
> 
> #undef  LIB_SPEC
> #define LIB_SPEC "%{!static:\
>   %:version-compare(!< 10.3 mmacosx-version-min= -lmx)\
>   -lSystem}"

instead of:

> /* Darwin 7.0 and above have C99 functions.   */
> #define TARGET_C99_FUNCTIONS 1
> 
> /* Machine dependent libraries, include libmx when compiling on Darwin 7.0
>    and above.  */
> 
> #undef  LIB_SPEC
> #define LIB_SPEC "%{!static:-lSystem -lmx}"

in gcc/config/darwin7.h of the 20050702 snapshot.

So I replaced the file gcc/config/rs6000/darwin7.h by the content of
gcc/config/darwin7.h in the last two snapshots. Tried to build the oldest 
one about a week ago and got the error:

> ...
> nm -P .libs/bitmap_allocator.o .libs/pool_allocator.o .libs/mt_allocator.o .libs/codecvt.o .libs/compatibility.o .libs/complex_io.o .libs/ctype.o .libs/debug.o .libs/debug_list.o .libs/functexcept.o .libs/globals_locale.o .libs/globals_io.o .libs/ios.o .libs/ios_failure.o .libs/ios_init.o .libs/ios_locale.o .libs/limits.o .libs/list.o .libs/locale.o .libs/locale_init.o .libs/locale_facets.o .libs/localename.o .libs/stdexcept.o .libs/strstream.o .libs/tree.o .libs/allocator-inst.o .libs/concept-inst.o .libs/fstream-inst.o .libs/ext-inst.o .libs/io-inst.o .libs/istream-inst.o .libs/istream.o .libs/locale-inst.o .libs/locale-misc-inst.o .libs/misc-inst.o .libs/ostream-inst.o .libs/sstream-inst.o .libs/streambuf-inst.o .libs/streambuf.o .libs/string-inst.o .libs/valarray-inst.o .libs/wlocale-inst.o .libs/wstring-inst.o .libs/atomicity.o .libs/codecvt_members.o .libs/collate_members.o .libs/ctype_members.o .libs/messages_members.o .libs/monetary_members.o .libs/numeric_members.o .libs/time_members.o .libs/basic_file.o .libs/c++locale.o ../libmath/.libs/libmath.a ../libsupc++/.libs/libsupc++convenience.a|nm: invalid argument -P
> Usage: nm [-agnoprumxjl[s segname sectname] [-] [[-arch <arch_flag>] ...] [file ...]
> nm error at /sw/src/fink.build/gcc4-4.1.0-20050813/gcc-4.1-20050813/libstdc++-v3/scripts/make_exports.pl line 130.
> make[3]: *** [libstdc++-symbol.explist] Error 1
> make[2]: *** [all-recursive] Error 1
> make[1]: *** [all] Error 2
> make: *** [all-target-libstdc++-v3] Error 2
> ### execution of /var/tmp/tmp.2.ZdT2JX failed, exit code 2
> ...

Indeed /usr/bin/nm does not support the -P option, while the file
libstdc++-v3/scripts/make_exports.pl states:

> ...
> # It expects a 'nm' with the POSIX '-P' option, but everyone has one of
> # those, right?  It also expects that symbol names have a leading underscore,
> ...

It took me half a week to unsuccessfully search the web for such beast 
before I realized that it should part of the new cctools I had in
/sw/lib/odcctools/bin/ (from Fink). So I did

ln -s /sw/lib/odcctools/bin/nm /sw/bin/nm

With thses changes, both snapshots installed fine and gives for instance:

% gfortran -v -O3 channel.f90
Driving: gfortran -v -O3 channel.f90 -lgfortranbegin -lgfortran -shared-libgcc
Using built-in specs.
Target: powerpc-apple-darwin7
Configured with: ../configure --prefix=/sw --prefix=/sw/lib/gcc4 --enable-languages=c,c++,f95,objc,java --infodir=/share/info --with-gmp=/sw --with-included-gettext --host=powerpc-apple-darwin7 --with-as=/sw/lib/odcctools/bin/as --with-ld=/sw/lib/odcctools/bin/ld
Thread model: posix
gcc version 4.1.0 20050819 (experimental)
 /sw/lib/gcc4/libexec/gcc/powerpc-apple-darwin7/4.1.0/f951 channel.f90 -fPIC -quiet -dumpbase channel.f90 -auxbase channel -O3 -version -o /var/tmp//ccIknQWf.s
GNU F95 version 4.1.0 20050819 (experimental) (powerpc-apple-darwin7)
	compiled by GNU C version 3.3 20030304 (Apple Computer, Inc. build 1671).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
 /sw/lib/odcctools/bin/as -arch ppc -o /var/tmp//ccUGWmT8.o /var/tmp//ccIknQWf.s
 /sw/lib/gcc4/libexec/gcc/powerpc-apple-darwin7/4.1.0/collect2 -dynamic -arch ppc -weak_reference_mismatches non-weak -o a.out -lcrt1.o /sw/lib/gcc4/lib/gcc/powerpc-apple-darwin7/4.1.0/crt2.o -L/sw/lib/gcc4/lib/gcc/powerpc-apple-darwin7/4.1.0 -L/sw/lib/gcc4/lib/gcc/powerpc-apple-darwin7/4.1.0/../../.. /var/tmp//ccUGWmT8.o -lgfortranbegin -lgfortran -lgcc_s -lgcc -lSystem -lmx

i.e., compiled without spurious warning (and even the executable runs 
fine!-).

So if I did not overlooked some side effects outside gfortran, it would be 
nice for 10.3 to revert darwin7.h to its state before the 20050707 
snapshot (is the line #define TARGET_C99_FUNCTIONS 1 really needed?).
If not I'll try to patch the install script to simplify the building.

Cheers

Dominique



More information about the Fortran mailing list