Categories
Mastering Development

How to cross-compile an application with library dependencies for Yocto Linux?

I wrote an application on my laptop (Ubuntu 14.04) that depends on GStreamer and would like to cross-compile it for my Yocto Linux target (iMX6S-Wandboard). How do I cross-compile the application so that it runs on the target board and is able to use the GStreamer libraries?

Thank you,

Toan

UDPATE:

My Makefile:

CC=gcc

GST_LIBS=`pkg-config --cflags --libs gstreamer-1.0` 

BINS=basic-tutorial-7
FILE=basic-tutorial-7.c

install:
     $(CC) $(FILE) -o $(DESTDIR)$(BINDIR)/$(BINS)  $(GST_LIBS) 
clean:
    rm -rf $(BINS)

My *.bb file:

DESCRIPTION = "Basic Tutorial 7"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""


DEPENDS = "gstreamer1.0 pkgconfig-native"

FILES_${PN} += "${bindir}/basic-tutorial-7 ${bindir}/basic-tutorial-7"
EXTRA_OEMAKE += "DESTDIR=${D}/ DATADIR=${datadir}/basic-tutorial-7 BINDIR=${bindir}"

do_compile () {
    oe_runmake install
}

do_install () {
    oe_runmake clean
}

ERROR:

ERROR: basic-tutorial-7-1.0-r0 do_compile: oe_runmake failed
WARNING: basic-tutorial-7-1.0-r0 do_compile: /home/toanrd/poky_sdk/layers/build/bitbake/lib/bb/build.py:582: ResourceWarning: unclosed file <_io.TextIOWrapper name='/home/toanrd/Desktop/basic-tutorial-7/singletask.lock' mode='a+' encoding='UTF-8'>
  exec_func(task, localdata)

ERROR: basic-tutorial-7-1.0-r0 do_compile: Execution of '/home/toanrd/poky_sdk/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/basic-tutorial-7/1.0-r0/temp/run.do_compile.23339' failed with exit code 1:
gcc basic-tutorial-7.c -o /home/toanrd/poky_sdk/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/basic-tutorial-7/1.0-r0/image//usr/bin/basic-tutorial-7 `pkg-config --cflags --libs gstreamer-1.0`  
/home/toanrd/poky_sdk/tmp/hosttools/ld: cannot open output file /home/toanrd/poky_sdk/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/basic-tutorial-7/1.0-r0/image//usr/bin/basic-tutorial-7: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:9: install] Error 1
WARNING: exit code 1 from a shell command.

ERROR: Logfile of failure stored in: /home/toanrd/poky_sdk/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/basic-tutorial-7/1.0-r0/temp/log.do_compile.23339

Leave a Reply

Your email address will not be published. Required fields are marked *