Subject: problem with current devel libtool and cxx configuration
From: "Ralf Habacker" <[email-masked]>
To: "cygwin" <[email-masked]>
Cc: "Charles Wilson" <[email-masked]>
Date: Sat, 6 Apr 2002 20:53:24 +0200

Hi all,

I'm using the cygwin devel libtool for a helper library for
the kde-cygwin port.

With the libtool-devel-20020202-1 I had a problem with the
cxx configuration, which prohibits linking of shared
libraries.
The message was:
libtool: link: warning: undefined symbols not allowed in
i686-pc-cygwin shared libraries

I have fixed this with the following patch in the CXX tag
configuration area:

$ diff /usr/autotool/devel/share/aclocal/libtool.m4.orig
/usr/autotool/devel/sh
are/aclocal/libtool.m4 -ubBp
--- /usr/autotool/devel/share/aclocal/libtool.m4.orig   Sat
Apr  6 15:43:16 2002
+++ /usr/autotool/devel/share/aclocal/libtool.m4        Sat
Apr  6 17:06:58 2002
@@ -2554,8 +2554,8 @@ case $host_os in
     # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is
actually meaningless,
     # as there is no search path for DLLs.
     _LT_AC_TAGVAR(hardcode_libdir_flag_spec,
$1)='-L$libdir'
-    _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
-    _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+    _LT_AC_TAGVAR(allow_undefined_flag, $1)=no
+    _LT_AC_TAGVAR(always_export_symbols, $1)=no

     if $LD --help 2>&1 | egrep 'auto-import' > /dev/null;
then
       _LT_AC_TAGVAR(archive_cmds,
$1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs
$postdep_objects $compil
er_flags -o $output_objdir/$soname
${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'

With the libtool-devel-20020316 release this patch doesn't
work. Instead the default configuration area is used and a
static library is created.

$ make
source='profiler.cpp' object='profiler.lo' libtool=yes \
depfile='.deps/profiler.Plo'
tmpdepfile='.deps/profiler.TPlo' \
depmode=gcc /bin/sh ./admin/depcomp \
/bin/sh ./libtool --mode=compile
g++ -DPACKAGE=\"profiler\" -DVERSION=\"1.3.1\" -DHAVE_DLFCN_
H=1 -DHAVE_WINDOWS_H=1  -I.
 -I.     -g -O2 -c -o profiler.lo `test -f profiler.cpp ||
echo './'`profiler.cpp
mkdir .libs

g++ -DPACKAGE=\"profiler\" -DVERSION=\"1.3.1\" -DHAVE_DLFCN_
H=1 -DHAVE_WINDOWS_H=1 -I. -I. -g -O2 -c profiler.cpp -Wp,-
MD,.deps/profiler.TPlo  -DPIC -o .libs/profiler.o
/bin/sh ./libtool --mode=link g++  -g -O2   -o
libprofiler.la -rpath /usr/local/lib -version-info `echo
1.3.1 | gawk 'BE
GIN { FS="."; } { print $1 ":" $2; }'` profiler.lo
libtool: link: warning: undefined symbols not allowed in
i686-pc-cygwin shared libraries
ar cru .libs/libprofiler.a  .libs/profiler.o
ranlib .libs/libprofiler.a
creating libprofiler.la
(cd .libs && rm -f libprofiler.la && ln -s ../libprofiler.la
libprofiler.la)

After setting the allow_undefined_flag="no" in the libtool
default configuration the dll is created with using nm to
generate a symbols list.

$ make
source='profiler.cpp' object='profiler.lo' libtool=yes \
depfile='.deps/profiler.Plo'
tmpdepfile='.deps/profiler.TPlo' \
depmode=gcc /bin/sh ./admin/depcomp \
/bin/sh ./libtool --mode=compile
g++ -DPACKAGE=\"profiler\" -DVERSION=\"1.3.1\" -DHAVE_DLFCN_
H=1 -DHAVE_WINDOWS_H=1  -I.
 -I.     -g -O2 -c -o profiler.lo `test -f profiler.cpp ||
echo './'`profiler.cpp
mkdir .libs

g++ -DPACKAGE=\"profiler\" -DVERSION=\"1.3.1\" -DHAVE_DLFCN_
H=1 -DHAVE_WINDOWS_H=1 -I. -I. -g -O2 -c profiler.cpp -Wp,-
MD,.deps/profiler.TPlo  -DPIC -o .libs/profiler.o
/bin/sh ./libtool --mode=link g++  -g -O2   -o
libprofiler.la -rpath /usr/local/lib -version-info `echo
1.3.1 | gawk 'BE
GIN { FS="."; } { print $1 ":" $2; }'` profiler.lo
generating symbol list for `libprofiler.la'
/usr/local/bin/nm -B  .libs/profiler.o  | sed -n -e
*[     ]\([ABCDGISTW][ABCDGISTW]*\)[   ][      ]*\(_\)\([_A-
Za-
z][_A-Za-z0-9]*\)$/\1 \2\3 \3/p' | sed 's/.* //' | sort |
uniq > .libs/libprofiler.exp
gcc -shared  .libs/profiler.o   -o
.libs/cygprofiler-1.dll -Wl,-retain-symbols-file -Wl,.libs/l
ibprofiler.exp -Wl,--out-
implib,.libs/libprofiler.dll.a
Creating library file: .libs/libprofiler.dll.a
warning: exporting
/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/libgcc.a rejected
(auto-export)
warning: exporting /usr/lib/libcygwin.a rejected
(auto-export)
warning: exporting /usr/lib/w32api/libkernel32.a rejected
(auto-export)
warning: exporting
/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/libgcc.a rejected
(auto-export)
num_of_bfd=42 num_of_left_bfd=0 whole_size=    3268
whole_reduced_size=    3264
creating libprofiler.la
(cd .libs && rm -f libprofiler.la && ln -s ../libprofiler.la
libprofiler.la)

The nm using is removed by setting always_export_symbols=no
in the default configuration area.

$ make
source='profiler.cpp' object='profiler.lo' libtool=yes \
depfile='.deps/profiler.Plo'
tmpdepfile='.deps/profiler.TPlo' \
depmode=gcc /bin/sh ./admin/depcomp \
/bin/sh ./libtool --mode=compile
g++ -DPACKAGE=\"profiler\" -DVERSION=\"1.3.1\" -DHAVE_DLFCN_
H=1 -DHAVE_WINDOWS_H=1  -I.
 -I.     -g -O2 -c -o profiler.lo `test -f profiler.cpp ||
echo './'`profiler.cpp
mkdir .libs

g++ -DPACKAGE=\"profiler\" -DVERSION=\"1.3.1\" -DHAVE_DLFCN_
H=1 -DHAVE_WINDOWS_H=1 -I. -I. -g -O2 -c profiler.cpp -Wp,-
MD,.deps/profiler.TPlo  -DPIC -o .libs/profiler.o
/bin/sh ./libtool --mode=link g++  -g -O2   -o
libprofiler.la -rpath /usr/local/lib -version-info `echo
1.3.1 | gawk 'BE
GIN { FS="."; } { print $1 ":" $2; }'` profiler.lo
gcc -shared  .libs/profiler.o   -o
.libs/cygprofiler-1.dll -Wl,--image-base=0x10000000 -Wl,--ou
t-implib,.libs/libprofile
r.dll.a
Creating library file: .libs/libprofiler.dll.a
warning: exporting
/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/libgcc.a rejected
(auto-export)
warning: exporting /usr/lib/libcygwin.a rejected
(auto-export)
warning: exporting /usr/lib/w32api/libkernel32.a rejected
(auto-export)
warning: exporting
/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/libgcc.a rejected
(auto-export)
num_of_bfd=42 num_of_left_bfd=0 whole_size=    3268
whole_reduced_size=    3264
creating libprofiler.la
(cd .libs && rm -f libprofiler.la && ln -s ../libprofiler.la
libprofiler.la)

Any ideas ?

Ralf Habacker

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/