Cross-compiling Boost 1.35.0
I have been attempting to generate a build environment for boost in which two targets are involved: 1) Native GCC (Whatever the host build system is) 2) DENX ELDK 4.1 (PowerPC 4xx / Linux) With the assumption that (1) and (2) are both GCC-based, I have (1) working well enough. However, the information at: http://lists.boost.org/boost-users/2007/01/24400.php Seems stale for 1.35.0 in that GCC_ROOT_DIRECTORY, GCC and GXX are no longer referenced. My general recipe in my top-level "glue" makefile is as follows, with commands to extract the source, build a link farm, build any objects and install the library: BoostArchive = boost_1_35_0.tar.gz BoostSource = boost_1_35_0 BoostConfigure = $(BuildDirectory)/configure BoostMakefile = $(BuildDirectory)/Makefile BoostUserConfig = $(BuildDirectory)/user-config.jam BoostLibraries = filesystem \ thread BoostLibrariesList = $(subst $(SPACE),$(COMMA),$(strip $(BoostLibraries))) $(BoostSource): $(BoostArchive) tar -zxvf $< $(BoostConfigure): | $(BoostSource) lndir -silent $(CURDIR)/$(BoostSource) $(BuildDirectory) $(BoostMakefile) $(BoostUserConfig): $(BoostConfigure) cd $(BuildDirectory) && \ BJAM_CONFIG="" \ $(BoostConfigure) \ --prefix=$(ResultDirectory) \ --with-toolset=gcc \ --without-icu \ --with-libraries=$(BoostLibrariesList) build: $(BoostMakefile) unset MAKEFLAGS && \ $(MAKE) -C $(BuildDirectory) \ BJAM_CONFIG="" \ all install: unset MAKEFLAGS && \ $(MAKE) -C $(BuildDirectory) \ BJAM_CONFIG="" \ install My suspicion is that there's some new 1.35.0-specific magic to pass via BJAM_CONFIG that allows me to specify the GCC and G++ executables (and longer-term, the OS since that might be cross-compiled too rather than Linux in both cases). Any insights on what that new magic might be? Regards, Grant
On 7/30/08 11:29 AM, Grant Erickson wrote:
I have been attempting to generate a build environment for boost in which two targets are involved:
1) Native GCC (Whatever the host build system is) 2) DENX ELDK 4.1 (PowerPC 4xx / Linux)
With the assumption that (1) and (2) are both GCC-based, I have (1) working well enough. However, the information at:
http://lists.boost.org/boost-users/2007/01/24400.php
Seems stale for 1.35.0 in that GCC_ROOT_DIRECTORY, GCC and GXX are no longer referenced. My general recipe in my top-level "glue" makefile is as follows, with commands to extract the source, build a link farm, build any objects and install the library:
BoostArchive = boost_1_35_0.tar.gz BoostSource = boost_1_35_0
BoostConfigure = $(BuildDirectory)/configure BoostMakefile = $(BuildDirectory)/Makefile BoostUserConfig = $(BuildDirectory)/user-config.jam
BoostLibraries = filesystem \ thread BoostLibrariesList = $(subst $(SPACE),$(COMMA),$(strip $(BoostLibraries)))
[ snip ]
$(BoostMakefile) $(BoostUserConfig): $(BoostConfigure) cd $(BuildDirectory) && \ BJAM_CONFIG="" \ $(BoostConfigure) \ --prefix=$(ResultDirectory) \ --with-toolset=gcc \ --without-icu \ --with-libraries=$(BoostLibrariesList)
For those following this thread or tuning in from Google, thanks to Pete Goodliffe's post at: http://goodliffe.blogspot.com/2008/05/cross-compiling-boost.html I simply modified my configuration target as follows to add post-processing of the user-config.jam: $(BoostToolset) = gcc $(BoostMakefile) $(BoostUserConfig): $(BoostConfigure) cd $(BuildDirectory) && \ configure \ --prefix=$(ResultDirectory) \ --with-toolset=$(BoostToolset) \ --without-icu \ --with-libraries=$(BoostLibrariesList) sed -e "s,^\(using\)[[:space:]]\+\($(BoostToolset)\)[[:space:]]\+;,\1 \2 : : $(CXX) ;,g" \ < $(BoostUserConfig) > $(BoostUserConfig).N mv -f $(BoostUserConfig) $(BoostUserConfig).O mv -f $(BoostUserConfig).N $(BoostUserConfig) replacing: using gcc ; with: using gcc : : /usr/local/eldk/4.1/usr/bin/ppc_4xx-g++ for the cross-compiled target case or: using gcc : : /usr/bin/g++ for the native case. I assume then there's a similar way to munge the user-config.jam to override the OS guess of 'linux'? I then pass BJAM_CONFIG as for my build and install targets: BJAM_CONFIG="--layout=system --build-type=minimal" Thanks Pete! Regards, Grant
Hello Grant! Thanks for posting your solution and the link to Pete's blog. Very interesting topic for me since we also use DENX4 at our site. My solution was to create a directory of unprefixed links to the cross tools and add that to the front of $PATH. However, as Pete mentioned, that is cumbersome and ugly. Other than you I do need the full blown solution that replaces also ld by ppc_6xx-ld and objcopy by ppc_6xx-objcopy and I found no way to do so. I have no idea how to write my own toolset... Maybe you have a clue? Regards, -- Christian Pfligersdorffer Software Engineering http://www.eos.info
On 7/30/08 11:29 AM, Grant Erickson wrote:
I have been attempting to generate a build environment for boost in which two targets are involved:
1) Native GCC (Whatever the host build system is) 2) DENX ELDK 4.1 (PowerPC 4xx / Linux)
With the assumption that (1) and (2) are both GCC-based, I have (1) working well enough. However, the information at:
http://lists.boost.org/boost-users/2007/01/24400.php
Seems stale for 1.35.0 in that GCC_ROOT_DIRECTORY, GCC and GXX are no longer referenced. My general recipe in my top-level "glue" makefile is as follows, with commands to extract the source, build a link farm, build any objects and install the library:
BoostArchive = boost_1_35_0.tar.gz BoostSource = boost_1_35_0
BoostConfigure = $(BuildDirectory)/configure BoostMakefile = $(BuildDirectory)/Makefile BoostUserConfig = $(BuildDirectory)/user-config.jam
BoostLibraries = filesystem \ thread BoostLibrariesList = $(subst $(SPACE),$(COMMA),$(strip $(BoostLibraries)))
[ snip ]
$(BoostMakefile) $(BoostUserConfig): $(BoostConfigure) cd $(BuildDirectory) && \ BJAM_CONFIG="" \ $(BoostConfigure) \ --prefix=$(ResultDirectory) \ --with-toolset=gcc \ --without-icu \ --with-libraries=$(BoostLibrariesList)
For those following this thread or tuning in from Google, thanks to Pete Goodliffe's post at:
http://goodliffe.blogspot.com/2008/05/cross-compiling-boost.html
I simply modified my configuration target as follows to add post-processing of the user-config.jam:
$(BoostToolset) = gcc
$(BoostMakefile) $(BoostUserConfig): $(BoostConfigure) cd $(BuildDirectory) && \ configure \ --prefix=$(ResultDirectory) \ --with-toolset=$(BoostToolset) \ --without-icu \ --with-libraries=$(BoostLibrariesList) sed -e "s,^\(using\)[[:space:]]\+\($(BoostToolset)\)[[:space:]]\+;,\1 \2 : : $(CXX) ;,g" \ < $(BoostUserConfig) > $(BoostUserConfig).N mv -f $(BoostUserConfig) $(BoostUserConfig).O mv -f $(BoostUserConfig).N $(BoostUserConfig)
replacing:
using gcc ;
with:
using gcc : : /usr/local/eldk/4.1/usr/bin/ppc_4xx-g++
for the cross-compiled target case or:
using gcc : : /usr/bin/g++
for the native case. I assume then there's a similar way to munge the user-config.jam to override the OS guess of 'linux'?
I then pass BJAM_CONFIG as for my build and install targets:
BJAM_CONFIG="--layout=system --build-type=minimal"
Thanks Pete!
Regards,
Grant
participants (2)
-
Grant Erickson
-
Pfligersdorffer, Christian