On 17/01/16 10:33, Bruno Haible wrote: > Hi Pádraig, > > Test of coreutils-8.24.161-1204d on Mac OS X 10.5.8: > > Compilation fails: > > $ ./configure --prefix=/Users/bruno/data/local-macos CPPFLAGS=-Wall > $ make > ... > CCLD src/libstdbuf.so > Undefined symbols: > "_main", referenced from: > start in crt1.10.5.o > ld: symbol(s) not found > collect2: ld returned 1 exit status > make[2]: *** [src/libstdbuf.so] Error 1 > make[1]: *** [all-recursive] Error 1 > make: *** [all] Error 2 > > Looking more closely which command fails: > > $ make AM_DEFAULT_VERBOSITY=1 > make all-recursive > Making all in po > make[2]: Nothing to be done for `all'. > Making all in . > gcc -std=gnu99 -fPIC -g -O2 -shared -o src/libstdbuf.so > src/src_libstdbuf_so-libstdbuf.o -L/Users/bruno/data/local-macos/lib -lintl > -liconv -lc -Wl,-framework -Wl,CoreFoundation > Undefined symbols: > "_main", referenced from: > start in crt1.10.5.o > ld: symbol(s) not found > collect2: ld returned 1 exit status > make[2]: *** [src/libstdbuf.so] Error 1 > make[1]: *** [all-recursive] Error 1 > make: *** [all] Error 2 > > This fails because the gcc here is Apple GCC: > > $ gcc -v > Using built-in specs. > Target: i686-apple-darwin9 > Configured with: /var/tmp/gcc/gcc-5465~16/src/configure --disable-checking > -enable-werror --prefix=/usr --mandir=/share/man > --enable-languages=c,objc,c++,obj-c++ > --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ > --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib > --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic > --host=i686-apple-darwin9 --target=i686-apple-darwin9 > Thread model: posix > gcc version 4.0.1 (Apple Inc. build 5465) > > and it ignores the -shared option. > > The correct command line would be > > $ gcc -std=gnu99 -fPIC -g -O2 -dynamiclib -o src/libstdbuf.so > src/src_libstdbuf_so-libstdbuf.o -L/Users/bruno/data/local-macos/lib -lintl > -liconv -lc -Wl,-framework -Wl,CoreFoundation > > or even better, incorporating info from libtool: > > $ gcc -std=gnu99 -fPIC -fno-common -DPIC -g -O2 -dynamiclib -o > src/libstdbuf.so src/src_libstdbuf_so-libstdbuf.o > -L/Users/bruno/data/local-macos/lib -lintl -liconv -lc -Wl,-framework > -Wl,CoreFoundation > > The cause of this portability problem is that the Makefile is attempting to > create a shared library without libtool. > > "make check" then passes, but of course with some skipped tests: > > no-ctx.sh: skipped test: $CC -shared ... failed to build a shared lib > SKIP: tests/cp/no-ctx.sh > r-root.sh: skipped test: $CC -shared ... failed to build a shared lib > SKIP: tests/rm/r-root.sh > csplit-io-err.sh: skipped test: $CC -shared ... failed to build a shared lib > SKIP: tests/misc/csplit-io-err.sh > nfs-removal-race.sh: skipped test: $CC -shared ... failed to build a shared > lib > SKIP: tests/cp/nfs-removal-race.sh > no-mtab-status.sh: skipped test: $CC -shared ... failed to build a shared lib > SKIP: tests/df/no-mtab-status.sh > skip-duplicates.sh: skipped test: $CC -shared ... failed to build a shared lib > SKIP: tests/df/skip-duplicates.sh > getxattr-speedup.sh: skipped test: $CC -shared ... failed to build a shared > lib > SKIP: tests/ls/getxattr-speedup.sh
Thanks a lot for the testing and info. We tried to avoid libtool only to support the combination of this single utility on older compilers. I'll look at if there is a simple improvement that can be made to the gating logic in configure.ac thanks! Pádraig
