2016-03-22 6 views
0

Ich möchte JNA-Bibliothek auf 32-Bit-Cygwin oder auf 32-Bit-Debian-Linux mit -Dskip-native = false-Parameter kompilieren. Ich habe die erforderlichen Pakete installiert, sie können jedoch nicht kompiliert werden. Es kann problemlos auf 64-Bit-Cygwin oder 64-Bit-Debian-Linux kompiliert werden (für 64-Bit-Ziel), kann aber nicht auf 32-Bit-Plattformen kompiliert werden. Ich habe auch versucht, die Quellen auf jna-4.2.1/dist/src-full-Ordner zu kompilieren, aber es konnte nicht kompiliert werden.Wie kann ich JNAs native Bits unter Windows für 32- und 64-Bit-Ziele kompilieren?

Ich verwende die folgenden Parameter für 32-Bit-Ziel.

Ich habe die folgenden Fehlermeldungen auf 64-Bit Cygwin (mit den gleichen Parametern).

[exec] /cygdrive/d/Projects/jna-4.2.1/dist/src-full/native/libffi/src/x86/win64.S: Assembler messages: 
[exec] /cygdrive/d/Projects/jna-4.2.1/dist/src-full/native/libffi/src/x86/win64.S:286: Error: bad register name `%r11' 
[exec] /cygdrive/d/Projects/jna-4.2.1/dist/src-full/native/libffi/src/x86/win64.S:288: Error: bad register name `%rcx' 
[exec] /cygdrive/d/Projects/jna-4.2.1/dist/src-full/native/libffi/src/x86/win64.S:291: Error: bad register name `%rsp)' 
[exec] /cygdrive/d/Projects/jna-4.2.1/dist/src-full/native/libffi/src/x86/win64.S:294: Error: bad register name `%r11' 

... 
[exec] /cygdrive/d/Projects/jna-4.2.1/dist/src-full/native/libffi/src/x86/win64.S:516: Error: bad register name `%rbp' 
[exec] /cygdrive/d/Projects/jna-4.2.1/dist/src-full/native/libffi/src/x86/win64.S:517: Error: unsupported instruction `ret' 
[exec] /cygdrive/d/Projects/jna-4.2.1/dist/src-full/native/libffi/src/x86/win64.S:518: Warning: zero assumed for missing expression 
[exec] /cygdrive/d/Projects/jna-4.2.1/dist/src-full/native/libffi/src/x86/win64.S:518: Warning: zero assumed for missing expression 
[exec] Makefile:1345: recipe for target 'src/x86/win64.lo' failed 
[exec] make[3]: Leaving directory '/cygdrive/d/Projects/jna-4.2.1/dist/src-full/build/native-win32-x86/libffi' 
[exec] Makefile:1603: recipe for target 'all-recursive' failed 
[exec] make[2]: Leaving directory '/cygdrive/d/Projects/jna-4.2.1/dist/src-full/build/native-win32-x86/libffi' 
[exec] Makefile:741: recipe for target 'all' failed 
[exec] make[1]: Leaving directory '/cygdrive/d/Projects/jna-4.2.1/dist/src-full/build/native-win32-x86/libffi' 
[exec] Makefile:449: recipe for target '../build/native-win32-x86/libffi/.libs/libffi.a' failed 
[exec] make[3]: *** [src/x86/win64.lo] Error 1 
[exec] make[2]: *** [all-recursive] Error 1 
[exec] make[1]: *** [all] Error 2 
[exec] make: *** [../build/native-win32-x86/libffi/.libs/libffi.a] Error 2 

BUILD FAILED 
D:\Projects\jna-4.2.1\dist\src-full\build.xml:813: exec returned: 2 

Ich bekomme die folgenden Fehler auf 32-Bit Cygwin.

[echo] os.prefix=win32-x86 
[echo] os.name=Windows 7 
[echo] os.arch=x86 (little) 
[echo] build=build 
[echo] build.native=D:\Projects\jna-4.2.1\dist\src-full\build\native-win32-x86 

-setup: 

compile: 
[javac] Compiling 59 source files to D:\Projects\jna-4.2.1\dist\src-full\build\classes 
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6 
[javac] Note: Some input files use unchecked or unsafe operations. 
[javac] Note: Recompile with -Xlint:unchecked for details. 
[javac] 1 warning 

javah: 

-native-api-check: 

:rsrc: 

rsrc: 
[copy] Copying 1 file to D:\Projects\jna-4.2.1\dist\src-full\build\native-win32-x86 

native: 
[exec] Generating configure 
[exec] autoreconf-2.69: Entering directory `.' 
[exec] autoreconf-2.69: configure.ac: not using Gettext 
[exec] autoreconf-2.69: running: aclocal --force -I m4 
[exec] autoreconf-2.69: configure.ac: tracing 
[exec] autoreconf-2.69: running: libtoolize --copy --force 
[exec] libtoolize: putting auxiliary files in '.'. 
[exec] libtoolize: copying file './ltmain.sh' 
[exec] libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'. 
[exec] libtoolize: copying file 'm4/libtool.m4' 
[exec] libtoolize: copying file 'm4/ltoptions.m4' 
[exec] libtoolize: copying file 'm4/ltsugar.m4' 
[exec] libtoolize: copying file 'm4/ltversion.m4' 
[exec] libtoolize: copying file 'm4/lt~obsolete.m4' 
[exec] autoreconf-2.69: running: /usr/bin/autoconf-2.69 --force 
[exec] autoreconf-2.69: running: /usr/bin/autoheader-2.69 --force 
[exec] autoreconf-2.69: running: automake --add-missing --copy --force-missing 
[exec] Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /usr/bin/automake-1.15 line 3936. 
[exec] configure.ac:31: installing './compile' 
[exec] configure.ac:19: installing './missing' 
[exec] Makefile.am: installing './depcomp' 
[exec] Configuring libffi (x86) 
[exec] autoreconf-2.69: Leaving directory `.' 
[exec] checking build system type... i686-pc-cygwin 
[exec] checking host system type... i686-pc-cygwin 
[exec] checking target system type... i686-pc-cygwin 
[exec] checking for gsed... sed 
[exec] checking for a BSD-compatible install... /usr/bin/install -c 
[exec] checking whether build environment is sane... yes 
[exec] checking for a thread-safe mkdir -p... /usr/bin/mkdir -p 
[exec] checking for gawk... gawk 
[exec] checking whether make sets $(MAKE)... yes 
[exec] checking whether make supports nested variables... yes 
[exec] checking for gcc... i686-pc-mingw32-gcc 
[exec] checking whether the C compiler works... no 
[exec] configure: error: in `/cygdrive/d/Projects/jna-4.2.1/dist/src-full/build/native-win32-x86/libffi': 
[exec] configure: error: C compiler cannot create executables 
[exec] See `config.log' for more details 
[exec] Makefile:449: recipe for target '../build/native-win32-x86/libffi/.libs/libffi.a' failed 
[exec] make: *** [../build/native-win32-x86/libffi/.libs/libffi.a] Error 77 

BUILD FAILED 
D:\Projects\jna-4.2.1\dist\src-full\build.xml:813: exec returned: 2 

Total time: 50 seconds 

Ich konnte nicht verstehen, warum es heißt „[exec] Prüfen, ob der C-Compiler funktioniert ... nein“, obwohl ich alle Pakete Entwicklung und lib-Pakete auf 32-Bit-Cygwin und obwohl gcc funktioniert.

Wie kann ich jna native Bibliotheken für 32-Bit-Plattformen kompilieren?

+0

-Dos.prefix ist überflüssig; Solange Sie ant von einer 32-Bit-JVM aufrufen, werden die richtigen Einstellungen vorgenommen. Wie bei der Compiler-Prüfung müssen Sie in "config.log" nachsehen, warum die Prüfung fehlgeschlagen ist. – technomage

+0

Wenn Sie 64-Bit-Cygwin zum Ausführen der Kompilierung verwenden, müssen Sie wahrscheinlich die Eingaben auf "configure" umstellen, um anzuzeigen, dass Sie für einen 32-Bit-Host kompilieren möchten (standardmäßig wird für 64-Bit konfiguriert) Gastgeber). Siehe FFI_CONFIG im Makefile, "configure" benötigt ein "--host = i686-pc-mingw32" Argument oder etwas Ähnliches. – technomage

+0

Ich habe 32-Bit jdk zu den Systemvariablen PATH und JAVA_HOME hinzugefügt, und seit ich die Kompilierung mit ant starte, sollte die Konfiguration von ant erfolgen. Außerdem gibt es in der Quellverteilung von jna kein Skript mit dem Namen "configure". Die Konfiguration wird vollständig von ant durchgeführt, wobei die Systemvariable ANT_OPTS verwendet wird. Wenn ich 32-Bit-Cygwin und 32-Bit-JDK verwende, sollte nicht --host = i686-pc-mingw32 übergeben werden, um Skript automatisch von ant machen? –

Antwort

0

config.log Laut wird configure hier versagt:

/cygdrive/d/Projects/jna-4.2.1/native/libffi/configure: line 3927: i686-pc-mingw32-gcc: command not found

Stellen Sie sicher, dass Ihre Cross-Compiler auf Ihrem Weg ist oder CC=/path/to/your-cross-compiler zu FFI_CONFIG hinzuzufügen.

+0

Nachdem dann i686-pc-mingw32-gcc als gcc aliasiert wurde, wird es erfolgreich kompiliert. Außerdem kann ich Cross-Compilierung auf 64-Bit-Plattformen auf die gleiche Weise durchführen oder CC wie empfohlen einstellen. Vielen Dank für die Lösung. –

+0

Ein PR oder eine Notiz an die JNA-Benutzer-Mailingliste mit den Korrekturen wäre willkommen. – technomage

+0

Ich werde das Update an JNA Benutzer Mailingliste senden. Danke noch einmal. –

Verwandte Themen