Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 401907

Summary: sys-apps/iproute2-3.1.0 - CC/BUILD_CC variables are ignored
Product: Gentoo Linux Reporter: Andrey <ahipp0>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: ago, ahipp0
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 243502    
Attachments: proposed fix

Description Andrey 2012-02-02 13:05:39 UTC
`gcc` is used instead of `i686-pc-linux-gnu-gcc` during compilation of iproute2.

Ebuilds before iproute2-3.1.0.ebuild pass CC explicitly to make with `emake  CC="$(tc-getCC)" AR="$(tc-getAR)"`.
iproute2-3.1.0.ebuild replaced the code with `tc-export AR CC PKG_CONFIG` which seems not to work because of 'CC = gcc' in iproute2-3.1.0/Makefile.

Reproducible: Always

Steps to Reproduce:
1. ACCEPT_KEYWORDS="**" emerge -av1 '=sys-apps/iproute2-3.1.0'
Actual Results:  
gcc -D_GNU_SOURCE -march=native -O2 -pipe  -Wstrict-prototypes -Wall -I../include -DRESOLVE_HOSTNAMES -DLIBDIR=\"/lib\" -fPIC   -c -o ll_map.o ll_map.c
gcc -D_GNU_SOURCE -march=native -O2 -pipe  -Wstrict-prototypes -Wall -I../include -DRESOLVE_HOSTNAMES -DLIBDIR=\"/lib\" -fPIC   -c -o libnetlink.o libnetlink.c
...

Expected Results:  
i686-pc-linux-gnu-gcc -D_GNU_SOURCE -march=native -O2 -pipe  -Wstrict-prototypes -Wall -I../include -DRESOLVE_HOSTNAMES -DLIBDIR=\"/lib\" -fPIC   -c -o ll_map.o ll_map.c
i686-pc-linux-gnu-gcc -D_GNU_SOURCE -march=native -O2 -pipe  -Wstrict-prototypes -Wall -I../include -DRESOLVE_HOSTNAMES -DLIBDIR=\"/lib\" -fPIC   -c -o libnetlink.o libnetlink.c
...
Comment 1 Andrey 2012-02-02 13:08:08 UTC
Created attachment 300753 [details, diff]
proposed fix
Comment 2 Andrey 2012-02-02 13:11:08 UTC
Comment on attachment 300753 [details, diff]
proposed fix

This additionally removes PKG_CONFIG export as it seems to be unused and adds HOSTCC export for cross-compilation cases.
Comment 3 SpanKY gentoo-dev 2012-02-16 05:21:43 UTC
should be all set now in the tree; thanks for the report!

Commit message: Respect CC from build env
http://sources.gentoo.org/sys-apps/iproute2/iproute2-3.1.0.ebuild?r1=1.3&r2=1.4
Comment 4 Agostino Sarubbo gentoo-dev 2013-01-18 12:49:05 UTC
make[1]: Leaving directory `/var/tmp/portage/sys-apps/iproute2-3.3.0/work/iproute2-3.3.0/misc'
make[1]: Entering directory `/var/tmp/portage/sys-apps/iproute2-3.3.0/work/iproute2-3.3.0/netem'
gcc  -I../include -o maketable maketable.c -lm
gcc  -I../include -o normal normal.c -lm
gcc  -I../include -o pareto pareto.c -lm
gcc  -I../include -o paretonormal paretonormal.c -lm
./paretonormal > paretonormal.dist
./normal > normal.dist
./pareto > pareto.dist
./maketable experimental.dat > experimental.dist
make[1]: Leaving directory `/var/tmp/portage/sys-apps/iproute2-3.3.0/work/iproute2-3.3.0/netem'


Not fixed at all for me.
Comment 5 Andrey 2013-01-18 14:08:35 UTC
(In reply to comment #4)
> make[1]: Entering directory
> `/var/tmp/portage/sys-apps/iproute2-3.3.0/work/iproute2-3.3.0/netem'
> gcc  -I../include -o maketable maketable.c -lm
> Not fixed at all for me.

+1.

The problem only in netem subdirectory.
My proposed fix in attachment 300753 [details, diff] should fix this though.
Comment 6 Andrey 2013-01-18 14:12:15 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > make[1]: Entering directory
> > `/var/tmp/portage/sys-apps/iproute2-3.3.0/work/iproute2-3.3.0/netem'
> > gcc  -I../include -o maketable maketable.c -lm
> > Not fixed at all for me.
> 
> +1.
> 
> The problem only in netem subdirectory.
> My proposed fix in attachment 300753 [details, diff] [details, diff] should fix this though.

Oops, sorry, I'm typing faster than thinking.
These programs in netem directory are built using HOSTCC as they are being run during the build, so the behavior you see is correct.

Although, I'd prefer $(tc-getBUILD_CC) instead of simple gcc.
Comment 7 SpanKY gentoo-dev 2013-02-10 08:34:10 UTC
(In reply to comment #4)

yes, as pointed out, you're seeing *build time* code, not target code, hence it is not ignoring $CC
Comment 8 SpanKY gentoo-dev 2013-02-10 08:38:36 UTC
should be all set now in the tree; thanks for the report!

Commit message: Also respect BUILD_CC
http://sources.gentoo.org/sys-apps/iproute2/iproute2-3.7.0.ebuild?r1=1.4&r2=1.5