Search code examples
c++makefilegdal

Compile library with autotools and an additional compiler flag


I'm building library gdal-1.9.2. After launching the ./configure command, make fails with the error

ISO C++ forbids comparison between pointer and integer [-fpermissive]

If I launch the last failed command in a console with the additional option -fpermissive, it finishes successfully (with a warning, not an error).

g++ -g -O2 -Wall -DOGR_ENABLED -I/home/unona/unona-pult/gdal-1.9.2/port -DHAVE_LIBZ -fpermissive -c cplkeywordparser.cpp  -fPIC -DPIC -o .libs/cplkeywordparser.o

How to finish the build process now? Just make rebuilds it and crashes in the same way.


Solution

  • For autotools builds, you can expect the ./configure script to check for compiler flags set via environment variables (command line options are usually supported as well, but they are not as easy to memorize, IMHO). The names for these variables are standard ones, and in your case, it should be

    CXXFLAGS="-fpermissive" ./configure
    
    make install
    

    The configure script generates the makefile such that the value of CXXFLAGS is passed to the compiler while building.