cross compilation for Windows (mingw-w64) on Linux error when installing luajit

  • From: Vincent Torri <vincent.torri@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 30 Aug 2018 08:59:59 +0200

Hello

I want to cross-compile luajit on Fedore, targetting Windows (I use
the mingw-w64 toolchain).

I run the make command like this :
make PREFIX=$HOME/luajit HOST_CC="gcc -m32" CROSS=i686-w64-mingw32-
TARGET_SYS=Windows BUILDMODE=dynamic

luajit is compiled and I see in src/ the files luajit.exe and lua51.dll

but when installing i get this error :
cd src && install -m 0755 luajit /home/vtorri/luajit/bin/luajit-2.0.5
install: impossible d'évaluer 'luajit': Aucun fichier ou dossier de ce type

(translating : luajit file not found)


It is normal as the executable is luajit.exe and not luajit (which is
the name on UNIX), see toplevel Makefile

So I think that on Windows, the name of the binary must be fixed

I have also several remarks for the installation (i looked a bit at
the toplevel Makefile) :

 * usually, on Windows, an import library is created beside the DLL.
It is done by passing -Wl,--out-implib,liblua.dll.a to linker. I did
that by adding to the make command : TARGET_XSHLDFLAGS="-shared
-Wl,--out-implib,liblua.dll.a"

It then creates the liblua.dll.a import library. The name follows
libtool names (.lib extension can mean, in Visual Studio world a
static library or an import library, so I have chosen .dll.a for
import library).

but of course there is no way to install this import library except by
changing Makefile

 * The installation of the DLL will also fail (wrong name, and wrong
installation directory : DLL are installed in the bin directory)

To not modify the Makefile (i'm writing a package installer for
different libraries) I have to pass plenty of options to 'make' as
well as sed commands to modify Makefile, to have something working
more or less.

Is it possible to fix these issues ?

thank you

Vincent Torri

Other related posts: