[M3devel] a hope for dynamic linking!
Jay
jayk123 at hotmail.com
Sat Apr 19 17:56:34 CEST 2008
sorry, that was with them symlinked in, from before the fix; maybe that's the problem
I'll see.
- Jay
From: jayk123 at hotmail.com
To: hosking at cs.purdue.edu
Date: Sat, 19 Apr 2008 15:46:31 +0000
CC: m3devel at elegosoft.com
Subject: Re: [M3devel] a hope for dynamic linking!
I understand.
But when dynamic linking is actually used, -rpath/$ORIGIN might be a little better than having to modify LD_LIBRARY_PATH.
I realize it's not night and day. It doesn't make dynamic linking suddenly problem free, just maybe every so slightly better.
When that still isn't adequate and diskspace/memory not a concern, or there are issues of circular dependencies (cm3), build_standalone.
(I think cm3 is statically linked for subtle reasons I can't quite grasp at the moment. Not just so it can copy m3core.dll around while it is running, that
could probably be dealt with less severely.)
It looks like when gmp/mpfr source are in the gcc tree, it always does --disable-shared on them.
I'm testing some now.
libgcc seems to be a bit of a middle ground, like Modula3 stuff -- available both static and dynamic, and the need for dynamic varies.
libgcc I believe contains roughly:
1) math helpers -- multiply/divide, 64 bit stuff
2) exception handling
#1 is a case of kinda like, hey, I didn't make any function calls, why do I do need a .lib or .dll and no thank you on the dynamic linking headaches
#2 is similar, but rather than "no function calls", it's using language constructs that actually have heavy dependencies, and if people want to throw/catch exceptions across linkage boundaries, the exception handling implementation might need to be shared
building with the in-gcc-tree gmp/mpfr:
gcc -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_STDARG=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SETLOCALE=1 -DHAVE_GETTIMEOFDAY=1 -DMPFR_HAVE_FESETROUND=1 -DHAVE_ROUND=1 -DHAVE_TRUNC=1 -DHAVE_FLOOR=1 -DHAVE_CEIL=1 -DHAVE_NEARBYINT=1 -DHAVE_ATTRIBUTE_MODE=1 -DHAVE_ALLOCA_H=1 -I. -I../../gcc/mpfr -I/dev2/cm3/m3-sys/m3cc/PPC_DARWIN/./gmp -I/dev2/cm3/m3-sys/m3cc/PPC_DARWIN/./gmp/tune -g -MT remquo.lo -MD -MP -MF .deps/remquo.Tpo -c ../../gcc/mpfr/remquo.c -o remquo.o
./get_patches.sh > get_patches.c || rm -f get_patches.c
/bin/sh: line 1: ./get_patches.sh: No such file or directory
if /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_STDARG=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SETLOCALE=1 -DHAVE_GETTIMEOFDAY=1 -DMPFR_HAVE_FESETROUND=1 -DHAVE_ROUND=1 -DHAVE_TRUNC=1 -DHAVE_FLOOR=1 -DHAVE_CEIL=1 -DHAVE_NEARBYINT=1 -DHAVE_ATTRIBUTE_MODE=1 -DHAVE_ALLOCA_H=1 -I. -I../../gcc/mpfr -I/dev2/cm3/m3-sys/m3cc/PPC_DARWIN/./gmp -I/dev2/cm3/m3-sys/m3cc/PPC_DARWIN/./gmp/tune -g -MT get_patches.lo -MD -MP -MF ".deps/get_patches.Tpo" -c -o get_patches.lo get_patches.c; \
then mv -f ".deps/get_patches.Tpo" ".deps/get_patches.Plo"; else rm -f ".deps/get_patches.Tpo"; exit 1; fi
gcc -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_STDARG=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SETLOCALE=1 -DHAVE_GETTIMEOFDAY=1 -DMPFR_HAVE_FESETROUND=1 -DHAVE_ROUND=1 -DHAVE_TRUNC=1 -DHAVE_FLOOR=1 -DHAVE_CEIL=1 -DHAVE_NEARBYINT=1 -DHAVE_ATTRIBUTE_MODE=1 -DHAVE_ALLOCA_H=1 -I. -I../../gcc/mpfr -I/dev2/cm3/m3-sys/m3cc/PPC_DARWIN/./gmp -I/dev2/cm3/m3-sys/m3cc/PPC_DARWIN/./gmp/tune -g -MT get_patches.lo -MD -MP -MF .deps/get_patches.Tpo -c get_patches.c -o get_patches.o
powerpc-apple-darwin8-gcc-4.0.1: get_patches.c: No such file or directory
I'll investigate.
I was able to build them on another machine via apt-get source. Maybe you missed a file?
I'll look..
- Jay
CC: m3devel at elegosoft.com
From: hosking at cs.purdue.edu
To: jayk123 at hotmail.com
Subject: Re: [M3devel] a hope for dynamic linking!
Date: Sat, 19 Apr 2008 11:34:38 -0400
Regular Modula-3 app stuff should build statically already, where it makes sense. build_standalone() achieves this. On some systems static libraries for certain system libraries are not available and cannot be assumed. We always build static Modula-3 libraries, so the current setup will link those statically even if other libraries are not available. For example, cm3 on I386_DARWIN gives:
hosking$ otool -L /usr/local/cm3/bin/cm3/usr/local/cm3/bin/cm3: /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.0.0) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
Notice that all the M3 libraries are static, but libgcc and friends are dynamic.
So, I don't know what you are attempting to do. Did you try --disable-shared for m3cc configuration?
On Apr 19, 2008, at 11:10 AM, Jay wrote:(ok, actually I meant maybe for cm3cg but ok either way, there'd only be one use of "/usr/local/cm3/bin/libgmp.so" so might as well be static)
From: jayk123 at hotmail.com
To: hosking at cs.purdue.edu
Date: Sat, 19 Apr 2008 15:02:44 +0000
CC: m3devel at elegosoft.com
Subject: Re: [M3devel] a hope for dynamic linking!
I mean for the "regular" Modula-3 "app" stuff, not cm3cg.
It looks like it is already static, good.
1) http://gcc.gnu.org/ml/gcc/2006-10/msg00141.html
2) The current code:
m3-sys/m3cc/gcc/Makefile.in:
configure-gmp:
...
echo Configuring in $(HOST_SUBDIR)/gmp; \
...
$(HOST_CONFIGARGS) --build=${build_alias} --host=none-${host_vendor}-${host_os} \
--target=none-${host_vendor}-${host_os} $${srcdiroption} --disable-shared \
|| exit 1
@endif gmp
configure-mpfr:
...
echo Configuring in $(HOST_SUBDIR)/mpfr; \
...
$(HOST_CONFIGARGS) --build=${build_alias} --host=none-${host_vendor}-${host_os} \
--target=none-${host_vendor}-${host_os} $${srcdiroption} --disable-shared --with-gmp-build=$$r/$(HOST_SUBDIR)/gmp \
|| exit 1
@endif mpfr
Let me test it and then I'll remove the Quake code related to this.
- Jay
CC: m3devel at elegosoft.com
From: hosking at cs.purdue.edu
To: jayk123 at hotmail.com
Subject: Re: [M3devel] a hope for dynamic linking!
Date: Sat, 19 Apr 2008 10:50:04 -0400
Hold on! I am strongly in favor of static linking for cm3cg/m3cgc1 so that it is a standalone executable. Should be easy enough with gcc configure.
On Apr 19, 2008, at 10:31 AM, Jay wrote:http://www.eyrie.org/~eagle/notes/rpath.html
http://people.debian.org/~che/personal/rpath-considered-harmful
but yet:
http://www.scons.org/wiki/UsingOrigin
So you can either colocate executables and .sos in the same directory or, like
/cm3/bin
/cm3/lib/m3core.so
and vary the install root.
We should be using this where available -- Linux, Solaris, Irix.
Too bad not supported elsewhere.
On Windows you can colocate; the .exe's directory is always searched.
- Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20080419/363f2630/attachment-0002.html>
More information about the M3devel
mailing list