通过Swig的Java绑定Makefile失败

时间:2017-02-14 07:17:07

标签: makefile swig gdal nmake

我有一个用于公共GIS库(GDAL)的Java绑定的makefile,我想从源代码编译。主要可执行文件的编译确实有效,但绑定不会编译。也许有人对我有建议。

我在我的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.

路径是正确的,但为什么它会返回未知的对象类型?我做错了吗?

1 个答案:

答案 0 :(得分:0)

路径的空格导致错误的解析。因此它没有编译。