Java 通过 Swig 绑定的 Makefile 失败
Makefile for Java Bindings via Swig fails
我有一个用于 Java 绑定的通用 GIS 库 (GDAL) 的联编文件,我想从源代码对其进行编译。主要可执行文件的编译工作正常,但绑定不编译。也许有人对我有建议。
我在 nmake.opt 文件中设置了所有路径:
###############################################################################
# Location to install .exe, .dll and python stuff
# Edit as required. GDAL_HOME is used for convenience here,
# but this particular relative organization is not mandatory.
# But the paths *should* be absolute (relative paths mess up in submakefiles).
!IFNDEF GDAL_HOME
GDAL_HOME = "C:\gdal-2.1.3\bld"
!ENDIF
!IFNDEF BINDIR
BINDIR = $(GDAL_HOME)\bin
!ENDIF
!IFNDEF PLUGINDIR
PLUGINDIR = $(BINDIR)\gdalplugins
!ENDIF
!IFNDEF LIBDIR
LIBDIR = $(GDAL_HOME)\lib
!ENDIF
!IFNDEF INCDIR
INCDIR = $(GDAL_HOME)\include
!ENDIF
!IFNDEF DATADIR
DATADIR = $(GDAL_HOME)\data
!ENDIF
!IFNDEF HTMLDIR
HTMLDIR = $(GDAL_HOME)\html
!ENDIF
# Set this to the installed directory containing python. If you don't
# have python just let it point to a directory that does not exist (as now).
!IFNDEF PYDIR
PYDIR = "C:\Software\Python24"
!ENDIF
# Set the location of your SWIG installation
!IFNDEF SWIG
SWIG = "C:\OSGeo4W64\apps\swigwin\swig.exe"
!ENDIF
# SWIG Java settings
!IFNDEF JAVA_HOME
JAVA_HOME = "C:\Program Files\Java\jdk1.8.0_121"
!ENDIF
!IFNDEF ANT_HOME
ANT_HOME="C:\OSGeo4W64\bin\apache-ant-1.10.1"
!ENDIF
JAVADOC=$(JAVA_HOME)\bin\javadoc
JAVAC=$(JAVA_HOME)\bin\javac
JAVA=$(JAVA_HOME)\bin\java
JAR=$(JAVA_HOME)\bin\jar
JAVA_INCLUDE= -I $(JAVA_HOME)\include -I $(JAVA_HOME)\include\win32
稍后 JAVA_INCLUDE 似乎会导致错误 CL.exe:
cl : Befehlszeile warning D9024 : Unbekannter Typ der Quelldatei "Files\Java\jdk1.8.0_121\include", Objektdatei wird angenommen.
cl : Befehlszeile warning D9027 : Quelldatei "Files\Java\jdk1.8.0_121\include" wird ignoriert.
cl : Befehlszeile warning D9024 : Unbekannter Typ der Quelldatei "Files\Java\jdk1.8.0_121\include\win32", Objektdatei wird angenommen.
cl : Befehlszeile warning D9027 : Quelldatei "Files\Java\jdk1.8.0_121\include\win32" wird ignoriert.
ogr_wrap.cpp
c:\gdal-2.1.3\swig\java\ogr\ogr_wrap.cpp(159): fatal error C1083: Datei (Include) kann nicht geöffnet werden: "jni.h": No such file or directory
NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.EXE"": Rückgabe-Code "0x2"
Stop.
NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.EXE"": Rückgabe-Code "0x2"Stop.
NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.EXE"": Rückgabe-Code "0x2"Stop.
路径是正确的,但为什么 return 是未知的对象类型?是不是我弄错了?
路径的空格导致解析错误。因此它没有编译。
我有一个用于 Java 绑定的通用 GIS 库 (GDAL) 的联编文件,我想从源代码对其进行编译。主要可执行文件的编译工作正常,但绑定不编译。也许有人对我有建议。
我在 nmake.opt 文件中设置了所有路径:
###############################################################################
# Location to install .exe, .dll and python stuff
# Edit as required. GDAL_HOME is used for convenience here,
# but this particular relative organization is not mandatory.
# But the paths *should* be absolute (relative paths mess up in submakefiles).
!IFNDEF GDAL_HOME
GDAL_HOME = "C:\gdal-2.1.3\bld"
!ENDIF
!IFNDEF BINDIR
BINDIR = $(GDAL_HOME)\bin
!ENDIF
!IFNDEF PLUGINDIR
PLUGINDIR = $(BINDIR)\gdalplugins
!ENDIF
!IFNDEF LIBDIR
LIBDIR = $(GDAL_HOME)\lib
!ENDIF
!IFNDEF INCDIR
INCDIR = $(GDAL_HOME)\include
!ENDIF
!IFNDEF DATADIR
DATADIR = $(GDAL_HOME)\data
!ENDIF
!IFNDEF HTMLDIR
HTMLDIR = $(GDAL_HOME)\html
!ENDIF
# Set this to the installed directory containing python. If you don't
# have python just let it point to a directory that does not exist (as now).
!IFNDEF PYDIR
PYDIR = "C:\Software\Python24"
!ENDIF
# Set the location of your SWIG installation
!IFNDEF SWIG
SWIG = "C:\OSGeo4W64\apps\swigwin\swig.exe"
!ENDIF
# SWIG Java settings
!IFNDEF JAVA_HOME
JAVA_HOME = "C:\Program Files\Java\jdk1.8.0_121"
!ENDIF
!IFNDEF ANT_HOME
ANT_HOME="C:\OSGeo4W64\bin\apache-ant-1.10.1"
!ENDIF
JAVADOC=$(JAVA_HOME)\bin\javadoc
JAVAC=$(JAVA_HOME)\bin\javac
JAVA=$(JAVA_HOME)\bin\java
JAR=$(JAVA_HOME)\bin\jar
JAVA_INCLUDE= -I $(JAVA_HOME)\include -I $(JAVA_HOME)\include\win32
稍后 JAVA_INCLUDE 似乎会导致错误 CL.exe:
cl : Befehlszeile warning D9024 : Unbekannter Typ der Quelldatei "Files\Java\jdk1.8.0_121\include", Objektdatei wird angenommen.
cl : Befehlszeile warning D9027 : Quelldatei "Files\Java\jdk1.8.0_121\include" wird ignoriert.
cl : Befehlszeile warning D9024 : Unbekannter Typ der Quelldatei "Files\Java\jdk1.8.0_121\include\win32", Objektdatei wird angenommen.
cl : Befehlszeile warning D9027 : Quelldatei "Files\Java\jdk1.8.0_121\include\win32" wird ignoriert.
ogr_wrap.cpp
c:\gdal-2.1.3\swig\java\ogr\ogr_wrap.cpp(159): fatal error C1083: Datei (Include) kann nicht geöffnet werden: "jni.h": No such file or directory
NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.EXE"": Rückgabe-Code "0x2"
Stop.
NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.EXE"": Rückgabe-Code "0x2"Stop.
NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.EXE"": Rückgabe-Code "0x2"Stop.
路径是正确的,但为什么 return 是未知的对象类型?是不是我弄错了?
路径的空格导致解析错误。因此它没有编译。