Cross Compile Player with Openembedded and BitBake

From The Player Project

Jump to: navigation, search
(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==
Line 50: Line 72:
LICENSE = "GPLv2+ and LGPLv2+"
LICENSE = "GPLv2+ and LGPLv2+"
HOMEPAGE = "http://playerstage.sourceforge.net"
HOMEPAGE = "http://playerstage.sourceforge.net"
-
DEPENDS = "libtool jpeg"
+
DEPENDS = "libtool jpeg guile"
PN = "player"
PN = "player"
PV = 3.1.0
PV = 3.1.0
Line 57: Line 79:
S="${WORKDIR}/trunk"
S="${WORKDIR}/trunk"
-
inherit pkgconfig
+
inherit pkgconfig cmake
do_configure () {
do_configure () {
-
cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_EXAMPLES=OFF -DBUILD_DOCUMENTATION=OFF -DBUILD_EXAMPLES=OFF -DBUILD_PLAYERCC=OFF -DBUILD_PLAYERCC_BOOST=OFF\
+
cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_DOCUMENTATION=OFF -DBUILD_EXAMPLES=OFF -DBUILD_PLAYERCC=OFF -DBUILD_PLAYERCC_BOOST=OFF\
-DBUILD_PYTHONC_BINDINGS=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_UTILS=OFF -DBUILD_UTILS_LOGSPLITTER=OFF -DBUILD_UTILS_PLAYERCAM=OFF \
-DBUILD_PYTHONC_BINDINGS=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_UTILS=OFF -DBUILD_UTILS_LOGSPLITTER=OFF -DBUILD_UTILS_PLAYERCAM=OFF \
-DBUILD_UTILS_PLAYERJOY=OFF -DBUILD_UTILS_PLAYERNAV=OFF -DBUILD_UTILS_PLAYERPRINT=OFF -DBUILD_UTILS_PLAYERPROP=OFF -DBUILD_UTILS_PLAYERV=OFF \
-DBUILD_UTILS_PLAYERJOY=OFF -DBUILD_UTILS_PLAYERNAV=OFF -DBUILD_UTILS_PLAYERPRINT=OFF -DBUILD_UTILS_PLAYERPROP=OFF -DBUILD_UTILS_PLAYERV=OFF \
Line 71: Line 93:
-DENABLE_DRIVER_CMVISION=OFF -DENABLE_DRIVER_CREATE=ON -DENABLE_DRIVER_CVCAM=OFF -DENABLE_DRIVER_DEADSTOP=OFF -DENABLE_DRIVER_DIOCMD=OFF -DENABLE_DRIVER_DIODELAY=OFF \
-DENABLE_DRIVER_CMVISION=OFF -DENABLE_DRIVER_CREATE=ON -DENABLE_DRIVER_CVCAM=OFF -DENABLE_DRIVER_DEADSTOP=OFF -DENABLE_DRIVER_DIOCMD=OFF -DENABLE_DRIVER_DIODELAY=OFF \
-DENABLE_DRIVER_DIOLATCH=OFF -DENABLE_DRIVER_DUMMY=OFF -DENABLE_DRIVER_EEDHCONTROLLER=OFF -DENABLE_DRIVER_EPUCK=OFF -DENABLE_DRIVER_ER1=OFF -DENABLE_DRIVER_ERRATIC=OFF \
-DENABLE_DRIVER_DIOLATCH=OFF -DENABLE_DRIVER_DUMMY=OFF -DENABLE_DRIVER_EEDHCONTROLLER=OFF -DENABLE_DRIVER_EPUCK=OFF -DENABLE_DRIVER_ER1=OFF -DENABLE_DRIVER_ERRATIC=OFF \
-
-DENABLE_DRIVER_FAKELOCALIZE=OFF -DENABLE_DRIVER_FESTIVAL=OFF -DENABLE_DRIVER_FLEXIPORT=ON -DENABLE_DRIVER_FLOCKOFBIRDS=OFF -DENABLE_DRIVER_GARCIA=OFF \
+
-DENABLE_DRIVER_FAKELOCALIZE=OFF -DENABLE_DRIVER_FESTIVAL=OFF -DENABLE_DRIVER_FLEXIPORT=OFF -DENABLE_DRIVER_FLOCKOFBIRDS=OFF -DENABLE_DRIVER_GARCIA=OFF \
-DENABLE_DRIVER_GARMINNMEA=OFF -DENABLE_DRIVER_GBXGARMINACFR=OFF -DENABLE_DRIVER_GBXSICKACFR=OFF -DENABLE_DRIVER_GLOBALIZE=OFF -DENABLE_DRIVER_GOTO=OFF \
-DENABLE_DRIVER_GARMINNMEA=OFF -DENABLE_DRIVER_GBXGARMINACFR=OFF -DENABLE_DRIVER_GBXSICKACFR=OFF -DENABLE_DRIVER_GLOBALIZE=OFF -DENABLE_DRIVER_GOTO=OFF \
-DENABLE_DRIVER_GRIDMAP=OFF -DENABLE_DRIVER_GRIPCMD=OFF -DENABLE_DRIVER_HOKUYO_AIST=OFF -DENABLE_DRIVER_IMAGESEQ=OFF -DENABLE_DRIVER_INHIBITOR=OFF \
-DENABLE_DRIVER_GRIDMAP=OFF -DENABLE_DRIVER_GRIPCMD=OFF -DENABLE_DRIVER_HOKUYO_AIST=OFF -DENABLE_DRIVER_IMAGESEQ=OFF -DENABLE_DRIVER_INHIBITOR=OFF \
Line 92: Line 114:
-DENABLE_DRIVER_UPCBARCODE=OFF -DENABLE_DRIVER_VEC2MAP=OFF -DENABLE_DRIVER_VELCMD=OFF -DENABLE_DRIVER_VFH=OFF -DENABLE_DRIVER_VIDEOCANNY=OFF \
-DENABLE_DRIVER_UPCBARCODE=OFF -DENABLE_DRIVER_VEC2MAP=OFF -DENABLE_DRIVER_VELCMD=OFF -DENABLE_DRIVER_VFH=OFF -DENABLE_DRIVER_VIDEOCANNY=OFF \
-DENABLE_DRIVER_VMAPFILE=OFF -DENABLE_DRIVER_WAVEFRONT=OFF -DENABLE_DRIVER_WBR914=OFF -DENABLE_DRIVER_WRITELOG=OFF -DENABLE_DRIVER_XSENSMT=OFF \
-DENABLE_DRIVER_VMAPFILE=OFF -DENABLE_DRIVER_WAVEFRONT=OFF -DENABLE_DRIVER_WBR914=OFF -DENABLE_DRIVER_WRITELOG=OFF -DENABLE_DRIVER_XSENSMT=OFF \
-
-DENABLE_DRIVER_YARPIMAGE=OFF -DENABLE_DRIVER_CREATE=OFF .
+
-DENABLE_DRIVER_YARPIMAGE=OFF -DENABLE_DRIVER_CREATE=OFF \
 +
-DENABLE_DRIVER_CAMERA=OFF -DENABLE_DRIVER_DIO=OFF -DENABLE_DRIVER_FIDUCAL=OFF -DENABLE_DRIVER_BLOBFINDER=OFF -DENABLE_DRIVER_NXT=OFF -DENABLE_DRIVER_MBASEDRIVER=OFF .
}
}
Line 117: Line 140:
The recipe above has several important sections.   
The recipe above has several important sections.   
-
*''DEPENDS = ""'' This recipe uses a very simple config of player that does not require any dependencies, if you wanted for example to add playerv, you would first turn the cMake variable for playerv to on( -DBUILD_UTILS_PLAYERV=ON) then you would add the relevant dependency (''DEPENDS = "gtk+"'').  Read more in the [http://docs.openembedded.org/usermanual/html/recipes_depenencies.html OpenEmbedded Manual]
+
*''DEPENDS = "libtool jpeg guile"'' This recipe uses the given dependencies for building player. If you want to add playerv, you would first turn the cMake variable for playerv to on( -DBUILD_UTILS_PLAYERV=ON) then you would add the relevant dependency (''DEPENDS = "gtk+"'').  Read more in the [http://docs.openembedded.org/usermanual/html/recipes_depenencies.html OpenEmbedded Manual]
*''PN'' Package Name.  This name should reflect the name of the project being packaged.
*''PN'' Package Name.  This name should reflect the name of the project being packaged.
*''PV'' Package Version.  This is the version number of the project being built.
*''PV'' Package Version.  This is the version number of the project being built.
*''PR'' Package Revision number.  Each time the package is rebuilt with the same PV (for example, a bugfix or security update), this revision is incremented.
*''PR'' Package Revision number.  Each time the package is rebuilt with the same PV (for example, a bugfix or security update), this revision is incremented.
-
*''inherit pkgconfig'' Very important [http://docs.openembedded.org/usermanual/html/pkgconfig_class.html Explanation]
+
*''inherit pkgconfig cmake'' Very important [http://docs.openembedded.org/usermanual/html/pkgconfig_class.html Explanation]
*''do_configure()'' Run configuration.  In Player's case, CMake is the configuration system.  Many other projects use autotools, etc. The above cmake options disable all of the optional components of Player, and install the server with no client library or drivers included. To add a driver, utility, or other option, just find the relevant CMake variable and change it (i.e. ''-DBUILD_SHARED_LIBS=ON'' or ''-DENABLE_DRIVER_BLOBTRACKER=ON'')
*''do_configure()'' Run configuration.  In Player's case, CMake is the configuration system.  Many other projects use autotools, etc. The above cmake options disable all of the optional components of Player, and install the server with no client library or drivers included. To add a driver, utility, or other option, just find the relevant CMake variable and change it (i.e. ''-DBUILD_SHARED_LIBS=ON'' or ''-DENABLE_DRIVER_BLOBTRACKER=ON'')
*''do_compile()'' Runs "make."  This is where BitBake compiles the project
*''do_compile()'' Runs "make."  This is where BitBake compiles the project
Line 139: Line 162:
To add Gearbox support to Player (i.e. for the hokuyo_aist driver), follow the [[Cross Compile Player with Gearbox]] guide.
To add Gearbox support to Player (i.e. for the hokuyo_aist driver), follow the [[Cross Compile Player with Gearbox]] guide.
 +
 +
[[Category:Documentation]]
 +
[[Category:Tutorials]]

Latest revision as of 12:31, 26 December 2011

Personal tools