Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]CPPFLAGS in make.conf
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1246
Location: Edinburgh, UK

PostPosted: Mon Apr 22, 2013 5:55 pm    Post subject: [SOLVED]CPPFLAGS in make.conf Reply with quote

Hi,

I've been chewing through a load of overdue updates, and I found the build of net-misc/curl failing with this message:

Code:
configure: using CFLAGS: -D_FORTIFY_SOURCE=2 -march=atom -msahf -mmovbe --param
l1-cache-size=24 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=
atom -O2 -fomit-frame-pointer -pipe -mmmx -msse -msse2 -mssse3
configure: CFLAGS error: CFLAGS may only be used to specify C compiler flags, no
t macro definitions. Use CPPFLAGS for: -D_FORTIFY_SOURCE=2
configure: error: Can not continue. Fix errors mentioned immediately above this
line.


Note: The reason for my rather long-winded CFLAGS is because I use distcc with an amd64/crossdev helper box, so I need to be explicit instead of just using "-march=native". I used a script (quite possibly found on here but can't put my hand to it now) that "translates" the effect of -march=native to those lower-level arguments.

I tried removing -D_FORTIFY_SOURCE=2 from my CFLAGS in make.conf and issuing it on the commandline, just for building curl, and it built successfully.

What I'm wondering is, should I move it to a CPPFLAGS argument in my make.conf? Is that supported? I don't see CPPFLAGS mentioned in man make.conf, but it does appear (among the "unset" properties) in emerge --info.

Thanks for any clarification. I haven't seen any other package have problems with this, but I want to be doing things as "properly" as I can where portage and compiling are concerned.


Last edited by Havin_it on Tue Apr 23, 2013 8:18 am; edited 1 time in total
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10587
Location: Somewhere over Atlanta, Georgia

PostPosted: Mon Apr 22, 2013 6:11 pm    Post subject: Reply with quote

CFLAGS for C++ is named CXXFLAGS. A pretty typical setting would be
Code:
CXXFLAGS="${CFLAGS} special C++ only stuff"
:wink:

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1246
Location: Edinburgh, UK

PostPosted: Mon Apr 22, 2013 6:34 pm    Post subject: Reply with quote

Hi Mr G :D

CPPFLAGS != CXXFLAGS, they are (according to some googling I did just now) for the C Preprocessor. I don't know much of what this really means, just trying to follow the directions of the error message.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Mon Apr 22, 2013 7:11 pm    Post subject: Reply with quote

Quote:
emerge --info
Portage 2.1.11.60 (default/linux/x86/13.0/desktop, gcc-4.7.2, glibc-2.15-r2, 3.4.7 i686)
...
Unset: CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

So yes, handled.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10587
Location: Somewhere over Atlanta, Georgia

PostPosted: Mon Apr 22, 2013 7:43 pm    Post subject: Reply with quote

Thanks, krinn. I didn't read carefully enough. :oops:

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Mon Apr 22, 2013 7:45 pm    Post subject: Reply with quote

John R. Graham wrote:
Thanks, krinn. I didn't read carefully enough. :oops:

- John


If it would only happen to you... but i'm afraid i do that too sometimes. :oops:
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21489

PostPosted: Tue Apr 23, 2013 2:20 am    Post subject: Reply with quote

You can move it to CPPFLAGS, but beware that it is unfortunately common for packages not to use CPPFLAGS in their build rule, in which case what you put there will be ignored. For your specific case of _FORTIFY_SOURCE, it is traditional to use one of the compiler profiles that automatically sets _FORTIFY_SOURCE, rather than passing it explicitly. This has the added benefit that packages must actively neutralize _FORTIFY_SOURCE to avoid its effects, rather than avoiding it merely through having build rules that ignore user preferences.
Back to top
View user's profile Send private message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1246
Location: Edinburgh, UK

PostPosted: Tue Apr 23, 2013 8:17 am    Post subject: Reply with quote

Thanks Hu, in that case it's probably better if I just employ that change for curl only, and implement the changed C(XX)FLAGS and CPPFLAGS in /etc/portage/env/net-misc/curl.

Time to let this bubble under now for John's sake ;)
Back to top
View user's profile Send private message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1246
Location: Edinburgh, UK

PostPosted: Fri Apr 26, 2013 8:38 am    Post subject: Reply with quote

I couldn't leave it alone... :oops:

I hunted down the script I mentioned above, which is as follows:
Code:
#!/bin/bash
# Show what CFLAGS will be selected by "-march=native"
arch=${1:-native}
gcc -march=$arch -E -v - </dev/null 2>&1 | sed -n 's/.* -v - //p'


And I noticed that its output is different now:
Code:
minime ~ # ./native-cflags.sh
-march=atom -mno-cx16 -msahf -mmovbe -mno-aes -mno-pclmul -mno-popcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-tbm -mno-avx -mno-sse4.2 -mno-sse4.1 --param l1-cache-size=24 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=atom


I've only run distcc this way for a little over a year, so I guess the previous output was from gcc-4.5 or maybe 4.4. I'm intrigued what the changes signify, but that probably stands as an exercise for another day.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum