View previous topic :: View next topic |
Author |
Message |
MustrumR n00b
Joined: 15 Nov 2011 Posts: 71 Location: Right here
|
Posted: Thu May 16, 2013 6:21 pm Post subject: Cross-compiling - CFLAGS for CBUILD |
|
|
In an ebuild, how do I get CC, CFLAGS, CXX, CXXFLAGS, LD and LDFLAGS for CBUILD when cross-compiling using emerge? |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21431
|
Posted: Thu May 16, 2013 10:44 pm Post subject: |
|
|
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 |
|
|
xaviermiller Bodhisattva
Joined: 23 Jul 2004 Posts: 8704 Location: ~Brussels - Belgique
|
Posted: Fri May 17, 2013 9:43 am Post subject: |
|
|
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 |
_________________ Kind regards,
Xavier Miller |
|
Back to top |
|
|
MustrumR n00b
Joined: 15 Nov 2011 Posts: 71 Location: Right here
|
Posted: Fri May 17, 2013 2:57 pm Post subject: |
|
|
One more question: Are LDFLAGS the flags given to ld, or are they the flags given to gcc which runs ld? |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21431
|
Posted: Sat May 18, 2013 1:53 am Post subject: |
|
|
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 |
|
|
|