I am working on some gnu libtool notes, here is a first and very rough draft.

Peter


Problem:
libtool always links against the installed library, not the one it just built.
Solution:
On some older versions of libtool the var hardcode_direct is set to yes. If you patch configure to change this to no, it will link against the just built lib.
Example Patch:
--- mysql-4.0.13/configure.old Fri Jun 13 22:51:38 2003
+++ mysql-4.0.13/configure Fri Jun 13 22:52:44 2003
@@ -6059,8 +6059,9 @@
# We need to add '_' to the symbols in $export_symbols first
#archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
- hardcode_direct=yes
+ hardcode_direct=no



Problem:
My build stops with : ld - undefined symbol "foo", but the symbol in the lib is "_foo"


Solution:
The package is likely using the libtool flag "-export-symbols" to limit the exported symbols from the shared library. On some versions of libtool this is set to a default which fails on darwin.


Set the archive_expsym_cmds to the empty string on configure and it should work.

To modify the above patch:
      # We need to add '_' to the symbols in $export_symbols first
-     #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
+     archive_expsym_cmds=''

You could go nuts and change it to something like:
archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym && $CC $(test x$module = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags $(test x$module != xyes && echo -install_name $rpath/$soname $verstring) && nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'


but note that not only have I not tested the above it will fail on Mac OS X 10.1 and earlier because zsh is the default shell. You will also have to add the following patch to ensure that zsh does not eat some of the "'s:
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi


Problem:
libtool complains about illegal reference to symbol from indirectly referenced shared library foo



Solution:
The followin patch to ltmain.sh will make sure that libtool links against all deplibs, really it should be using the ld flag -dylib_file to do this, but since two level namespace requires that such libs be linked in, it links them in.
--- foo/ltmain.sh 29 Aug 2002 04:12:30 -0000 1.7
+++ foo/ltmain.sh 13 May 2003 12:33:35 -0000
@@ -2370,7 +2370,11 @@
;;
esac
if grep "^installed=no" $deplib > /dev/null; then
- path="-L$absdir/$objdir"
+ if test -d "$absdir/$objdir"; then
+ path="$absdir/$objdir"
+ else
+ path="$absdir"
+ fi
else
eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
if test -z "$libdir"; then
@@ -2380,11 +2384,56 @@
if test "$absdir" != "$libdir"; then
$echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
fi
- path="-L$absdir"
+ path="$absdir"
+ fi
+ depdepl=
+ case $host in
+ *-*-darwin*)
+ # we do not want to link against static libs, but need to link against shared
+ eval deplibrary_names=`sed -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+ if test -n "$deplibrary_names" ; then
+ for tmp in $deplibrary_names ; do
+ depdepl=$tmp
+ done
+ if test -f "$path/$depdepl" ; then
+ depdepl="$path/$depdepl"
+ fi
+
+ case " $newlib_search_path " in
+ *" $path "*) ;;
+ *) newlib_search_path="$newlib_search_path $path" ;;
+ esac
+ path=""
fi
;;
+ *)
+ path="-L$path"
+ ;;
+ esac
+
+ ;;
+ -l*)
+ case $host in
+ *-*-darwin*)
+ # Again, we only want to link against shared libraries
+ eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
+ for tmp in $newlib_search_path ; do
+ if test -f "$tmp/lib$tmp_libs.dylib" ; then
+ eval depdepl="$tmp/lib$tmp_libs.dylib"
+ break
+ fi
+ done
+ path=""
+ ;;
*) continue ;;
esac
+ ;;
+ *) continue ;;
+ esac
+ case " $deplibs " in
+ *" $depdepl "*) ;;
+ *) deplibs="$deplibs $depdepl" ;;
+ esac
case " $deplibs " in
*" $path "*) ;;
*) deplibs="$deplibs $path" ;;




-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Fink-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-devel

Reply via email to