[Buildroot] C++ Compiling

Ruud Commandeur RCommandeur at clb.nl
Fri Sep 13 07:37:15 UTC 2013


> -----Oorspronkelijk bericht-----
> Van: Yegor Yefremov [mailto:yegorslists at googlemail.com] 
> Verzonden: vrijdag 13 september 2013 9:09
> Aan: Ruud Commandeur
> CC: buildroot at uclibc.org
> Onderwerp: Re: [Buildroot] C++ Compiling
> 
> Hi Ruud,
> 
> On Fri, Sep 13, 2013 at 9:00 AM, Ruud Commandeur 
> <RCommandeur at clb.nl> wrote:
> > Hi Everyone,
> >
> > This week I tried build my 1st aplication using boost. 
> Adding the boost
> > part was easy from buildroot, but when trying to build the 
> application,
> > I get "Relocations in generic ELF" and "could not read 
> symbols: File in
> > wrong format".
> 
> Have you tried using CMake (http://cmake.org/)? CMake in BR
> (http://buildroot.uclibc.org/downloads/manual/manual.html#_inf
> rastructure_for_cmake_based_packages)
> 
> This is how you include Boost modules:
> 
> # Boost
> find_package( Boost 1.36.0 COMPONENTS program_options REQUIRED)
> 
> and here you link them:
> 
> ADD_EXECUTABLE(test ${SOURCES})
> TARGET_LINK_LIBRARIES(test ${Boost_LIBRARIES})
> 
> That's it. CMake will check for working C++ compiler at 
> configuring stage.
> 

OK, I did not think of using CMake yet. Since Boost is mostly header
files, I thought it would be no different from my other simple
C-application. I build this with a generic-package like this:

define CLB_TEST_APP_BUILD_CMDS
	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D) all
endef

Wouldn't this be possible for an application using Boost?

> 
> > Obviously, this has to do with cross-compiling. When compiling a
> > C-source, it uses arm-none-linux-gnueabi-gcc. But for a cpp 
> it uses g++,
> > resulting in an Intel 80386 object file. Looking at the 
> internet, I read
> > about an otion called "Toolchain has C++ support?". This 
> must be the one
> > to use, but I can't find it. Neither in the Toolchain 
> section nor the
> > System configuration.
> >
> > I am using Buildroot 2013.02 with CodeSourcery (Sourcery 
> Codebench) for
> > ARM 2012.03.
> 
> This toolchain always provides a C++ compiler, so you don't need to
> configure it in BR.
> 

OK, that explains why I couldn't find it :-). But, apart from the
Boost-stuff, it doesn't explain why it doesn't use the arm-gcc in this
case then. Should it be someting (the BUILD_CMD line?) in the mk-file of
my custom package?

> Yegor
> 

Thanks for your instant reply,

Ruud



More information about the buildroot mailing list