Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Compile AllJoyn on the Raspberry Pi
INDEX
-----
- BUILD IT YOURSELF
- BUILD THE AUDIO SERVICE
- BUILDING FOR ANDROID
- INSTALL WITHOUT BUILDING
BUILD IT YOURSELF
-----------------
# make sure you have installed the latest Raspbian OS
# similar instructions for Ubuntu are available here: https://allseenalliance.org/docs-and-downloads/documentation/configuring-build-environment-linux-platform
sudo apt-get install build-essential
sudo apt-get install maven
sudo apt-get install scons
sudo apt-get install git
sudo apt-get install curl
sudo apt-get install openssl
sudo apt-get install libssl-dev
sudo apt-get install libjson0
sudo apt-get install libjson0-dev
mkdir ~/bin
echo "export PATH=$PATH:~/bin" >> ~/.bashrc
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
source ~/.bashrc
mkdir -p ~/WORKING_DIRECTORY/alljoyn
cd ~/WORKING_DIRECTORY/alljoyn
git config --global user.name "YOUR_NAME_HERE"
git config --global user.email "YOUR_EMAIL_HERE"
repo init -u https://git.allseenalliance.org/gerrit/devtools/manifest
repo sync
export AJ_ROOT=$(pwd)
sudo ln -s /usr/bin/g++ /usr/bin/arm-angstrom-linux-gnueabi-g++
sudo ln -s /usr/bin/gcc /usr/bin/arm-angstrom-linux-gnueabi-gcc
cd ~/WORKING_DIRECTORY/alljoyn/core/alljoyn
scons OS=linux CPU=arm WS=off OE_BASE=/usr BINDINGS=cpp,c,java,js,objc,unity #please check the IMPORTANT comments below before running
sudo ln -sf ~/WORKING_DIRECTORY/alljoyn/core/alljoyn/build/linux/arm/debug/dist/cpp/lib/liballjoyn.so /lib/arm-linux-gnueabihf/liballjoyn.so
cd ~/WORKING_DIRECTORY/alljoyn/core/alljoyn/build/linux/arm/debug/dist/cpp/bin
ldd alljoyn-daemon #daemon not available in latest versions of alljoyn, use BR=on with scons for embedded daemon
./alljoyn-daemon --version
After executing alljoyn-daemon --version, you should see something like the following:
AllJoyn Message Bus Daemon version: v0.0.1
Copyright (c) 2009-2014 AllSeen Alliance.
Build: AllJoyn Library v0.0.1 (Built Fri Aug 22 05:36:57 UTC 2014 by pi - Git: alljoyn branch: '(no branch)' tag: 'v14.06' (+146 changes) commit ref: d611c623c14fb4d404253f39a4641bee518708b9)
IMPORTANT:
In the line:
scons OS=linux CPU=arm WS=off OE_BASE=/usr BINDINGS=cpp,c,java,js,objc,unity
the BINDINGS determine which platforms you build for (options are cpp, c, objc, java js and unity).
CPP, C: For running the deamon you'll only need to build for cpp but maybe you also want the other platforms.
JAVA: don't use OpenJDK, set Java to oracle-java7-jdk as explained below:
sudo apt-get install oracle-java7-jdk
export JAVA_HOME="/usr/lib/jvm/jdk-7-oracle-armhf"
echo "export PATH=$PATH:$JAVA_HOME/bin" >> ~/.bashrc
JS: If you also want to compile for js you need to add js to the bindings but you'll have to download xulrunner from here:
http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/1.9.2/sdk/xulrunner-1.9.2.en-US.mac-i386.sdk.tar.bz2
and set the GECKO_HOME variable to point to that uncompressed directory (only the headers are used).
UNITY: to compile for Unity you'll have to install the Mono runtime and gcms:
sudo apt-get install mono-runtime
sudo apt-get install mono-gmcs
GTEST: If you want to build all the unit tests please follow the section googletest in this document:
https://allseenalliance.org/sites/default/files/resources/config_build_environment_linux.pdf
and export GTEST_DIR with your path to the uncompressed file
BULLSEYE: References to missing variable BULLSEYE_BIN can be safely ignored.
Bullseye is code coverage analysis tool used by the alljoyn team but unfortunately it's not free or open source so I couldn't download it: http://www.bullseye.com
SERVICES: you can specify which alljoyn services to build as a scons parameter ( eg. SERVICES=about,audio )
Thanks to Mike Young whose initial setup description helped create this updated guide:
http://wildernessvoice.com/2014/07/building-allseen-alliances-alljoyn-core-on-raspberry-pi/
BUILD THE AUDIO SERVICE
-----------------------
Once you're all set up with the previous section you can also build AllJoyn audio service (enables audio streaming):
cd ~/WORKING_DIRECTORY/alljoyn/core/alljoyn/services/audio
scons OS=linux CPU=arm WS=off SERVICES=about,audio BUILD_SERVICES_SAMPLES=off BINDINGS=core,cpp OE_BASE=/usr
If you get a compilation error in the AudioMixerThread method (in file src/posix/ALSADevice.cc) locate the line with the error and remove the 3rd parameter (false) in the source code (leave the first 2 parameters only).
BUILDING FOR ANDROID
--------------------
Please follow the instructions here:
https://allseenalliance.org/developers/develop/building/android/build-source
and apply this patch if you need Android 5 support:
https://jira.allseenalliance.org/browse/ASACORE-1208
INSTALL WITHOUT BUILDING
------------------------
This is how you install the js version of AllJoyn without building it yourself (thx to oskarhane http://oskarhane.com/raspberry-pi-install-node-js-and-npm/ for the original instructions):
#!/bin/bash
#Make a new dir where you'll put the binary
sudo mkdir /opt/node
#Get it
wget http://nodejs.org/dist/v0.10.28/node-v0.10.28-linux-arm-pi.tar.gz
#unpack
tar xvzf node-v0.10.28-linux-arm-pi.tar.gz
#Copy to the dir you made as the first step
sudo cp -r node-v0.10.28-linux-arm-pi/* /opt/node
#Add node to your path so you can call it with just "node"
cd ~
nano .bashrc
#Add these lines to the file you opened
PATH=$PATH:/opt/node/bin
export PATH
#Save and exit
#Install npm package of AllJoyn contributed by octoblu https://github.com/octoblu/alljoyn https://www.youtube.com/watch?v=OpjVzKeLpEQ
npm install -g alljoyn
#Warning: only discovery, messaging and notifications supported as of this writing
Important:
If node is not found even after adding it to the path maybe you're sudoing and the environment variables are not being passed. Try adding the path /opt/node/bin to the /etc/sudoers file

Hi germanviscuso,

I am trying to do these steps and after executing this command:
scons OS=linux CPU=arm WS=off OE_BASE=/usr BINDINGS=cpp,c

the ubuntu terminal displayed these:
scons: Reading SConscript files ...
CROSS_COMPILE variable is required for Linux/ARM builds

when I tried to update my last command to this:
scons OS=linux CPU=arm WS=off OE_BASE=/usr BINDINGS=cpp,c CROSS_COMPILE=on

the terminal displayed an error:
scons: done reading SConscript files.
scons: Building targets ...
[CC] alljoyn_c/test/bbcclient.c
sh: 1: ongcc: not found

Please let me know what needs to be done with this issue.

Thank you very much,
Darrell

CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf-

Hello germanviscuso,

After I did avobe steps, I can not found ~/WORKGOUP/core/alljoyn/build/linux/arm/debug/dist/ directory.
I can found only ~/WORKGOUP/core/alljoyn/build/linux/arm/debug/obj directory.
Could you let me know how to make missing directory?

Best Regards,
ShigeMaeda

Tip here for the armv7 peeps: https://ask.allseenalliance.org/question/788/how-to-compile-suite-140600-on-beaglebone-black/

The goofy defaults in the build are for raspi but they won't work for other platforms like the BBB.

uofubry commented Jun 25, 2015

I do not have the ~/WORKING_DIRECTORY/alljoyn/core/alljoyn/services/audio directory. The only thing in the services directory is about. I looked at the source tar balls and none of the recent ones have the audio directory either.
Thoughts?

kurtng commented Oct 28, 2015

I had to run
sudo apt-get update
sudo apt-get install libssl-dev
before as I was getting errors saying that it could not find some openssl header file.

voltagex commented Jul 9, 2017 edited

gpg: keybox '/root/.repoconfig/gnupg/pubring.kbx' created
gpg: /root/.repoconfig/gnupg/trustdb.gpg: trustdb created
gpg: key 16530D5E920F5C65: public key "Repo Maintainer <repo@android.kernel.org>" imported
gpg: key 67B7E448692B382C: public key "Conley Owens <cco3@android.com>" imported
gpg: Total number processed: 2
gpg:               imported: 2
Get https://gerrit.googlesource.com/git-repo/clone.bundle
Get https://gerrit.googlesource.com/git-repo
From https://gerrit.googlesource.com/git-repo
   35d2221..259f165  master     -> origin/master

Traceback (most recent call last):
  File "/root/repo", line 883, in <module>
    main(sys.argv[1:])
  File "/root/repo", line 871, in main
    os.execv(sys.executable, me)
TypeError: execv() arg 2 must contain only strings
The command '/bin/sh -c /root/repo init -u https://git.allseenalliance.org/gerrit/devtools/manifest' returned a non-zero code: 1

The repo line should be repo init -u https://git.allseenalliance.org/gerrit/devtools/manifest.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment