Cross compiled Kodi does not work on Raspberry Pi 2
#1
I tried to cross compile Kodi in an Ubuntu 14.04 64bit VM and followed basically the instructions I found here: https://github.com/xbmc/xbmc/blob/master...aspberrypi

The build process itself was successful and I built a .deb package with checkinstall. The installation of this package on the Raspberry Pi 2 running Raspbian Jessie also was successful. But after starting Kodi I only see the Kodi logo for a few seconds and then the screen goes black. Sometimes Kodi starts itself again a few times,sometimes not. The crashlog file is here: http://pastebin.com/MzTpnAyv

I hope somebody can give me a hint what to change. Thanks a lot!
Reply
#2
I'd suggest disabling the overclock first. Probably won't help, but it is a simple thing to check.

I've never heard of anyone building a .deb package for Pi when cross-compiling (you can do it when building natively).
So I'd be interested in exactly what you ran (and it would be good if it can be made to work).

I just use "make install", and then map the install directory through nfs from the Pi where it runs. Does that behave any differently.
Reply
#3
@rucksman
From what I see the crash may be because of a gcc (toolchain) version mismatch,
you built kodi with old gcc-4.8.3 (wheezy) toolchain (which has older {e|g}libc too) which may cause issues while running on newer jessie, which has gcc-4.9.2,
I'm not an expert in the area but AFAIK c++ stuff is very sensible to this,
try using newer 4.9.x jessie toolchain from https://github.com/raspberrypi/tools/tre...-gnueabihf
as oposed to https://github.com/raspberrypi/tools/tre...spbian-x64 you have used.
Reply
#4
Quote:So I'd be interested in exactly what you ran (and it would be good if it can be made to work).
Well, nothing fancy:
Code:
sudo checkinstall --install=no
First there is an error about the version (I manually enter for example 16.9.702), then I change the architecture from amd64 to amrhf. In the end there are numerous errors related to languages which I ignore.

Quote:I'd suggest disabling the overclock first. Probably won't help, but it is a simple thing to check.
Did not help, same behaviour as before.

Quote:and then map the install directory through nfs from the Pi where it runs
I have to admit that I am lost. The VM runs on my laptop. What would I have to do to map the directories to the Raspberry? Do you mean copying the directories or what?

Quote:From what I see the crash may be because of a gcc (toolchain) version mismatch,
sudo dpkg -l | grep gcc delivers in the VM:
Code:
ii  gcc                                 4:4.8.2-1ubuntu6                 amd64        GNU C compiler
ii  gcc-4.8                             4.8.4-2ubuntu1~14.04.3           amd64        GNU C compiler
ii  gcc-4.8-base:amd64                  4.8.4-2ubuntu1~14.04.3           amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-4.9-base:amd64                  4.9.3-0ubuntu4                   amd64        GCC, the GNU Compiler Collection (base package)
ii  libgcc-4.8-dev:amd64                4.8.4-2ubuntu1~14.04.3           amd64        GCC support library (development files)
ii  libgcc1:amd64                       1:4.9.3-0ubuntu4                 amd64        GCC support library
and on the Raspberry:
Code:
ii  gcc                                   4:4.9.2-2                                 armhf        GNU C compiler
ii  gcc-4.6-base:armhf                    4.6.4-5+rpi1                              armhf        GCC, the GNU Compiler Collection (base package)
ii  gcc-4.7-base:armhf                    4.7.3-11+rpi1                             armhf        GCC, the GNU Compiler Collection (base package)
ii  gcc-4.8-base:armhf                    4.8.4-1                                   armhf        GCC, the GNU Compiler Collection (base package)
ii  gcc-4.9                               4.9.2-10                                  armhf        GNU C compiler
ii  gcc-4.9-base:armhf                    4.9.2-10                                  armhf        GCC, the GNU Compiler Collection (base package)
ii  libgcc-4.9-dev:armhf                  4.9.2-10                                  armhf        GCC support library (development files)
ii  libgcc1:armhf                         1:4.9.2-10                                armhf        GCC support library
I do not understand why the compiler should have an influence on an already compiled file. But anyway I will give it a try.

