Subject: Re: bug#16259: when cross-compiling with LT_INIT([win32-dll]) wrappers are installed instead of real programs

From: Peter Rosin <[email-masked]>
Date: Tue, 07 Jan 2014 17:48:33 +0100

On 2014-01-07 15:08, Peter Rosin wrote:
> On 2013-12-26 15:00, Marcin Wojdyr wrote:
>> Hello,
>> 1.5 years ago I reported this as a bug for automake.
>> Stefano Lattarini just replied that it
>> looks like a libtool bug rather than an Automake one.
>> The details are here:
>> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11155
> 
> Hi Marcin!
> 
> I fail to reproduce. What is your $host and $build? Can you provide a
> stripped down example?

I just realized that I didn't cross-compile. Oops. But I still cannot
reproduce (when crossing from Cygwin to MinGW), so the question still
holds: What is your $host and $build?

Cheers,
Peter

$ cat lttest.c
int foo(void)
{
  return 1;
}
$ cat ltexe.c
int foo(void);
int main(void)
{
  foo();
  return 0;
}
$ cat configure.ac
AC_INIT([lttest], [0.1], [[email-masked]])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC
LT_INIT([win32-dll])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
$ cat Makefile.am
AUTOMAKE_OPTIONS = subdir-objects foreign
ACLOCAL_AMFLAGS = -I m4
lib_LTLIBRARIES = liblttest.la
liblttest_la_SOURCES = lttest.c
liblttest_la_LDFLAGS = -shared -no-undefined
bin_PROGRAMS = ltexe
ltexe_SOURCES = ltexe.c
ltexe_LDADD = liblttest.la
$ mkdir -p build-aux m4
$ autoreconf -i
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
libtoolize: copying file `build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
configure.ac:5: installing 'build-aux/compile'
configure.ac:6: installing 'build-aux/config.guess'
configure.ac:6: installing 'build-aux/config.sub'
configure.ac:4: installing 'build-aux/install-sh'
configure.ac:4: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
$ ./configure --host=i686-pc-mingw32 --prefix=/home/peda/src/junk
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for i686-pc-mingw32-strip... i686-pc-mingw32-strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
.
. *snip*
.
checking whether to build static libraries... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
config.status: executing libtool commands
$ ./libtool --version
libtool (GNU libtool) 2.4
Written by Gordon Matzigkeit <[email-masked]>, 1996

Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ make V=0
  CC       lttest.lo
  CCLD     liblttest.la
  CC       ltexe.o
  CCLD     ltexe.exe
$ make install
make[1]: Entering directory '/home/peda/src/junk'
 /usr/bin/mkdir -p '/home/peda/src/junk/lib'
 /bin/sh ./libtool   --mode=install /usr/bin/install -c   liblttest.la '/home/peda/src/junk/lib'
libtool: install: /usr/bin/install -c .libs/liblttest.dll.a /home/peda/src/junk/lib/liblttest.dll.a
libtool: install: base_file=`basename liblttest.la`
libtool: install:  dlpath=`/bin/sh 2>&1 -c '. .libs/'liblttest.la'i; echo liblttest-0.dll'`
libtool: install:  dldir=/home/peda/src/junk/lib/`dirname ../bin/liblttest-0.dll`
libtool: install:  test -d /home/peda/src/junk/lib/../bin || mkdir -p /home/peda/src/junk/lib/../bin
libtool: install:  /usr/bin/install -c .libs/liblttest-0.dll /home/peda/src/junk/lib/../bin/liblttest-0.dll
libtool: install:  chmod a+x /home/peda/src/junk/lib/../bin/liblttest-0.dll
libtool: install:  if test -n '' && test -n 'i686-pc-mingw32-strip --strip-unneeded'; then eval 'i686-pc-mingw32-strip --strip-unneeded /home/peda/src/junk/lib/../bin/liblttest-0.dll' || exit 0; fi
libtool: install: /usr/bin/install -c .libs/liblttest.lai /home/peda/src/junk/lib/liblttest.la
 /usr/bin/mkdir -p '/home/peda/src/junk/bin'
  /bin/sh ./libtool   --mode=install /usr/bin/install -c ltexe.exe '/home/peda/src/junk/bin'
libtool: install: /usr/bin/install -c .libs/ltexe.exe /home/peda/src/junk/bin/ltexe.exe
make[1]: Nothing to be done for 'install-data-am'.
make[1]: Leaving directory '/home/peda/src/junk'