[MINC-development] linking errors on os x

Vicka Corey minc-development@bic.mni.mcgill.ca
Tue, 17 Feb 2004 14:15:13 -0500


(taking this back to minc-development....)

i think the problem is something i talked about way way long ago, which
is the need to build the osx minc/netcdf libraries with -fno-common:

	(from feb 2003)
	Today I set out to link Freesurfer with the 1.1 libminc.a, and it was 
	not happy when I wanted to make dynamic libraries:

	ld: common symbols not allowed with MH_DYLIB output format
	ld: common symbols not allowed with MH_DYLIB output format
	/usr/pubsw/lib/libminc.a(minc_globdef.o) definition of common _minc_call_depth (size 4)
	/usr/pubsw/lib/libminc.a(minc_globdef.o) definition of common _minc_trash_var (size 4)
	/usr/pubsw/lib/libminc.a(minc_globdef.o) definition of common _minc_callers_ncopts (size 4)
	/usr/bin/libtool: internal link edit command failed

	I added -fno-common to CFLAGS in the minc Makefile, which seems to have 
	fixed it.


kevin, there is a source distro of minc on their site, but i am trying to
use the distributed os x build (so that we don't end up maintaining a 
separate one).

is the current os x version being built with -fno-common?  if not can it be?

thanks
--vicka

On Wed, Feb 11, 2004 at 01:37:41PM -0500, Kevin Teich wrote:
> > The only thing which jumps out at me - though it might not make a 
> > difference - is the order that you link the libraries. -lnetcdf should 
> > come after -lminc. Again, don't know if this will make a difference ...
> 
> should this be added to flags for compilation of libminc and libnetcdf, or 
> for the linking of the dynamic library that uses them? i tried the latter 
> and it doesn't help.
> 
> (i'm only emailing you on this because i have no idea if minc or netcdf is 
> distributed as source, so maybe this is a really stupid question.)
> 
> 
> > 
> > Jason
> > 
> > On Feb 6, 2004, at 6:00 PM, Vicka Corey wrote:
> > 
> > > hmm.  ok, i downloaded the new dist, and added flat_namespace to my 
> > > flags.
> > > but that doesn't seem to be it:
> > >
> > > gcc -I/Users/nmrroot/dev/include -I/usr/pubsw/include 
> > > -I/Users/nmrroot/dev/include -I/usr/pubsw/include -g -DDEBUG -DDarwin 
> > > -flat_namespace -DDECLARE_PROGNAME -c -o fsgdf.o fsgdf.c
> > > gcc -dynamiclib fsgdf.o fsgdf_wrap.o -L/Users/nmrroot/dev/lib/Darwin 
> > > -L/usr/pubsw/lib -lm -lutils -lunix -lhipsstubs -limage -lutils -lrgb 
> > > -ltiff -ljpeg -lz -ldicom -lvolume_io -lnetcdf -lminc -ltk8.3 -ltcl8.3 
> > > -lBLT -o libtclfsgdf.dylib
> > > ld: warning prebinding disabled because dependent library: 
> > > /sw/lib/libtiff.3.dylib is not prebound
> > > ld: common symbols not allowed with MH_DYLIB output format with the 
> > > -multi_module option
> > > /usr/pubsw/lib/libminc.a(minc_globdef.o) definition of common 
> > > _minc_call_depth (size 4)
> > > /usr/pubsw/lib/libminc.a(minc_globdef.o) definition of common 
> > > _minc_trash_var (size 4)
> > > /usr/pubsw/lib/libnetcdf.a(v2i.o) definition of common 
> > > _cdf_routine_name (size 4)
> > > /usr/pubsw/lib/libminc.a(minc_globdef.o) definition of common 
> > > _minc_callers_ncopts (size 4)
> > > /usr/bin/libtool: internal link edit command failed
> > > make: *** [tcl] Error 1
> > >
> > > ...any ideas?
> > >
> > > thanks,
> > > --vicka
> > >
> > > On Sun, Jan 18, 2004 at 10:51:36AM -0500, Jason Lerch wrote:
> > >>
> > >> On Jan 16, 2004, at 2:23 PM, Vicka Corey wrote:
> > >>
> > >>> hi -- i've been trying to build freesurfer on an osx 10.3 laptop.  i
> > >>> am using
> > >>> the minc 1.2 cd from the workshop, and am running into some errors:
> > >>>
> > >>> building libfsgdf stuff
> > >>> /usr/bin/libtool: internal link edit command failed
> > >>> ld: warning prebinding disabled because dependent library:
> > >>> /sw/lib/libtiff.3.dylib is not prebound
> > >>> ld: common symbols not allowed with MH_DYLIB output format with the
> > >>> -multi_module option
> > >>> /usr/pubsw/lib/libminc.a(minc_globdef.o) definition of common
> > >>> _minc_call_depth (size 4)
> > >>> /usr/pubsw/lib/libminc.a(minc_globdef.o) definition of common
> > >>> _minc_trash_var (size 4)
> > >>> /usr/pubsw/lib/libnetcdf.a(v2i.o) definition of common
> > >>> _cdf_routine_name (size 4)
> > >>> /usr/pubsw/lib/libminc.a(minc_globdef.o) definition of common
> > >>> _minc_callers_ncopts (size 4)
> > >>> gmake[2]: *** [tcl] Error 1
> > >>>
> > >>>
> > >>> any ideas?
> > >>
> > >> Might be the OSX namespace issue. Try
> > >> setenv CC 'gcc -flat_namespace'
> > >> (or the same for CXX if you are using c++).
> > >>
> > >> No idea if this is your problem, but it is worh a try.
> > >>
> > >>>  also, any sign of the bugfixes from awhile back...?
> > >>>
> > >> Working on it as I write this.
> > >>
> > >> Jason
> > >>
> > >> _______________________________________________
> > >> MINC-development mailing list
> > >> MINC-development@bic.mni.mcgill.ca
> > >> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development
> > > _______________________________________________
> > > MINC-development mailing list
> > > MINC-development@bic.mni.mcgill.ca
> > > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development
> > 
> 
> -- 
> Kevin Teich
> 
> 
>