Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -multi_module problem



I am attempting to build a chunk of code from the open source world
(Singular, a computer algebra system).  In the course of the build,
I get this failure (both PowerPC and Intel):

libtool -dynamic -twolevel_namespace -weak_reference_mismatches
weak -undefined dynamic_lookup -o mpsr.so mpsr_Put.dl_o
mpsr_PutPoly.dl_o mpsr_GetPoly.dl_o mpsr_sl.dl_o mpsr_Get.dl_o
mpsr_GetMisc.dl_o mpsr_Error.dl_o -L/lib -lMPT -lMP
ld: for architecture ppc
ld: common symbols not allowed with MH_DYLIB output format with the
-multi_module option
/lib/libMP.a(MP_Util.o) definition of common _fix_log_msg (size 128)
/lib/libMP.a(MP_Util.o) definition of common _AnnotFlagsStr (size 32)
libtool: internal link edit command failed

After R'ing TFM, I tried adding -single_module to LDFLAGS.  That
worked, AFAICT, but I'm not sure this is the correct fix.

Sorry to be dense, but why is this a 'multi-module' problem? Ld is spitting the dummy because of common symbols in the objects being linked. I thought the normal practice on Darwin/MacOS X was to use the -fno-common option on all compiles for code to be used in shared objects. If this had been done, it might even have linked.

Also, since Singular is an "autoconf" package, I think I need to
add that flag in 'configure.in', where it sets up LDFLAGS during
the config run.

So: is this the correct flag/fix, and the right place to change?

I pulled the source tarball for Singular and the description 'an "autoconf" package' can only be loosely applied. It uses a few autoconf macros, but it certainly does not follow autoconf practice or recommendations and does not use automake or GNU libtool.


I have not spent long on it but the only Darwin stuff seems to be in Singular/configure.in. The other packages in the bundle seem to inherit that configuration. The lines read:
ppcMac-darwin)
AC_CHECK_LIB(dl, dlopen)
if test "$ac_cv_lib_dl_dlopen" = yes; then
LD_DYN_FLAGS="-ldl -dynamic"
SFLAGS="-fpic -DPIC"
SLDFLAGS="-dynamic -twolevel_namespace - weak_reference_mismatches weak -undefined dynamic_lookup"
LD=libtool
ac_lib_dl=yes
fi
;;
ix86Mac-darwin)
AC_CHECK_LIB(dl, dlopen)
if test "$ac_cv_lib_dl_dlopen" = yes; then
LD_DYN_FLAGS="-ldl -dynamic"
SFLAGS="-fpic -DPIC"
SLDFLAGS="-dynamic -twolevel_namespace - weak_reference_mismatches weak -undefined dynamic_lookup"
LD=libtool
ac_lib_dl=yes
fi
;;

This seems to me to be a mis-configuration problem rather than just a multi-module issue. Never mind the weird system names, just look at some of the flags:


SFLAGS="-fpic -DPIC" presumably SFLAGS are compiler options for shared objects. Maybe '-DPIC' does something wonderful with the pre- processor defines and conditionals in their sources but '-fpic' is simply unsupported on Darwin/MacOS X. '-fPIC' is supported but it is the default. So there is no need to add it. OTOH most opensource packages build shared objects on Darwin with '-fno-common'. It would certainly solve the immediate problem.

SLDFLAGS=..... Some one else has already observed that -dynamic is not appropriate and I would suspect that all that weak stuff is not doing what its author intended.

LD=libtool I have ported several open source projects to MacOS X and always found that invoking ld or libtool directly was problematic. It is much better to use the appropriate compiler driver (gcc, g++ etc.) because that will add necessary flags and ensure all the needed system and runtime libraries get linked.

So yes, I think this is where you should be hacking, but I would want to understand the complex build system of this package rather more before declaring that one or other hack was reasonable.

Bill Northcott

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Unix-porting mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/unix-porting/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.