[
https://issues.apache.org/jira/browse/SERF-133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17985972#comment-17985972
]
Branko Čibej commented on SERF-133:
-----------------------------------
SCons treats {{CFLAGS}} and {{CCFLAGS}} differently, see
[here|https://scons.org/doc/2.3.0/HTML/scons-user/a5025.html].
The fix is easy, but SCons in any case adds '{{-g -O2}}' by default, regardless
of {{CFLAGS}} or {{CCFLAGS}}. I've yet to find out why the {{***}} it would
want to do that and where it's coming from.
> SConstruct should not force -O2
> -------------------------------
>
> Key: SERF-133
> URL: https://issues.apache.org/jira/browse/SERF-133
> Project: serf
> Issue Type: Bug
> Reporter: Serf Importer
> Priority: Major
> Labels: Priority-Medium, Type-Defect
>
> Handling of CFLAGS etc. is misdesigned. Environmental variables are ignored.
> Even when I explicitly specify CFLAGS on command line, then they are not
> fully respected:
> $ scons CFLAGS="-march=native -O3"
> scons: Reading SConscript files ...
> scons: done reading SConscript files.
> scons: Building targets ...
> gcc -o context.o -c -march=native -O3 -std=c89 -Wdeclaration-after-statement
> -Wmissing-prototypes -Wall -O2 -pthread -DNDEBUG -DLINUX -D_REENTRANT
> -D_GNU_SOURCE -I. -I/usr/include/apr-1 -I/usr/include/db5.2 -I/usr/include
> context.c
> gcc -o incoming.o -c -march=native -O3 -std=c89 -Wdeclaration-after-statement
> -Wmissing-prototypes -Wall -O2 -pthread -DNDEBUG -DLINUX -D_REENTRANT
> -D_GNU_SOURCE -I. -I/usr/include/apr-1 -I/usr/include/db5.2 -I/usr/include
> incoming.c
> gcc -o outgoing.o -c -march=native -O3 -std=c89 -Wdeclaration-after-statement
> -Wmissing-prototypes -Wall -O2 -pthread -DNDEBUG -DLINUX -D_REENTRANT
> -D_GNU_SOURCE -I. -I/usr/include/apr-1 -I/usr/include/db5.2 -I/usr/include
> outgoing.c
> gcc -o ssltunnel.o -c -march=native -O3 -std=c89
> -Wdeclaration-after-statement -Wmissing-prototypes -Wall -O2 -pthread
> -DNDEBUG -DLINUX -D_REENTRANT -D_GNU_SOURCE -I. -I/usr/include/apr-1
> -I/usr/include/db5.2 -I/usr/include ssltunnel.c
> ...
> -O2 is appended and overrides flags set by user (which include -O3 in above
> example).
> Original issue reported by *Arfrever.FTA*
--
This message was sent by Atlassian Jira
(v8.20.10#820010)