From 5a2c3ffa7264319c52f0dfd30bcff5f0a86ec01d Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 25 May 2020 12:08:23 -0700 Subject: [PATCH] Makefiles: set CXXFLAGS not CFLAGS or CPPFLAGS CFLAGS is for C compilation. CPPFLAGS is for the preprocessor. CXXFLAGS is for C++ compilation, which is what we're actually trying to apply the flags to in all three cases. CPPFLAGS happen to be applied to the compile stage as well as the preprocessor usually, so CPPFLAGS was working, but it wasn't correct. CFLAGS is not applied to C++ compiles, so `videoencoder_CFLAGS` was not being used at all. This broke build on Fedora Rawhide, because /usr/include/opencv2 no longer exists there. There is /usr/include/opencv4/opencv2 and this should be fine because we should get -I/usr/include/opencv4 from OPENCV_CFLAGS, but because of this bug, that wasn't set correctly and the build failed. With this change it works. Thanks to Orion Poplowski for reminding me of the CPPFLAGS vs. CXXFLAGS distinction here. Signed-off-by: Adam Williamson --- Makefile.am | 2 +- debugviewer/Makefile.am | 2 +- snd2png/Makefile.am | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 61dbe1d2..a5b4fbf2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -119,7 +119,7 @@ pkglibexec_FOLDERS = \ pkglibexec_PROGRAMS = videoencoder videoencoder_SOURCES = videoencoder.cpp -videoencoder_CFLAGS = -O2 -Wall -W $(OPENCV_CFLAGS) +videoencoder_CXXFLAGS = -O2 -Wall -W $(OPENCV_CFLAGS) videoencoder_LDADD = $(OPENCV_LIBS) $(THEORAENC_LIBS) -lm EXTRA_DIST = \ diff --git a/debugviewer/Makefile.am b/debugviewer/Makefile.am index 47d1d953..eea1de60 100644 --- a/debugviewer/Makefile.am +++ b/debugviewer/Makefile.am @@ -2,6 +2,6 @@ bin_PROGRAMS = debugviewer debugviewer_SOURCES = debugviewer.cpp -AM_CPPFLAGS = $(OPENCV_CFLAGS) +AM_CXXFLAGS = $(OPENCV_CFLAGS) debugviewer_LDFLAGS = $(OPENCV_LIBS) diff --git a/snd2png/Makefile.am b/snd2png/Makefile.am index 07bd084e..ec6f1840 100644 --- a/snd2png/Makefile.am +++ b/snd2png/Makefile.am @@ -2,8 +2,7 @@ bin_PROGRAMS = snd2png snd2png_SOURCES = snd2png.cpp -AM_CXXFLAGS = -g3 -Wall -W -AM_CPPFLAGS = $(OPENCV_CFLAGS) $(FFTW_CFLAGS) $(SNDFILE_CFLAGS) +AM_CXXFLAGS = -g3 -Wall -W $(OPENCV_CFLAGS) $(FFTW_CFLAGS) $(SNDFILE_CFLAGS) snd2png_LDFLAGS = $(OPENCV_LIBS) $(FFTW_LIBS) $(SNDFILE_LIBS) -lm check-local: -- 2.26.2