Jump to content


Photo

Exampe Makefile for openembedded apps?


  • Please log in to reply
12 replies to this topic

#1 Dirktator

  • Senior Member
  • 52 posts

0
Neutral

Posted 11 May 2008 - 18:21

Hi,

Can anybody help me with an example Makefile to build your own apps under openembedded? I already have the created the openembedded image for my DM500+ so I have the complete oe CDK etc installed. I am not sure however which parameters are required to cross-compile using the oe libraries..

Thanks!!!!
DM500+, DM8000HD, rotor, 88cm dish Mac and MacBook

Re: Exampe Makefile for openembedded apps? #2 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 11 May 2008 - 18:48

you don't have to create a makefile, assumed that the application you want to build uses GNU autotools.

In the oe build dir:

source ./env.source
bitbake devshell

then in your application dir:

source ~/oe/build/tmp/work/devshell-???/powerpc-???
oe_runconf
make



Re: Exampe Makefile for openembedded apps? #3 Dirktator

  • Senior Member
  • 52 posts

0
Neutral

Posted 11 May 2008 - 19:13

hi

- what does the source command do?
- the oe_runconf command does not execute (command not found)
DM500+, DM8000HD, rotor, 88cm dish Mac and MacBook

Re: Exampe Makefile for openembedded apps? #4 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 11 May 2008 - 19:15

the source command loads all vars from a script into the environment.
And the devshell source script contains the path to oe_runconf, so you need to source it before oe_runconf works

Re: Exampe Makefile for openembedded apps? #5 Dirktator

  • Senior Member
  • 52 posts

0
Neutral

Posted 11 May 2008 - 20:21

hmm, now suppose I have some code without a .configure file?!?
DM500+, DM8000HD, rotor, 88cm dish Mac and MacBook

Re: Exampe Makefile for openembedded apps? #6 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 11 May 2008 - 20:25

then theoretically you just use 'make', and hope your makefile is nicely structured, and supports crosscompiling.
But in general, non-autotools packages require you to edit the makefile, before you can crosscompile.

Re: Exampe Makefile for openembedded apps? #7 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 11 May 2008 - 20:28

btw, not having a configure file doesn't necessarily mean its not an autotools project.
If you have configure.in or configure.ac, you have to run autoconf to generate the configure script. (and automake to create Makefile.in's from Makefile.am's)
In that case, usually a Makefile.cvs is provided (make -f Makefile.cvs), or an autogen.sh script (./autogen.sh)

Re: Exampe Makefile for openembedded apps? #8 Dirktator

  • Senior Member
  • 52 posts

0
Neutral

Posted 11 May 2008 - 21:53

hi

compiling seems to work, but the linking process tells me:
/usr/bin/ld: big.o: Relocations in generic ELF
big.o: could not read symbols, file in wrong format

sounds like linker tries to link ppc files into intel executable or otherway around?
any idea what's missing?

Re: Exampe Makefile for openembedded apps? #9 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 11 May 2008 - 23:00

the problem is you're using the linker from your build system (/usr/bin/ld) instead of the cross linker.
Looks like you have to manually edit your makefile after all (let it use LD instead of a hardcoded ld, LD should be filled by the devshell script))

Re: Exampe Makefile for openembedded apps? #10 Dirktator

  • Senior Member
  • 52 posts

0
Neutral

Posted 12 May 2008 - 16:15

ok, seems to work... but the linking still fails...
now suppose I write my own famous helloworld.c and want to run this on the dreambox console, how should I compile and link this?
I created a tiny Makefile like:

ALLX = helloworld.o

all: helloworld.0
        $(CPP) -o hellow $(CPPFLAGS) $(LDFLAGS) ALLX

Sorry for these maybe stupid questions but I am pretty new to developing code with a cross compiler
DM500+, DM8000HD, rotor, 88cm dish Mac and MacBook

Re: Exampe Makefile for openembedded apps? #11 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 12 May 2008 - 16:29

CPP is the precompiler, normally you should use CC

And I guess helloworld.0 (zero, not o) is a typo?

Re: Exampe Makefile for openembedded apps? #12 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 12 May 2008 - 16:34

and make sure LDFLAGS contains the correct -L link paths

And perhaps specify a general rule to build .o's

.o.c:
        $(CC) $(CFLAGS) -c $<


Re: Exampe Makefile for openembedded apps? #13 Dirktator

  • Senior Member
  • 52 posts

0
Neutral

Posted 12 May 2008 - 16:42

hi

replaced CPP by CC and now it works....
sometimes life is so simple

Thanks!!!
DM500+, DM8000HD, rotor, 88cm dish Mac and MacBook


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users