I Need some Advice/Help getting libff1-3.3 to build on Windows.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

I Need some Advice/Help getting libff1-3.3 to build on Windows.

Sourceware - libffi-discuss mailing list
I have a requirement to upgrade libffi from 3.2.1 to 3.3. Currently we
build 3.2.1 via a Visual Studio solution someone pulled from the web before
my time. The command we use to build within our infrastructure is devenv.com
/ps:abi:x86_64 "libffi\\ms\\libffi.sln" /build "Debug|x64" /project
"libffi". This doesn't seem to be an option with 3.3 as they removed the
#ifdef _MSC_VER from libffi/src/x86/win64.S. So, the generated win64.asm
fails to compile.

So I am investigating if I can just build libffi the way it is recommended
to be built. I found/followed these instructions from
https://github.com/libffi/libffi

This command fails:
I:\libffi-3.3>sh ./configure CC="I:\libffi-3.3\msvcc.sh -m64"
CXX="I:\libffi-3.3\msvcc.sh -m64" CPP="cl -nologo -EP"
CPPFLAGS="-DFFI_BUILDING_DLL" --build=x86_64-w64-mingw32
--host=x86_64-w64-mingw32
...
configure: error: in `/cygdrive/i/libffi-3.3/x86_64-w64-mingw32':
configure: error: C compiler cannot create executables
See `config.log' for more details (attached)

This command gets farther but still fails (removed CC= and CXX= parms):
I:\libffi-3.3>sh ./configure CPP="cl -nologo -EP"
CPPFLAGS="-DFFI_BUILDING_DLL" --build=x86_64-w64-mingw32
--host=x86_64-w64-mingw
configure: error: in `/cygdrive/i/libffi-3.3/x86_64-w64-mingw32':
configure: error: C preprocessor "cl -nologo -EP" fails sanity check
See `config.log' for more details

This command completes successfully (removed CPP= parm):
I:\libffi-3.3>sh ./configure CPPFLAGS="-DFFI_BUILDING_DLL"
--build=x86_64-w64-mingw32 --host=x86_64-w64-mingw
...
So then I run Make and it fails:
I:\libffi-3.3>make
... the process then hangs with this the last echoed command:
/bin/sh ./libtool --tag=CC --mode=link gcc -O3 -fomit-frame-pointer
-fstrict-aliasing -ffast-math -march=core-avx2 -Wall -fexceptions -o
libffi_convenience.la src/prep_cif.lo src/types.lo src/raw_api.lo
src/java_raw_api.lo src/closures.lo src/x86/ffi.lo src/x86/sysv.lo
I left it in this state for 24hrs before canceling it, at which time it
echoed this:
Makefile:1071: recipe for target 'libffi_convenience.la' failed
make[3]: *** [libffi_convenience.la] Interrupt
Makefile:1347: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Interrupt
Makefile:622: recipe for target 'all' failed
make[1]: *** [all] Interrupt
Makefile:592: recipe for target 'all-all' failed
make: *** [all-all] Interrupt

I found another set of instructions for compiling on windows
https://proj.goldencode.com/projects/p2j/wiki/Building_and_Installing_libffi_on_Windows.
When I followed those instructions, the configure step completed without
issue. However, the make ended with an error similar to the one above (the
highlighted line is different - so is probably the line that was hanging
above):

/bin/sh ./libtool  --tag=CC   --mode=link gcc  -O3 -fomit-frame-pointer
-fstrict-aliasing -ffast-math -march=core-aWall -fexceptions   -o
libffi_convenience.la  src/prep_cif.lo src/types.lo src/raw_api.lo
src/java_raw_api.lo src/ces.lo   src/x86/ffi.lo src/x86/sysv.lo
libtool: link: lib -OUT:.libs/libffi_convenience.lib src/.libs/prep_cif.o
src/.libs/types.o src/.libs/raw_api.o srcs/java_raw_api.o
src/.libs/closures.o src/x86/.libs/ffi.o src/x86/.libs/sysv.o
./libtool: line 1741: lib: command not found
make[3]: *** [libffi_convenience.la] Error 127
make[3]: Leaving directory `/i/libffi-3.3/x86_64-w64-mingw32'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/i/libffi-3.3/x86_64-w64-mingw32'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/i/libffi-3.3/x86_64-w64-mingw32'
make: *** [all-all] Error 2

config.log (21K) Download Attachment
ms.zip (3K) Download Attachment