Opened 8 years ago

Closed 8 years ago

#6117 closed defect (fixed)

Compile fails with vector data disabled (--without-ogr)

Reported by: peterdm Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: 2.0.0
Severity: normal Keywords:


I want to build gdal without vector data support because I don't need it. Disabling vector data makes compilation fail though.
Steps to reproduce:

  1. ./configure --without-ogr --with-java
  2. make
    -> make fails

Note that make succeeds when omitting '--without-ogr'. Possibly the root cause is that there is an illegal dependency from pdf on ogr?

I looked for an option to disable pdf too since I don't need that either, but couldn't find any option to do os. So the only workaround I could find is to make with ogr enabled.

     [make] ../../GDALmake.opt:576: recipe for target '../o/pdfwritabledataset.lo' failed
     [make] make[2]: Leaving directory '/mnt/data/jenkins-slave/workspace/GDAL_-_2016.0_-_Native_Build_-_Linux64/native/gdal-2.0.0/frmts/pdf'
     [make] GNUmakefile:10: recipe for target 'pdf-install-obj' failed
     [make] make[1]: Leaving directory '/mnt/data/jenkins-slave/workspace/GDAL_-_2016.0_-_Native_Build_-_Linux64/native/gdal-2.0.0/frmts'
     [make] GNUmakefile:61: recipe for target 'frmts-target' failed
     [make] pdfwritabledataset.cpp: In member function 'virtual OGRErr PDFWritableVectorDataset::SyncToDisk()':
     [make] pdfwritabledataset.cpp:307:17: error: 'class GDALPDFWriter' has no member named 'WriteOGRLayer'
     [make]          oWriter.WriteOGRLayer((OGRDataSourceH)this,
     [make]                  ^
     [make] make[2]: *** [../o/pdfwritabledataset.lo] Error 1
     [make] make[1]: *** [pdf-install-obj] Error 2
     [make] make: *** [frmts-target] Error 2

Change History (9)

comment:2 by Kurt Schwehr, 8 years ago

I propose that we remove the --without-ogr option and the OGR_ENABLED preprocessor directive for trunk head.

Anyway I was wondering if it was worth fixing that? as it might be a continuing 
maintenance pain... This was something I actually considered during RFC 46 (I 
mean dropping support for --without-ogr).


e.g. in gdalbuildvrt_lib.cpp

#include "ogr_api.h"
#include "ogr_srs_api.h"

would become

#include "ogr_api.h"
#include "ogr_srs_api.h"
find . -name \*.h -o -name \*.c -o -name \*.cpp -o -name \*akef\* -o -name \*.i | xargs grep OGR_ENABLED | wc -l


find . -name \*.h -o -name \*.c -o -name \*.cpp -o -name \*akef\* -o -name \*.i | xargs grep -l OGR_ENABLED  | wc -l

29  # Number of files
egrep -A 1 'OGR_ENABLED|[_-]ogr' *.in,[  --without-ogr         Don't build OGR into shared library],,) test "$with_ogr" = yes -o x"$with_ogr" = x ; then  echo checking for OGR ... enabled  OGR_ENABLED=yes
--[  enable OGR building:       ${OGR_ENABLED}])[  enable GNM building:       ${GNM_ENABLED}])
-- ($(OGR_ENABLED),yes) ($(HAVE_SQLITE),yes)
-- ($(OGR_ENABLED),yes) := $(GDAL_FORMATS) arg

comment:3 by Kurt Schwehr, 8 years ago

Proposed initial patch:


    svn diff 
    28052805dnl ---------------------------------------------------------------------------
    2807 AC_ARG_WITH(ogr,[  --without-ogr         Don't build OGR into shared library],,)
     2807dnl Always build with OGR support.
     2810dnl TODO: Remove this option.
     2811AC_ARG_WITH(ogr,[  --without-ogr         No longer does anything.  Always builds with OGR.],,)
    28092813if test "$with_ogr" = yes -o x"$with_ogr" = x ; then
    2810   echo checking for OGR ... enabled
    2811   OGR_ENABLED=yes
     2814  dnl This is always the case.
    2813   echo checking for OGR ... disabled by user
    2814   OGR_ENABLED=no
     2816  echo "WARNING: User attempted to disable OGR."
     2817  echo "  The ability to build without OGR has been removed."

comment:4 by Kurt Schwehr, 8 years ago

r33756 removes the --without-ogr flag completely. As discussed on IRC, there is no point in keeping a flag around with a warning if it hasn't worked in a long time. Now need to remove the #if logic around OGR_ENABLED

comment:5 by Kurt Schwehr, 8 years ago

r33757 removes most of the #if stuff for OGR_ENABLED c preprocessor (cpp) logic.

comment:6 by Jukka Rahkonen, 8 years ago

Is there still something to do before closing this?

comment:7 by Kurt Schwehr, 8 years ago

Still a bit more remaining. I'll see if I can finish up this ticket today. Thanks for the ping.

find . -type f | xargs grep OGR_ENABLED  # Hand removed a few things
./GDALmake.opt:OGR_ENABLED = yes
./GDALmake.opt:# TODO: Remove -DOGR_ENABLED.
./ = yes
./swig/perl/Makefile.PL:my $have_ogr = `grep "CONFIG_OGR_ENABLED" $config`;
./frmts/northwood/grddataset.cpp:#ifdef OGR_ENABLED
./frmts/northwood/grddataset.cpp:#ifdef OGR_ENABLED
./frmts/northwood/grddataset.cpp:#ifdef OGR_ENABLED
./apps/GNUmakefile:	echo 'CONFIG_OGR_ENABLED=yes' >> gdal-config
./apps/GNUmakefile:	echo 'CONFIG_OGR_ENABLED=yes' >> gdal-config-inst
./nmake.opt:OGR_FLAG = -DOGR_ENABLED
./gcore/gdal_misc.cpp:        osBuildInfo += "OGR_ENABLED=YES\n";

comment:8 by Kurt Schwehr, 8 years ago

r34784 r34785 r34786 r34787 r34788 r34790 r34791

Checks for against INCLUDE_OGR_FRMTS might be switchable to just doing whatever is inside the #if / !IF

comment:9 by Kurt Schwehr, 8 years ago

Resolution: fixed
Status: newclosed


Fixed for trunk. I don't really see a need to back port.

find . -type f | xargs grep OGR_ENABLED | egrep -v 'log\.txt|GDALmake.opt|Binary|Deprecated|cache|apps/gdal-config|NEWS|configure:'
# No results
Note: See TracTickets for help on using tickets.