Opened 21 years ago
Last modified 21 years ago
#446 closed defect (fixed)
--with-local doesn't put -I/usr/local/include into some compilation lines
Reported by: | Owned by: | dron | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | default | Version: | unspecified |
Severity: | normal | Keywords: | VERIFIED |
Cc: |
Description
I run FreeBSD, where most non-system packages get installed into /usr/local instead of /usr, where many Linuxen put everything. I have been able to compile gdal-1.1.9 using: ./configure --with-local gmake just fine. But with today's (15 Dec 2003) CVS version, this doesn't work, as -I/usr/local/include isn't put into the compilation line: [...] g++ -Wall -O2 -c cpl_odbc.cpp -fPIC -DPIC -o .libs/cpl_odbc.o In file included from cpl_odbc.cpp:63: cpl_odbc.h:66: sql.h: No such file or directory cpl_odbc.h:67: sqlext.h: No such file or directory gmake[1]: *** [cpl_odbc.o] Error 1 gmake[1]: Leaving directory `/users/russo/src/gdal/port' I have not been able to find where the thing is going wrong, as there does appear to be a default rule for making .o files from .cpp files that includes $(CPPFLAGS), and indeed if I kludge things thus: CXXFLAGS="-I/usr/local/include" ./configure --with-local the compilation proceeds beautifully past the error above, only to die: g++ -I/usr/local/include -I../../port -I../../port -I../../gcore -I../../ogr -Wall -I/usr/local/include -c rawdataset.cpp -fPIC -DPIC -o ../o/.libs/rawdataset.o rawdataset.cpp: In method `int RawRasterBand::IsLineLoaded(int, int)': rawdataset.cpp:493: no method `GDALRasterBlock::IsCached' rawdataset.cpp: In method `enum CPLErr RawRasterBand::IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType, int, int)': rawdataset.cpp:526: implicit declaration of function `int CSLTestBoolean(...)' gmake[2]: *** [../o/rawdataset.o] Error 1 gmake[2]: Leaving directory `/users/russo/src/gdal/frmts/raw' gmake[1]: *** [raw-install-obj] Error 2 gmake[1]: Leaving directory `/users/russo/src/gdal/frmts' gmake: *** [frmts-target] Error 2 THis failure is because *THIS* compilation line puts both CXXFLAGS and CPPFLAGS in, getting -I/usr/local/include before all the other -I's, and I've still got gdal-1.1.9 installed in /usr/local. There should be a consistent use of CPPFLAGS for these -I's, and the kludged use of CXXFLAGS shouldn't be necessary.
Change History (8)
comment:2 by , 21 years ago
I've played around a little more, and come up with another thing that seems to be different betweeen 1.1.9 and today's CVS (and apparently wrong). If I do this: CXXFLAGS=-I/usr/local/include ./configure --with-local gmake to force it past the failure in ports, and let it build until the later failure in the frmts/raw directory, then do: ./configure --with-local gmake with no intervening make clean, (to pick up where it left off without CXXFLAGS=-I/usr/local/include) then it still fails --- because the -I/usr/local/include that --with-local puts in is earlier in the g++ line than all the other -I's and it still picks up the prior installation's include files instead of the current versions: gmake[2]: Entering directory `/users/russo/src/gdal/frmts/raw' /bin/sh ../../libtool --mode=compile g++ -I/usr/local/include -I../../port -I../../port -I../../gcore -I../../ogr -Wall -O2 -c -o ../o/rawdataset.o rawdataset.cpp g++ -I/usr/local/include -I../../port -I../../port -I../../gcore -I../../ogr -Wall -O2 -c rawdataset.cpp -fPIC -DPIC -o ../o/.libs/rawdataset.o rawdataset.cpp: In method `int RawRasterBand::IsLineLoaded(int, int)': rawdataset.cpp:493: no method `GDALRasterBlock::IsCached' rawdataset.cpp: In method `enum CPLErr RawRasterBand::IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType, int, int)': rawdataset.cpp:526: implicit declaration of function `int CSLTestBoolean(...)' gmake[2]: *** [../o/rawdataset.o] Error 1 gmake[2]: Leaving directory `/users/russo/src/gdal/frmts/raw' In 1.1.9, the -I/usr/local/include always wound up at the very end of the c++ arguments, e.g.: gmake[2]: Entering directory `/users/russo/src/gdal-1.1.9/frmts/raw' g++ -c -I../.. -I../../port -I../../gcore -I../../ogr -Wall -fPIC -O2 -I/usr/local/include rawdataset.cpp -o rawdataset.o cp rawdataset.o ../o
comment:3 by , 21 years ago
Thomas, I have made a few corrections in the makefiles. Could you try the latest CVS snapshot in your environment?
comment:4 by , 21 years ago
Well, I pinned this one down to a single makefile issue. In the port/GNUmakefile, there's a line: CPPFLAGS := This has the effect of wiping out CPPFLAGS, nullifying the effect of --with-local adding -I/usr/local/include to CPPFLAGS. Commenting out this single line fixed my build until it hit frmts/gtiff, where there's a CPPFLAGS = $(GDAL_INCLUDE) $(TIFF_OPTS) which again overrides the -I/usr/local/include that was put into CPPFLAGS by configure. Changing *THAT* to CPPFLAGS := $(GDAL_INCLUDE) $(TIFF_OPTS) $(CPPFLAGS) got me past that problem. There is another similar problem in the grass directory, and there might be others (I haven't finished my current compile as I write this) but I think you get the point. Some simple mods to the gnumakefiles are in order, but I don't know what mods would maintain the correctness on other platforms while fixing this glitch.
comment:5 by , 21 years ago
Seems my initial attempt to reply to the bugzilla email from Andrey asking me to try out the CVS changes didn't make it to the bug report (some installs of bugzilla will do that). Andrey's changes to makefiles didn't fix my issue. However, the combination of the three makefile changes I noted above, plus the one I made and described on the #447 page fixed all the problems, and I have now just watched as the whole thing compiled and linked. Here's a nutshell summary: - In port/GNUmakefile I needed to remove "CPPFLAGS :=" - In frmts/gtiff I had to change "CPPFLAGS = $(GDAL_INCLUDE) $(TIFF_OPTS)" to "CPPFLAGS := $(GDAL_INCLUDE) $(TIFF_OPTS) $(CPPFLAGS)" - In frmts/grass I needed to make a similar change - lastly, in ogr/ogrsf_frmts/odbc I needed to change the "CPPFLAGS += -I.. -I../.." to "CPPFLAGS := -I.. -I../.. $(CPPFLAGS)" to prevent the old installation of gdal-1.1.9 in /usr/local/ from confusing the new build.
comment:8 by , 21 years ago
I can verify that your last commits fixed my problems. I did a clean checkout of gdal from the repository, and it built perfectly with no errors by doing: ./configure --with-local gmake Thank you for the prompt response!
Note:
See TracTickets
for help on using tickets.