Hi,
I have successfully built and tested GDAL 3.0.1 and 3.0.4 with the SWIG java bindings and everything works fine except that I can't read GML format files. When I call the java method ogr.open( .. ), it always returns null. I investigated and i found out that I cannot open GML files with the ogrinfo app either. It seems the problem is on the native side and not on the bindings side. Here is the output of the command ogrinfo --formats for the app. [cid:2fd2948e-3523-4798-a6b1-c35c2e941e0b] I am using a configure script to build my makefiles. I read online at https://gdal.org/drivers/vector/gml.html that XERCES or EXPAT is needed to read gml files. I first started to build with only EXPAT and now I am building with EXPAT and XERCES, but I still can't read GML files. Here is my configuration output from the console. C++14 support: no LIBTOOL support: yes LIBZ support: external LIBLZMA support: no ZSTD support: no cryptopp support: no crypto/openssl support: no GRASS support: no CFITSIO support: no PCRaster support: internal LIBPNG support: internal DDS support: no GTA support: no LIBTIFF support: internal (BigTIFF=yes) LIBGEOTIFF support: internal LIBJPEG support: internal 12 bit JPEG: yes 12 bit JPEG-in-TIFF: yes LIBGIF support: internal JPEG-Lossless/CharLS: no OGDI support: no HDF4 support: no HDF5 support: no Kea support: no NetCDF support: no Kakadu support: no JasPer support: no OpenJPEG support: no ECW support: yes MrSID support: yes MrSID/MG4 Lidar support: no JP2Lura support: no MSG support: no EPSILON support: no WebP support: no cURL support (wms/wcs/...):yes PostgreSQL support: no LERC support: yes MySQL support: no Ingres support: no Xerces-C support: yes Expat support: yes libxml2 support: no Google libkml support: no ODBC support: no FGDB support: no MDB support: no PCIDSK support: internal OCI support: no GEORASTER support: no SDE support: no Rasdaman support: no DODS support: no SQLite support: yes PCRE support: no SpatiaLite support: no RasterLite2 support: no Teigha (DWG and DGNv8): no INFORMIX DataBlade support:no GEOS support: no SFCGAL support: no QHull support: internal Poppler support: no Podofo support: no PDFium support: no OpenCL support: no Armadillo support: no FreeXL support: no SOSI support: no MongoDB support: no MongoCXX v3 support: no HDFS support: no TileDB support: no userfaultfd support: yes I did not disable the gml driver and the makefile says that gml is built by default. Here is the list of the available formats listed for ogr where you can see gml. [cid:4d09603f-8ab8-4bfb-9380-3e23227760f5] Here is the call i make to configure and to make in my script file to build GDAL. [cid:9db827de-93bd-401f-ae0a-1a881134d61a] I also built GDAL 3.0.1 on Windows and the command ogrinfo --formats lists all the possible formats, including gml and maybe 50+ others. Is there a way to build gdal on linux so that all the formats are also available for ogr? I joined my script file to build gdal. Thank you for your time! Michael
#!/usr/bin/sudo bash # This shellscript contains the necessary to install gdal and its dependencies. # Current directory BASEDIR=$(pwd) # Bin files directory cd $BASEDIR rm -rf bin_x64 mkdir bin_x64 chmod 777 -R bin_x64 BINDIR=$BASEDIR/bin_x64 # Add the new directory to the system paths export LD_LIBRARY_PATH=$BINDIR:$LD_LIBRARY_PATH export LD_RUN_PATH=$BINDIR:$LD_RUN_PATH # Specify the compiler export CC="/k2/dev2/gcc/gcc-5.3.0/build/bin/gcc" export CXX="/k2/dev2/gcc/gcc-5.3.0/build/bin/g++" # Apache echo "Add Apache-Ant to the system path" export PATH=$PATH:/k2/dev2/apache/apache-ant-1.10.7/bin # Java echo "Add JDK to the system path" export JAVA_HOME=/k2/dev2/java/jdk1.8.0_171 export PATH=/k2/dev2/java/jdk1.8.0_171/bin:$PATH export LD_LIBRARY_PATH=/k2/dev2/java/jdk1.8.0_171/jre/lib/amd64:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=/k2/dev2/java/jdk1.8.0_171/jre/lib/amd64/server:$LD_LIBRARY_PATH # Swig echo "Add SWIG as a system variable" export SWIG=/k2/dev2/swig/swig-4.0.1/build/bin/swig # Perl echo "Add Perl to the system path" export PATH="/k2/dev2/perl/perl-5.30.1/build/bin":$PATH export LD_LIBRARY_PATH="/k2/dev2/perl/perl-5.30.1/build/bin":$LD_LIBRARY_PATH # SQlite echo "Copy the preinstalled SQLite library" export PATH=/k2/dev2/sqlite/sqlite-autoconf-3300100/build/bin:$PATH cp /k2/dev2/sqlite/sqlite-autoconf-3300100/build/lib/libsqlite3.so.0 $BINDIR if [[ ! -f $BINDIR/libsqlite3.so.0 ]] ; then echo 'File "libsqlite3.so.0" has not been successfully copied. Try reinstalling it by running install_prerequisites_x64.sh.' read -p "Press Enter to abort ..." exit fi # ECW echo "Copy the preinstalled ECW library" cp /k2/dev2/ecw/ecw-5.4.0/build/Desktop_Read-Only/lib/newabi/x64/release/libNCSEcw.so.5.4.0 $BINDIR if [[ ! -f $BINDIR/libNCSEcw.so.5.4.0 ]] ; then echo 'File "libNCSEcw.so" has not been successfully copied. Try reinstalling it by running install_prerequisites_x64.sh.' read -p "Press Enter to abort ..." exit fi # Zlib echo "Copy the preinstalled Zlib library" cp /k2/dev2/zlib/zlib-1.2.11/build/lib/libz.so.1 $BINDIR if [[ ! -f $BINDIR/libz.so.1 ]] ; then echo 'File "libz.so.1" has not been successfully copied. Try reinstalling it by running install_prerequisites_x64.sh.' read -p "Press Enter to abort ..." exit fi # OpenSSL echo "Copy the preinstalled OpenSSL library" cp /k2/dev2/openssl/openssl-3.0.0/build/lib/libssl.so.3 $BINDIR cp /k2/dev2/openssl/openssl-3.0.0/build/lib/libcrypto.so.3 $BINDIR if [[ ! -f $BINDIR/libssl.so.3 ]] ; then echo 'File "libssl.so.3" has not been successfully copied. Try reinstalling it by running install_prerequisites_x64.sh.' read -p "Press Enter to abort ..." exit fi if [[ ! -f $BINDIR/libcrypto.so.3 ]] ; then echo 'File "libcrypto.so.3" has not been successfully copied. Try reinstalling it by running install_prerequisites_x64.sh.' read -p "Press Enter to abort ..." exit fi # Curl echo "Copy the preinstalled Curl library" cp /k2/dev2/curl/curl-7.66.0/build/lib/libcurl.so.4 $BINDIR if [[ ! -f $BINDIR/libcurl.so.4 ]] ; then echo 'File "libcurl.so.4" has not been successfully copied. Try reinstalling it by running install_prerequisites_x64.sh.' exit fi # Expat echo "Copy the preinstalled Expat library" cp /k2/dev2/expat/libexpat-R_2_2_9/expat/build/lib/libexpat.so.1 $BINDIR if [[ ! -f $BINDIR/libexpat.so.1 ]] ; then echo 'File "libexpat.so" has not been successfully copied. Try reinstalling it by running install_prerequisites_x64.sh.' read -p "Press Enter to abort ..." exit fi # MrSID echo "Copy the preinstalled MrSID library and its dependecies" cp /k2/dev2/mrsid/MrSID_DSDK-9.5.4.4709-rhel6.x86-64.gcc531/Raster_DSDK/lib/libltidsdk.so $BINDIR cp /k2/dev2/mrsid/MrSID_DSDK-9.5.4.4709-rhel6.x86-64.gcc531/Raster_DSDK/lib/libtbb.so.2 $BINDIR if [[ ! -f $BINDIR/libltidsdk.so ]] ; then echo 'File "libltidsdk.so" has not been successfully copied.' read -p "Press Enter to abort ..." exit fi if [[ ! -f $BINDIR/libtbb.so.2 ]] ; then echo 'File "libtbb.so" has not been successfully copied.' read -p "Press Enter to abort ..." exit fi # Proj echo "Copy the preinstalled Proj library and its dependecies" echo "Proj version > 6.0 is required for gdal" cp /k2/dev2/proj/proj-6.2.1/build/lib/libproj.so.15 $BINDIR cp /k2/dev2/proj/proj-6.2.1/data/proj.db $BINDIR if [[ ! -f $BINDIR/libproj.so.15 ]] ; then echo 'File "libltidsdk.so" has not been successfully copied.' read -p "Press Enter to abort ..." exit fi # Xerces echo "Copy the preinstalled Xerces library and its dependecies" echo "Xerces version > 3.1 is required for gdal" cp /k2/dev2/xerces/xerces-c-3.2.2/build/lib/libxerces-c-3.2.so $BINDIR if [[ ! -f $BINDIR/libxerces-c-3.2.so ]] ; then echo 'File "libltidsdk.so" has not been successfully copied.' read -p "Press Enter to abort ..." exit fi # Gdal echo "Install the GDAL Library" # Be sure to change target and source to 1.8 (jdk version) in the .../gdal-3.0.4/swig/java/build.xml file # and to specify the JAVA_HOME path variable in .../gdal-3.0.1/swig/java/java.opt. cd $BASEDIR cd gdal cd gdal-3.0.4 ./autogen.sh # Uncomment next two lines for a brand new installation #rm -rf build #make clean ./configure "CFLAGS=-m64" "CXXFLAGS=-m64" "LDFLAGS=-m64" --prefix=/k2/dev2/gdal/gdal-3.0.4/build --with-crypto=/k2/dev2/openssl/openssl-3.0.0/build --with-curl=/k2/dev2/curl/curl-7.66.0/build/bin/curl-config --with-ecw=/k2/dev2/ecw/ecw-5.4.0/build/Desktop_Read-Only --with-expat=/k2/dev2/expat/libexpat-R_2_2_9/expat/build --with-geotiff=internal --with-gif=internal --with-java=/k2/dev2/java/jdk1.8.0_171 --with-jpeg=internal --with-jp2mrsid=yes --with-libjson_c=internal --with-libtiff=internal --with-libz=/k2/dev2/zlib/zlib-1.2.11/build --with-mrsid=/k2/dev2/mrsid/MrSID_DSDK-9.5.4.4709-rhel6.x86-64.gcc531/Raster_DSDK --with-pcraster=internal --with-png=internal --with-proj=/k2/dev2/proj/proj-6.2.1/build --with-qhull=internal --with-sqlite3=/k2/dev2/sqlite/sqlite-autoconf-3300100/build --with-threads=yes --with-xerces=/k2/dev2/xerces/xerces-c-3.2.2/build read -p "Take a look at the config and press enter to continue ..." make CXXFLAGS='-std=c++11' make install cp /k2/dev2/gdal/gdal-3.0.4/build/lib/libgdal.so.26 $BINDIR # Testing ogrinfo /k2/dev2/gdal/gdal-3.0.4/build/bin/ogrinfo --formats read -p "Take a look at the output of ogrinfo --formats and press enter to continue ..." if [[ ! -f /k2/dev2/gdal/gdal-3.0.4/build/bin/gdalinfo ]] ; then echo 'File "gdalinfo" has not been successfully generated. Look above in the command window for error.' read -p "Press Enter to abort ..." exit fi if [[ ! -f $BINDIR/libgdal.so.26 ]] ; then echo 'File "libgdal.so" has not been successfully generated. Look above in the command window for error.' read -p "Press Enter to abort ..." exit fi # Gdal bindings echo "Install the GDAL jni bindings" cd $BASEDIR cd gdal cd gdal-3.0.4 cd swig cd java # Uncomment next line for a brand new installation # make clean all make make install cp /k2/dev2/gdal/gdal-3.0.4/swig/java/gdal.jar $BINDIR cp /k2/dev2/gdal/gdal-3.0.4/build/lib/libgdalalljni.so $BINDIR if [[ ! -f $BINDIR/gdal.jar ]] ; then echo 'File "gdal.jar" has not been successfully generated. Look above in the command window for error.' read -p "Press Enter to abort ..." exit fi if [[ ! -f $BINDIR/libgdalalljni.so ]] ; then echo 'File "libgdalalljni.so" has not been successfully generated. Look above in the command window for error.' read -p "Press Enter to abort ..." exit fi # Gdal-Ext echo "Install the Gdal-Ext project" cd $BASEDIR cd gdal-ext rm -rf build mkdir build cd build cmake .. cmake --build . --config Release cp /k2/dev2/gdal-ext/build/lib/libgdalext.so $BINDIR cp /k2/dev2/gdal-ext/build/lib/libgdalstartup.so $BINDIR if [[ ! -f $BINDIR/libgdalext.so ]] ; then echo 'File "libgdalext.so" has not been successfully generated. Look above in the command window for error.' read -p "Press Enter to abort ..." exit fi if [[ ! -f $BINDIR/libgdalstartup.so ]] ; then echo 'File "libgdalstartup.so" has not been successfully generated. Look above in the command window for error.' read -p "Press Enter to abort ..." exit fi if [[ ! -f /k2/dev2/gdal-ext/build/bin/gdalexttest ]] ; then echo 'File executable "gdalexttest" has not been successfully generated. Look above in the command window for error.' read -p "Press Enter to abort ..." exit fi echo "Set the runpath of the compiled libraries to origin" patchelf --remove-rpath $BINDIR/libgdal.so.26 patchelf --remove-rpath $BINDIR/libgdalext.so patchelf --remove-rpath $BINDIR/libgdalstartup.so patchelf --remove-rpath $BINDIR/libgdalalljni.so patchelf --remove-rpath $BINDIR/libproj.so.15 patchelf --remove-rpath $BINDIR/libltidsdk.so patchelf --force-rpath --set-rpath '$ORIGIN' $BINDIR/libgdal.so.26 patchelf --force-rpath --set-rpath '$ORIGIN' $BINDIR/libgdalext.so patchelf --force-rpath --set-rpath '$ORIGIN' $BINDIR/libgdalstartup.so patchelf --force-rpath --set-rpath '$ORIGIN' $BINDIR/libgdalalljni.so patchelf --force-rpath --set-rpath '$ORIGIN' $BINDIR/libproj.so.15 patchelf --force-rpath --set-rpath '$ORIGIN' $BINDIR/libltidsdk.so # Testing Gdal-Ext echo "Testing the Gdal-Ext project" cp /k2/dev2/gdal-ext/rgb1.tif /k2/dev2/gdal-ext/build/bin cp /k2/dev2/gdal-ext/rgb2.tif /k2/dev2/gdal-ext/build/bin cp /k2/dev2/gdal-ext/rgb3.png /k2/dev2/gdal-ext/build/bin cp /k2/dev2/gdal-ext/rgb4.png /k2/dev2/gdal-ext/build/bin cd /k2/dev2/gdal-ext/build/bin ./gdalexttest if [[ -f /k2/dev2/gdal-ext/build/bin/gdalVrtFile.vrt ]] ; then echo 'File "gdalVrtFile.vrt" has been successfully generated with the gdalexttest executable. Gdal and the jni bindings are correctly working.' read -p "Press Enter to continue ..." exit fi
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev