Unable to build Kodi from source

Hi there,

I’ve been trying to build Kodi 17 (Krypton) on RPi 3 (Raspbian) natively for a few weeks now. I wasted a lot of time trying to go the autotools route and debugging the numerous issues that kept creeping up. Then I noticed that the autotools is supposed to be deprecated so I cleaned the repo and switched to the CMake project, but it also failed to build. Here are the steps I took:

  1. cmake failed because libcec could not be found (4.0 required, Raspbian only has libcec3 package)
  2. building only libcec from tools/depends does not work because it insists on looking for cmake in the build prefix (/opt/xbmc-deps in my case)
  3. I make links to /usr/bin/cmake in the /opt/xbmc-deps hierarchy but libcec still fails because it can’t find some cmake-related files like p8-platform.cmake and Toolchain.something
  4. I decide screw it, will build all deps, including CMake etc, so:

    Quote:ninja@pi:depends $ ./configure –with-toolchain=/usr –prefix=/opt/xbmc-deps –host=arm-linux-gnueabihf && make -j3

  5. Everything got built except ffmpeg apparently:

    Quote:make[2]: Entering directory ‘/home/ninja/src/kodi-krypton/tools/depends/target/ffmpeg’
    make -C arm-linux-gnueabihf
    make[3]: Entering directory ‘/home/ninja/src/kodi-krypton/tools/depends/target/ffmpeg/arm-linux-gnueabihf’
    Makefile:2: config.mak: No such file or directory
    Makefile:67: /common.mak: No such file or directory
    Makefile:109: /libavutil/Makefile: No such file or directory
    Makefile:109: /library.mak: No such file or directory
    Makefile:111: /doc/Makefile: No such file or directory
    Makefile:198: /tests/Makefile: No such file or directory
    make[3]: *** No rule to make target ‘/tests/Makefile’. Stop.
    make[3]: Leaving directory ‘/home/ninja/src/kodi-krypton/tools/depends/target/ffmpeg/arm-linux-gnueabihf’
    Makefile:84: recipe for target ‘build’ failed

  6. I was hoping maybe the cmake project would work at this point and magically build ffmpeg by itself, but no dice:

    Quote:ninja@pi:depends $ export PKG_CONFIG_PATH=/opt/xbmc-deps/arm-linux-gnueabihf/lib/pkgconfig # would not find my precious dependencies otherwise
    ninja@pi:depends $ mkdir build && cd build
    ninja@pi:depends $ cmake ../project/cmake/ -DENABLE_DVDCSS=OFF -DENABLE_AIRTUNES=OFF -DENABLE_OPTICAL=OFF -DENABLE_UPNP=OFF -DENABLE_X11=OFF -DENABLE_LIRC=OFF -DENABLE_BLUETOOTH=OFF -DENABLE_BLURAY=OFF -DENABLE_AVAHI=OFF -DENABLE_CEC=ON -DENABLE_SMBCLIENT=OFF

  7. it failed with libcec again, for some reason pkgconfig was finding the one that came with Raspbian, so I edited project/cmake/modules/FindCEC.cmake and added NO_DEFAULT_PATH:

    Quote:find_library(CEC_LIBRARY NAMES cec libcec PATHS ${PC_CEC_LIBDIR} NO_DEFAULT_PATH)

  8. libcec is okay now but ffmpeg still fails:

    Quote:ERROR: gnutls not found using pkg-config
    CMakeFiles/ffmpeg.dir/build.make:105: recipe for target ‘ffmpeg-prefix/src/ffmpeg-stamp/ffmpeg-configure’ failed

  9. checked the contents of build/ffmpeg/src/ffmpeg-build/ffmpeg-prefix/src/ffmpeg-build/config.log, it appears the configure script fails when trying to build a simple program using gnutls because there are a lot of undefined references to symbols related to nettle_… and __gmp… when linking, so I decided to edit arm-linux-gnueabihf/lib/pkgconfig/gnutls.pc:

    Quote:Libs: -L${libdir} -lgnutls -lnettle -lgmp

  10. that fixed some of the undefined references, but still some remain:

    Quote:gcc -march=armv6 -Wl,–as-needed -Wl,-z,noexecstack -I/opt/xbmc-deps/arm-linux-gnueabihf/include -L/opt/xbmc-deps/arm-linux-gnueabihf/lib -o /tmp/ffconf.ifSunD5K /tmp/ffconf.siiGoocR.o -lgnutls -lnettle -lgmp -lm -lbz2 -lz -pthread
    /opt/xbmc-deps/arm-linux-gnueabihf/lib/libgnutls.a(lt7-mpi.o): In function `wrap_nettle_mpi_print’:
    /home/ninja/src/kodi-krypton/tools/depends/target/gnutls/arm-linux-gnueabihf/lib/nettle/mpi.c:43: undefined reference to `nettle_mpz_sizeinbase_256_u’
    /home/ninja/src/kodi-krypton/tools/depends/target/gnutls/arm-linux-gnueabihf/lib/nettle/mpi.c:45: undefined reference to `nettle_mpz_sizeinbase_256_s’

  11. that is as far as I got, can’t keep wasting weekends over this…

Please help?