2019-02-12, 11:15
I've been trying to create a "slackbuild" for Kodi-18, so that Slackware users can build and install Kodi from source using Slackware's package management tools. I have mostly succeeded - the whole saga can be found here:
Linuxquestions
but I have run in to one snag. I'm not a programmer, and not experienced with cmake, so although I have a solution, I'm not sure if its ideal - or even why its necessary!
To build a slackware package, it is necessary to build crossguid, flatbuffers and fmt internally, so first of all, I added the following to the build options (thanks to @abga who has been doing the same for Slackware on the Raspberry Pi):
Now this works fine on non-hyper-threaded processors, such as the old AMD Bulldozer in my "workshop" machine. However, when I try and use the same code on my main machine (Intel i7), the build fails with the following (not very helpful) error:
The i7 has 4 cores, but with hyper-threading, it looks like 8. Setting -j4 during the make process, instead of allowing the system to auto-detect the number of processors, allows the build to complete without errors. It looks as if hyper-threading is not allowing one step to complete in time during a parallel build.
@abga suggested creating a build log to determine precisely where the build was failing, thus:
but again, when adding this, the build completes perfectly! Comment out the build log, it fails! Re-instate it and it builds correctly! It seems as if creating the build log slows the system just sufficiently for the build to complete successfully.
For the moment, my solution is to set an environment variable for the number of actual processors - as opposed to virtual ones - and use that to set -j :
This has worked on everything I've tried so far. However, I'm NOT a programmer, and the Kodi developers may have a better way of solving the problem. I offer it here to draw their attention to the issues.
Regards,
--
Pete
Linuxquestions
but I have run in to one snag. I'm not a programmer, and not experienced with cmake, so although I have a solution, I'm not sure if its ideal - or even why its necessary!
To build a slackware package, it is necessary to build crossguid, flatbuffers and fmt internally, so first of all, I added the following to the build options (thanks to @abga who has been doing the same for Slackware on the Raspberry Pi):
Quote:#Configure build for X11: cmake ../$SRCNAM-$VERSION-$CODNAM -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_INTERNAL_CROSSGUID=ON -DENABLE_INTERNAL_FLATBUFFERS=ON -DENABLE_INTERNAL_FMT=ON -DCORE_SYSTEM_NAME=linux
Now this works fine on non-hyper-threaded processors, such as the old AMD Bulldozer in my "workshop" machine. However, when I try and use the same code on my main machine (Intel i7), the build fails with the following (not very helpful) error:
Quote:...... -- Installing: /tmp/PC/kodi-build/build/lib64/cmake/flatbuffers/FlatcTargets-release.cmake gmake[3]: Leaving directory '/tmp/PC/kodi-build/build/flatbuffers/src/flatbuffers-build' cd /tmp/PC/kodi-build/build/flatbuffers/src/flatbuffers-build && /usr/bin/cmake -E touch /tmp/PC/kodi-build/build/flatbuffers/src/flatbuffers-stamp/flatbuffers-install [ 7%] Completed 'flatbuffers' /usr/bin/cmake -E make_directory /tmp/PC/kodi-build/CMakeFiles /usr/bin/cmake -E touch /tmp/PC/kodi-build/CMakeFiles/flatbuffers-complete /usr/bin/cmake -E touch /tmp/PC/kodi-build/build/flatbuffers/src/flatbuffers-stamp/flatbuffers-done gmake[2]: Leaving directory '/tmp/PC/kodi-build' [ 7%] Built target flatbuffers gmake[1]: Leaving directory '/tmp/PC/kodi-build' gmake: *** [Makefile:141: all] Error 2
The i7 has 4 cores, but with hyper-threading, it looks like 8. Setting -j4 during the make process, instead of allowing the system to auto-detect the number of processors, allows the build to complete without errors. It looks as if hyper-threading is not allowing one step to complete in time during a parallel build.
@abga suggested creating a build log to determine precisely where the build was failing, thus:
Quote:cmake --build . -- VERBOSE=1 -j$(getconf _NPROCESSORS_ONLN) 2>&1 | tee kodi-build.log
but again, when adding this, the build completes perfectly! Comment out the build log, it fails! Re-instate it and it builds correctly! It seems as if creating the build log slows the system just sufficiently for the build to complete successfully.
For the moment, my solution is to set an environment variable for the number of actual processors - as opposed to virtual ones - and use that to set -j :
Quote:NUMJOBS=$(grep "^core id" /proc/cpuinfo | sort -u | wc -l)
then:
cmake --build . -- VERBOSE=1 -j$NUMJOBS
This has worked on everything I've tried so far. However, I'm NOT a programmer, and the Kodi developers may have a better way of solving the problem. I offer it here to draw their attention to the issues.
Regards,
--
Pete