Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Cross-compiling - CFLAGS for CBUILD
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
MustrumR
n00b
n00b


Joined: 15 Nov 2011
Posts: 51
Location: Right here

PostPosted: Thu May 16, 2013 6:21 pm    Post subject: Cross-compiling - CFLAGS for CBUILD Reply with quote

In an ebuild, how do I get CC, CFLAGS, CXX, CXXFLAGS, LD and LDFLAGS for CBUILD when cross-compiling using emerge?
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8855

PostPosted: Thu May 16, 2013 10:44 pm    Post subject: Reply with quote

grep 'FUNCTION: tc-getBUILD' /usr/portage/eclass/toolchain-funcs.eclass:
# @FUNCTION: tc-getBUILD_AR
# @FUNCTION: tc-getBUILD_AS
# @FUNCTION: tc-getBUILD_CC
# @FUNCTION: tc-getBUILD_CPP
# @FUNCTION: tc-getBUILD_CXX
# @FUNCTION: tc-getBUILD_LD
# @FUNCTION: tc-getBUILD_STRIP
# @FUNCTION: tc-getBUILD_NM
# @FUNCTION: tc-getBUILD_RANLIB
# @FUNCTION: tc-getBUILD_OBJCOPY
# @FUNCTION: tc-getBUILD_PKG_CONFIG
See also:
/usr/portage/eclass/toolchain-funcs.eclass:
# @FUNCTION: tc-export_build_env
# @USAGE: [compiler variables]
# @DESCRIPTION:
# Export common build related compiler settings.
tc-export_build_env() {
    tc-export "$@"
    : ${BUILD_CFLAGS:=-O1 -pipe}
    : ${BUILD_CXXFLAGS:=-O1 -pipe}
    : ${BUILD_CPPFLAGS:=}
    : ${BUILD_LDFLAGS:=}
    export BUILD_{C,CXX,CPP,LD}FLAGS
}
Back to top
View user's profile Send private message
XavierMiller
Moderator
Moderator


Joined: 23 Jul 2004
Posts: 5450
Location: ~Brussels - Belgique

PostPosted: Fri May 17, 2013 9:43 am    Post subject: Reply with quote

Hello,

You can also use the crossdev wrappers

for example
Code:
crossdev -t armv6j-hardfloat-linux-gnueabi
to create the cross-compilation toolchain

then
Code:
armv6j-hardfloat-linux-gnueabi-emerge moo

_________________
Xavier Miller
(FR) Merci de respecter les règles du forum.
http://www.xaviermiller.be
Back to top
View user's profile Send private message
MustrumR
n00b
n00b


Joined: 15 Nov 2011
Posts: 51
Location: Right here

PostPosted: Fri May 17, 2013 2:57 pm    Post subject: Reply with quote

One more question: Are LDFLAGS the flags given to ld, or are they the flags given to gcc which runs ld?
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8855

PostPosted: Sat May 18, 2013 1:53 am    Post subject: Reply with quote

They are passed to gcc. There is a toolchain helper if you need to extract the raw flags to deal with a build system that invokes ld directly.
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