Opened 5 years ago

Closed 5 years ago

#6814 closed defect (invalid)

Can't compile Java bindings from Windows 10 - include error

Reported by: BenBo Owned by: Even Rouault
Priority: normal Milestone:
Component: JavaBindings Version: 2.1.3
Severity: normal Keywords:
Cc:

Description (last modified by BenBo)

All path in the nmake.opt file are set up correctly. Main gdal does compile and install proberbly but the bindings result in CL.exe error.

cl /nologo /MD /EHsc /Ox /FC /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG /W4 /wd4127 /wd4251 /wd4275 /wd4786 /wd4100 /wd4245 /wd4206 /wd4611 /DHAVE_SSE_AT_COMPILE_TIME -I..\..\..\port -I..\..\..\ogr -I..\..\..\gcore -I..\..\..\alg -I..\..\..\ogr\ogrsf_frmts -I..\..\..\gnm -I..\..\..\gnm\gnm_frmts -I..\..\..\apps /DHAVE_AVX_AT_COMPILE_TIME -DOGR_ENABLED -DGDAL_COMPILATION -I C:\Program Files\Java\jdk1.8.0_121\include -I C:\Program Files\Java\jdk1.8.0_121\include\win32 /c ogr_wrap.cpp

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.

It doesn't understand the object type of the JAVA_INCLUDE:

############################################################################### # 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

The compiler is set correctly: !IFNDEF MSVC_VER #assume msvc VS2008. MSVC_VER=1900 !ENDIF

Any ideas?

Change History (4)

comment:1 by BenBo, 5 years ago

Description: modified (diff)

comment:2 by Even Rouault, 5 years ago

The issue seems to be related to spaces in the JDK path and lack of quotation in the compilation directive. Try installing the jdk in a path without spaces

in reply to:  2 comment:3 by BenBo, 5 years ago

Replying to Even Rouault:

The issue seems to be related to spaces in the JDK path and lack of quotation in the compilation directive. Try installing the jdk in a path without spaces

Got it working, thanks. But only in 32Bit which prevents from being loaded in 64Bit Eclipse... Is there a quicker way to use GDAL > 2.0.0 in Java?

comment:4 by Even Rouault, 5 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.