Any help would be appreciated!
Reply
#5
(2016-06-01, 21:06)rucksman Wrote: I have to admit that I am lost. The VM runs on my laptop. What would I have to do to map the directories to the Raspberry? Do you mean copying the directories or what?

Copying directories would work okay.
Personally I export the install directory (from the VM)
and mount it on the pi. e.g.
sudo mount -o nolock 192.168.1.100:/opt/xbmc-dbg /opt/xbmc-dbg

Then /opt/xbmc-dbg from the VM appears on the Pi's filesysystem and it's pretty quick to rebuild and then run the latest code.
Reply
#6
Quote:... and it's pretty quick to rebuild ...

Just to get it right: Which steps do you repeat (following the tutorial here: https://github.com/xbmc/xbmc/blob/master...aspberrypi )?

Code:
make -C tools/depends/target/xbmc
make

Or ist there more/less to do?
Reply
#7
(2016-06-03, 17:23)rucksman Wrote: Just to get it right: Which steps do you repeat (following the tutorial here: https://github.com/xbmc/xbmc/blob/master...aspberrypi )?

There are 3 parts to kodi, the "depends" libs. The binary add-ons and Kodi itself.

For me, most changes just affect kodi, so I just do:
Code:
make -j5 && make install

to rebuild kodi. The command you listed rebuild the "depends" (e.g. libs like curl and libnfs).

The binary add-ons are built with something like:
Code:
make -C tools/depends/target/binary-addons PREFIX=<install dir>/arm-linux-gnueabihf
Reply
#8
I compiled a new Kodi version with a different gcc version as suggested by asavah, but it did not help. Crashlog to be found here: http://pastebin.com/tneA2Cad

@popcornmix: I think I still have not full yundertood your approach. If I mount the directories from the VM to the Raspberry, they can be seen then on the Raspberry. The next make command is than made on the raspberry? Where (which directory)? As far as I understood the make process the compiled files are already in the mounted directories, so a new make command would again put the compiled files in this mounted directories = in the VM?

If I look through the tutorial, the relevant steps are as follows:
Code:
$ cd xbmc/tools/depends
    $ ./bootstrap
    PATH="$PATH:/opt/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin" \
       ./configure --host=arm-linux-gnueabihf \
       --prefix=/opt/xbmc-bcm/xbmc-dbg \
       --with-toolchain=/usr/local/bcm-gcc/arm-bcm2708hardfp-linux-gnueabi/sysroot \
       --with-firmware=/opt/bcm-rootfs \
       --with-platform=raspberry-pi2 \
       --build=i686-linux

    $ make
    $ cd ../..

    CONFIG_EXTRA="--with-platform=raspberry-pi2 \
       --enable-libcec --enable-player=omxplayer \
       --disable-x11 --disable-xrandr --disable-openmax \
       --disable-optical-drive --disable-dvdcss --disable-joystick \
       --disable-crystalhd --disable-vtbdecoder --disable-vaapi \
       --disable-vdpau --enable-alsa" \
    $ make -C tools/depends/target/xbmc

    $ make
    $ sudo make install
So the first make command (in xbmc/tools/depends) compiles the depends libs, rright? The second make (now in xbmc/) command builds again something related to dependsHuh And the third make command builds Kodi in the end?

So as far as I have understood your way of compiling you go through all the steps except the last sudo make install, then you mount the directory to the raspberry. And then? Which directory on which machine are you entering to do the final make and make install?
Reply
#9
(2016-06-03, 20:37)rucksman Wrote: @popcornmix: I think I still have not full yundertood your approach. If I mount the directories from the VM to the Raspberry, they can be seen then on the Raspberry. The next make command is than made on the raspberry? Where (which directory)? As far as I understood the make process the compiled files are already in the mounted directories, so a new make command would again put the compiled files in this mounted directories = in the VM?

You type all make commands in the VM.
When you run "make install" it installs the files needed to run kodi (e.g. kodi.bin and all the libs and resources) into the directory you specified with the --prefix option in configure.

Because you have mounted this install directory on the Pi, you can run kodi.bin from the pi.

So on VM, /opt/xbmc-bcm/xbmc-dbg contains the kodi installation (after make install).
The kodi binary you want to run will be /opt/xbmc-dbg/arm-linux-gnueabihf/lib/kodi/kodi.bin on VM.

But you have exported /opt/xbmc-dbg from the VM and you mount it on the Pi. E.g. a line like this in /etc/exports on VM
Code:
/opt/xbmc-dbg/ *(rw,no_root_squash,insecure,no_subtree_check,async)

On the Pi I run (assuming VM has IP address 192.168.1.100, and you have created /opt/xbmc-dbg with suitable permissions)
Code:
sudo mount -o nolock 192.168.1.100:/opt/xbmc-dbg /opt/xbmc-dbg

You can now run kodi. I run with:
Code:
PATH=${P}/arm-linux-gnueabihf/bin:$PATH \
KODI_HOME=${P}/arm-linux-gnueabihf/share/kodi \
PYTHONHOME=${P}/arm-linux-gnueabihf/lib/python2.7 \
PYTHONPATH=${P}/arm-linux-gnueabihf/lib/python2.7 \
PYTHONOPTIMIZE=1 \
LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libasound.so.2 \
LD_LIBRARY_PATH=${P}/arm-linux-gnueabihf/lib \
${P}/arm-linux-gnueabihf/lib/kodi/kodi.bin --standalone --fs --lircdev /var/run/lirc/lircd &
Where P is set to /opt/xbmc-dbg.

Quote:So as far as I have understood your way of compiling you go through all the steps except the last sudo make install, then you mount the directory to the raspberry. And then? Which directory on which machine are you entering to do the final make and make install?

All make commands are run on VM. make install should be enough if /opt/xbmc-dbg has suitable permissions for normal user to write to (i.e. no need for sudo).
Reply
#10
So as far as my limited knowledge allows me to understand you can only run Kodi on the Raspberry as long as the VM is running and mounted to the Raspberry?
Reply
#11
(2016-06-03, 21:03)rucksman Wrote: So as far as my limited knowledge allows me to understand you can only run Kodi on the Raspberry as long as the VM is running and mounted to the Raspberry?

Yes. Or you can copy the install directory manually and then it will always be available.
Running directly from the build machine is useful when developing, but you can always copy the files when you are done developing and just want to run it.
Reply
#12
Got it! Setting the variables like this was the key to success!!!
Code:
PATH=${P}/arm-linux-gnueabihf/bin:$PATH \
KODI_HOME=${P}/arm-linux-gnueabihf/share/kodi \
PYTHONHOME=${P}/arm-linux-gnueabihf/lib/python2.7 \
PYTHONPATH=${P}/arm-linux-gnueabihf/lib/python2.7 \
PYTHONOPTIMIZE=1 \
LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libasound.so.2 \
LD_LIBRARY_PATH=${P}/arm-linux-gnueabihf/lib \
${P}/arm-linux-gnueabihf/lib/kodi/kodi.bin --standalone --fs &
Thank you so much for your patience and your help!

I was successful with sudo make install in the VM and then copying the necessary directories to the Raspberry. I will now try to do the same with checkinstall in the VM and installing the .deb-package on the Raspberry.
Reply
#13
Just to keep you updated:

I tried again on a fresh raspbian install. In my VM I created a .deb package with checkinstall and installed this on the Raspberry. After setting the variables explained by popcornmix Kodi startet but threw an error in my ssh client (on the main screen only the Kodi logo appeared and stayed there):
Quote:ImportError: No module named site

This seems to be due to a python error. Indeed: the directory "python2.7" in /arm-linux-gnueabihf/lib/ did not exists.

So I got rid of this installation (dpkg --purge) and simply copied the directories from my VM which were created after "sudo make install" to the Raspberry. Funny enough in these directories lib/python2.7 exists.

Not very surprising Kodi startet successfully. So the copy-method works, but not the checkinstall-method. I wonder why the python directory does not exist in the package created with checkinstallHuh?
Reply
#14
Please upvote (after logging in on Lauchpad) also https://bugs.launchpad.net/raspbian/+bug/1571196
Reply

Logout Mark Read Team Forum Stats Members Help
Cross compiled Kodi does not work on Raspberry Pi 20