cross build error: libtool: line 1112: lib: command not found

3.2k views Asked by At

I'm attempting to cross-build an application from Linux for windows using M Cross Environment which is really just a system of makefiles which help use the Mingw-w64 tools. The build system for the application is autotools.

When I try the build I get and error like the following:

libtool: link: lib -OUT:.libs/liby12.lib  y12mae.o y12maf.o y12mbe.o y12mbf.o y12mce.o y12mcf.o y12mde.o y12mdf.o y12mfe.o y12mge.o y12mhe.o
../../libtool: line 1112: lib: command not found
make[4]: *** [liby12.la] Error 127
make[4]: Leaving directory `/opt/mxe/tmp-mbdyn-i686-w64-mingw32.static/mbdyn-1.7.1.build_/libraries/liby12'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/opt/mxe/tmp-mbdyn-i686-w64-mingw32.static/mbdyn-1.7.1.build_/libraries'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/opt/mxe/tmp-mbdyn-i686-w64-mingw32.static/mbdyn-1.7.1.build_'
make[1]: *** [build-only-mbdyn_i686-w64-mingw32.static] Error 2
make[1]: Leaving directory `/opt/mxe'

Can anyone explain what the problem is?

Someone else has a similar problem in this stackoverflow question, although they appear to be building natively on windows. There is also discussion on a mailing list here. Neither of these sources gives enough information for someone with my limited knowledge of libtool to solve the problem (I don't even know what line 1112 is referring to, i.e. line 1112 of what exactly, libtool itself? This is a comment line in libtool).

EDIT:

I have discovered the following thread:

http://cygwin.1069669.n5.nabble.com/libtool-link-object-name-conflicts-in-archive-td107913.html#a107969

which is actually about compiling on cygwin the same application I am cross-compiling (mbdyn, but an earlier version). It seems the issue might be due to configure creating a libtool script in the source directory. I'm guessing this clashes with the cross-compiler libtool script or something like this.

So what is the correct way to fix this libtool issue?

1

There are 1 answers

0
crobar On BEST ANSWER

The problem was actually answered in the link posted. The problem was that AC_PROG_F77 needed to be called outside a conditional statement in configure.ac. Otherwise libtool gets confused when doing the cross compile as the fortran compiler is specified and the conditional is never triggered.