Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local-directory -I flags mis-passed in Makefile.am #52

Open
dmacks opened this issue Dec 28, 2020 · 0 comments
Open

Local-directory -I flags mis-passed in Makefile.am #52

dmacks opened this issue Dec 28, 2020 · 0 comments

Comments

@dmacks
Copy link

dmacks commented Dec 28, 2020

Building libgeotiff-1.6.0 on OS X 10.13:

$ CPPFLAGS=-I/sw/include LDFLAGS=-L/sw/lib ./configure --prefix=/sw --with-zip=/usr/include --with-jpeg=/sw --disable-doxygen-doc
[...]
  zlib support......: yes
  jpeg support......: yes
  TIFF support......: yes
    -INCLUDE .......: -I/sw/include
    -PREFIX ........: 
  PROJ support......: yes
    -INCLUDE .......: 
  LIBS.....................: -L/sw/lib -ljpeg -lz -lm -L/sw/lib  -L/sw/lib -ltiff -L/sw/lib -lproj
$ make
[...]
make[2]: Entering directory '/sw/build.build/libgeotiff5-1.6.0-1/libgeotiff-1.6.0/bin'
gcc -DHAVE_CONFIG_H -I. -I..   -Os -I/sw/include -I../  -I./.. -I./../libxtiff -I/sw/include -DHAVE_TIFF=1  -g -O2 -O3 -DNDEBUG -MT geotifcp.o -MD -MP -MF .deps/geotifcp.Tpo -c -o geotifcp.o geotifcp.c
[...]
/bin/sh ../libtool  --tag=CC   --mode=link gcc -I../  -I./.. -I./../libxtiff -I/sw/include -DHAVE_TIFF=1  -g -O2 -O3 -DNDEBUG  -L/sw/lib -o geotifcp geotifcp.o ../libgeotiff.la -L/sw/lib -ljpeg -lz -lm -L/sw/lib  -L/sw/lib -ltiff -L/sw/lib -lproj

The weird is that there are -I flags going to the linker. The bug is "-I/sw/include -I../ -I./.. -O../../libxtiff", which causes build failure because externally installed headers will be found in preference to ones in the source distro. Local -I should always come before any global/external ones. The same thing happens for all compiling in bin/ and the top-level dir.

All of this is because Makefile.am are passing local -I via AM_CFLAGS instead of AM_CPPFLAGS. "CFLAGS" is the "C compiler" (.c→.o and linking), whereas "CPPFLAGS" is "the →.o stage".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant