FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Embedded

 
 
LinkBack Thread Tools
 
Old 12-05-2007, 05:49 PM
Jean-Claude Gervais
 
Default Compiling trivial app

I understand how to use crossdev to generate a toolchain and xmerge to
then build ebuilds for a target system, but what if I have a simple app
that is not distributed as an ebuild?

What is the proper way to get the project to build for the intended
target?


Here is the source file, helloworld.c
.-.-.-.-.-.-.-..-.-.-.-.-.-.-.
int main ( void ) {
return 0;
}
.-.-.-.-.-.-.-..-.-.-.-.-.-.-.


Here is the makefile:
.-.-.-.-.-.-.-..-.-.-.-.-.-.-.
all: helloworld

helloworld: helloworld.o
.-.-.-.-.-.-.-..-.-.-.-.-.-.-.


What variables must I declare to get this to build for my embedded
target?

I tried CHOST, CBUILD, SYSROOT, but they are all designed to
inter-operate with Portage, the makefile ends up calling cc, which
builds for the host machine, not the target.

Thanks for any help, sorry for the newb-type question.


--
gentoo-embedded@gentoo.org mailing list
 
Old 12-06-2007, 03:53 AM
Peter Stuge
 
Default Compiling trivial app

On Wed, Dec 05, 2007 at 01:49:29PM -0500, Jean-Claude Gervais wrote:
> I understand how to use crossdev to generate a toolchain and xmerge
> to then build ebuilds for a target system, but what if I have a
> simple app that is not distributed as an ebuild?
>
> What is the proper way to get the project to build for the intended
> target?

Write an ebuild. Seriously. It's pretty easy.


> Here is the source file, helloworld.c
> .-.-.-.-.-.-.-..-.-.-.-.-.-.-.
> int main ( void ) {
> return 0;
> }
> .-.-.-.-.-.-.-..-.-.-.-.-.-.-.
>
>
> Here is the makefile:
> .-.-.-.-.-.-.-..-.-.-.-.-.-.-.
> all: helloworld
>
> helloworld: helloworld.o
> .-.-.-.-.-.-.-..-.-.-.-.-.-.-.

Ok. Make a tarball with a subdirectory named helloworld-1.0 that
contains your two files. The ebuild can then be as simple as:

--8<-- helloworld-1.0.ebuild
DESCRIPTION="hello world thing"
HOMEPAGE=""
SRC_URI="helloworld.tar.gz"

LICENSE="GPL-2" # or perhaps "your.com_proprietary" ?
SLOT="0"
KEYWORDS="amd64 x86" # add archs here of course.
IUSE=""
DEPEND=""

src_compile() {
emake
}

src_install() {
dobin helloworld
}
-->8--

Note that this should never be distributed since SRC_URI only has the
filename, and thus this requires the tarball to be placed in
/usr/portage/distfiles by some other means than portage.
Maybe make an internal URL, and add RESTRICT="mirror" instead. That
is much cleaner.

Make digests with ebuild helloworld-1.0.ebuild digest and then it
should xmerge.


//Peter
--
gentoo-embedded@gentoo.org mailing list
 
Old 12-24-2007, 07:38 PM
Mike Frysinger
 
Default Compiling trivial app

On Wednesday 05 December 2007, Jean-Claude Gervais wrote:
> I understand how to use crossdev to generate a toolchain and xmerge to
> then build ebuilds for a target system, but what if I have a simple app
> that is not distributed as an ebuild?

it's all the same. compare & contrast:

native: gcc helloworld.c -o helloworld
cross: arm-unknown-linux-gnu-gcc helloworld.c -o helloworld

there are no variables to setup. simply execute the proper compiler.
-mike
 
Old 12-25-2007, 08:19 PM
KiberGus
 
Default Compiling trivial app

2007/12/24, Mike Frysinger <vapier@gentoo.org>:
On Wednesday 05 December 2007, Jean-Claude Gervais wrote:
> I understand how to use crossdev to generate a toolchain and xmerge to
> then build ebuilds for a target system, but what if I have a simple app
> that is not distributed as an ebuild?


it's all the same.**compare & contrast:

native: gcc helloworld.c -o helloworld
cross: arm-unknown-linux-gnu-gcc helloworld.c -o helloworld

there are no variables to setup.**simply execute the proper compiler.

-mike

I think CC and CXX variables should be set to execute proper compiler. Something like:
СС=arm-unknown-linux-gnu-gcc make
 
Old 12-27-2007, 05:51 PM
Mike Frysinger
 
Default Compiling trivial app

On Tuesday 25 December 2007, KiberGus wrote:
> 2007/12/24, Mike Frysinger <vapier@gentoo.org>:
> > On Wednesday 05 December 2007, Jean-Claude Gervais wrote:
> > > I understand how to use crossdev to generate a toolchain and xmerge to
> > > then build ebuilds for a target system, but what if I have a simple app
> > > that is not distributed as an ebuild?
> >
> > it's all the same. compare & contrast:
> >
> > native: gcc helloworld.c -o helloworld
> > cross: arm-unknown-linux-gnu-gcc helloworld.c -o helloworld
> >
> > there are no variables to setup. simply execute the proper compiler.
> > -mike
> >
> > I think CC and CXX variables should be set to execute proper compiler.
>
> Something like:
> СС=arm-unknown-linux-gnu-gcc make

the poster did not indicate make was being used to manage his custom code. if
it is, then setting CC/CXX variables is customary.
-mike
 
Old 12-31-2007, 12:18 AM
Jean-Claude Gervais
 
Default Compiling trivial app

On Thu, 2007-12-27 at 13:51 -0500, Mike Frysinger wrote:
> On Tuesday 25 December 2007, KiberGus wrote:
> > 2007/12/24, Mike Frysinger <vapier@gentoo.org>:
> > > On Wednesday 05 December 2007, Jean-Claude Gervais wrote:
> > > > I understand how to use crossdev to generate a toolchain and xmerge to
> > > > then build ebuilds for a target system, but what if I have a simple app
> > > > that is not distributed as an ebuild?
> > >
> > > it's all the same. compare & contrast:
> > >
> > > native: gcc helloworld.c -o helloworld
> > > cross: arm-unknown-linux-gnu-gcc helloworld.c -o helloworld
> > >
> > > there are no variables to setup. simply execute the proper compiler.
> > > -mike
> > >
> > > I think CC and CXX variables should be set to execute proper compiler.
> >
> > Something like:
> > СС=arm-unknown-linux-gnu-gcc make
>
> the poster did not indicate make was being used to manage his custom code. if
> it is, then setting CC/CXX variables is customary.
> -mike

Thank you, Mike.
I am using Imake.
I have found that setting a few variables in the host.def is enough to
enable all the Imake rules needed to build just about any project.

Thanks again.


--
gentoo-embedded@gentoo.org mailing list
 

Thread Tools




All times are GMT. The time now is 10:31 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org