Cross Compile Player with Openembedded and BitBake

From The Player Project

Jump to: navigation, search
(Undo revision 4636 by Bejer (talk))
(Compiling custom programs)
 
Line 32: Line 32:
[http://docs.openembedded.org/usermanual/usermanual.html#recipes_introduction OpenEmbedded Manual] (very useful resource)
[http://docs.openembedded.org/usermanual/usermanual.html#recipes_introduction OpenEmbedded Manual] (very useful resource)
 +
 +
 +
The following Makefile shows the principles of cross compiling player drivers (as plugins) outside OpenEmbedded / bitbake, but still make use of the generated toolchain for cross compiling to the Gumstix board. You will most likely have to modify the variables/paths to fit your particular system, but that is the easy part :)
 +
<pre>
 +
# ${OVEROTOP} is pointing to where you installed overo-oe / OpenEmbedded (probably ~/overo-oe/)
 +
PLAYER_VERSION=player-3.1.0-r0
 +
CROSS_COMPILE_SYSROOT := ${OVEROTOP}/tmp/sysroots/armv7a-angstrom-linux-gnueabi
 +
PLAYER_INCLUDE_DIR := ${OVEROTOP}/tmp/work/armv7a-angstrom-linux-gnueabi/${PLAYER_VERSION}/package/usr/include/player-3.1
 +
CXX := ${OVEROTOP}/tmp/sysroots/x86_64-linux/usr/armv7a/bin/arm-angstrom-linux-gnueabi-g++
 +
 +
all: libnxt_sense_touch_driver.so
 +
 +
%.o: %.cpp
 +
$(CXX) -Wall -fpic -g3 --sysroot=${CROSS_COMPILE_SYSROOT} -I${PLAYER_INCLUDE_DIR} -c $<
 +
 +
libnxt_sense_touch_driver.so: nxt_sense_touch.o
 +
$(CXX) -shared -fpic --sysroot=${CROSS_COMPILE_SYSROOT} -o $@ $^
 +
 +
clean:
 +
rm -f *.o *.so
 +
</pre>
 +
It is recommended to manually inspect the pkg-config flags for playercore (where the information going into PLAYER_INCLUDE_DIR came from). They can be found in playercore.pc, e.g. ${OVEROTOP}/tmp/work/armv7a-angstrom-linux-gnueabi/player-3.1.0-r0/package/usr/lib64/pkgconfig/playercore.pc for my build. Using "find ${OVEROTOP} -name 'playercore.pc'" should show you where it is located. An alternative could be to set the environment variable PKG_CONFIG_PATH to point to the pkgconfig directory e.g. export PKG_CONFIG_PATH=${OVEROTOP}/tmp/work/armv7a-angstrom-linux-gnueabi/player-3.1.0-r0/package/usr/lib64/pkgconfig  and use `pkg-config --cflags playercore` to obtain the same information.
 +
'''If you want Gearbox with your player, you must install Gearbox first [http://playerstage.sourceforge.net/wiki/Cross_Compile_Player_with_Gearbox here]
'''If you want Gearbox with your player, you must install Gearbox first [http://playerstage.sourceforge.net/wiki/Cross_Compile_Player_with_Gearbox here]
'''
'''
-
 
==Player Recipe==
==Player Recipe==

Latest revision as of 12:31, 26 December 2011

Personal tools