pcm: CFLAGS/CXXFLAGS environment variables ignored when building some object files
If I define custom CXXFLAGS and CFLAGS via env. variables some object files still will be building with default ones. There is list: daemon.o, main.o.
Make output:
Building file: ../daemon.cpp
Invoking: C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -Wno-unknown-pragmas -std=c++11 -MMD -MP -MF"daemon.d" -MT"daemon.d" -o "daemon.o" "../daemon.cpp"
Finished building: ../daemon.cpp
Building file: ../main.cpp
Invoking: C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -Wno-unknown-pragmas -std=c++11 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.cpp"
Finished building: ../main.cpp
And both CFLAGS and CXXFLAGS was set to
-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
(default for the Fedora packages).
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 22 (15 by maintainers)
Fedora package must use all distribution-wide flags.
merged
LGTM now.
Not fixed. CXXFLAGS and LDFLAGS must be used together.
done: https://github.com/opcm/pcm/pull/285 kudos to @ogbrugge
Some additional fixups would still be needed but with your C/CXXFLAGS it would now look like this ( i had to remove some specific redhat options, i do not have them on my suse sandbox) but i’ll submit a patch when i am done verifying:
Building file: …/daemon.cpp Invoking: C++ Compiler g++ -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -Wall -g -O3 -Wno-unknown-pragmas -fPIC -std=c++11 -DPCM_USE_PERF -Wextra -DPCM_USE_PERF -O2 -g3 -Wall -c -fmessage-length=0 -Wno-unknown-pragmas -std=c++11 -MMD -MP -MF"daemon.d" -MT"daemon.d" -o “daemon.o” “…/daemon.cpp” Finished building: …/daemon.cpp
Building file: …/main.cpp Invoking: C++ Compiler g++ -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -Wall -g -O3 -Wno-unknown-pragmas -fPIC -std=c++11 -DPCM_USE_PERF -Wextra -DPCM_USE_PERF -O2 -g3 -Wall -c -fmessage-length=0 -Wno-unknown-pragmas -std=c++11 -MMD -MP -MF"main.d" -MT"main.d" -o “main.o” “…/main.cpp” Finished building: …/main.cpp