OpenPHT

Building under an Ubuntu Derivative

Here's the post of someone who first got it working that I've seen

    https://forums.plex.tv/t/build-working-openpht-1-9-0-from-source-on-ubuntu-bionic-18-04-lts/363351

The major process is building an old version of ffmpeg and then applying patches to the OpenPHT code so you can avoid installing old packages.



Process

Install some build dependencies and build ffmpeg.

You also need ffmpeg and you can't just install the current version because the build will fail. The OpenPHT github page says "Bump ffmpeg to 2.8.14" so we'll use that.

Adapted from NedtheNerd[^1][^2]

Install Build Deps

sudo apt-get install build-essential git-core libsdl-image1.2-dev libflac++-dev libshairport-dev
sudo apt-add-repository -s ppa:team-xbmc/ppa sudo apt-get build-dep kodi

Download and Patch OpenPHT
cd ~
git clone https://github.com/RasPlex/OpenPHT.git openpht-source
cd openpht-source

wget https://github.com/RasPlex/Dockerfiles/raw/master/patches/plexht-0001-cec-update-to-libcec-4.patch
wget https://github.com/RasPlex/Dockerfiles/raw/master/patches/plexht-0002-websocketpp-openssl.patch

patch -p1 < plexht-0001-cec-update-to-libcec-4.patch # libcec>=4
patch -p1 < plexht-0002-websocketpp-openssl.patch # openssl>=1.1

Download, Patch and Build ffmpeg
(You have to build this first as a dependency for OpenPHT as the binrary packages are trickey
to find forward-ports for)
cd ~
mkdir ~/ffmpeg-sources
cd ~/ffmpeg-sources
wget http://ffmpeg.org/releases/ffmpeg-2.8.14.tar.gz
tar -xzf ffmpeg-2.8.14.tar.gz
cd ffmpeg-2.8.14
cp -r ~/openpht-source/lib/ffmpeg/patches patches

# You may want to enable 3DNow
./configure --prefix="/usr/local" --disable-altivec --disable-amd3dnow --disable-avisynth --disable-crystalhd --disable-debug --disable-decoder=mpeg_xvmc --disable-devices --disable-doc --disable-dxva2 --disable-encoders --disable-extra-warnings --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-frei0r --disable-gray --disable-hardcoded-tables --disable-indevs --disable-libdc1394 --disable-libfaac --disable-libfreetype --disable-libgsm --disable-libmp3lame --disable-libnut --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libopencv --disable-libopenjpeg --disable-librtmp --disable-libschroedinger --disable-libspeex --disable-libtheora --disable-libvo-aacenc --disable-libvo-amrwbenc --disable-libvorbis --disable-libvpx --disable-libx264 --disable-libxavs --disable-libxvid --disable-memalign-hack --disable-mmi --disable-muxers --disable-nonfree --disable-outdevs --disable-small --disable-static --disable-symver --disable-vda --disable-version3 --disable-w32threads --disable-x11grab --enable-asm --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --enable-bsfs --enable-bzlib --enable-dct --enable-demuxers --enable-fft --enable-filters --enable-gpl --enable-hwaccels --enable-libvorbis --enable-logging --enable-mdct --enable-muxer=adts --enable-muxer=ogg --enable-muxer=spdif --enable-network --enable-optimizations --enable-parsers --enable-pic --enable-postproc --enable-protocol=http --enable-pthreads --enable-rdft --enable-runtime-cpudetect --enable-shared --enable-stripping --enable-swscale --enable-swscale-alpha --enable-vaapi --enable-vdpau --enable-yasm --enable-zlib --host-libs=-lm
make -j 4
make check sudo make install make clean

cat /etc/ld.so.conf
    (verify it has these two lines ...maybe)

    include /etc/ld.so.conf.d/*.conf     /usr/local/lib

sudo ldconfig




cd ~ mkdir ~/openpht-build cd ~/openpht-build

cmake -DCMAKE_BUILD_TYPE=Debug -DCOMPRESS_TEXTURES=on -DUSE_INTERNAL_FFMPEG=off -DENABLE_AUTOUPDATE=off -DCMAKE_INSTALL_PREFIX=/opt/openpht "~/openpht-source"



wget': wget http://anythingtech.com.au/public/openpht-install


https://forums.plex.tv/t/build-working-openpht-1-9-0-from-source-on-ubuntu-bionic-18-04-lts/363351















mkdir openpht-build
cd openpht-build
cmake -DCMAKE_BUILD_TYPE=Debug -DCOMPRESS_TEXTURES=on -DUSE_INTERNAL_FFMPEG=off -DENABLE_AUTOUPDATE=off -DCMAKE_INSTALL_PREFIX=/opt/openpht "~/openpht-source"





Troubleshooting

$ sudo apt-get build-dep
E: Must specify at least one package to check builddeps for

    sudo nano /etc/apt/sources.list
    # Uncomment all the sourced lines, e.g.

    #deb-src

Could NOT find libcrypto

    sudo apt-get install libssl-dev

Could NOT find GLEW

    sudo apt-get install libglew-dev

Could NOT find VORBIS

    sudo apt-get install libvorbis-dev

Could NOT find MPEG2

    libmpeg2-4-dev

Could NOT find RTMP

    librtmp-dev

Could NOT find SHAIRPLAY

    libshairplay-dev

Could NOT find YAJL

    libyajl-dev

Could not find FFMPEG

    ffmpeg libavformat-dev libavdevice-dev libavcodec-dev libavfilter-dev libpostproc-dev libswscale-dev


something something boost - this sucks as it's a huge package

    libboost-all-dev

 Could NOT find LIBUSB

    apt install libusb-dev
---

Errors during Make

‘CEC::libcec_configuration {aka struct CEC::libcec_configuration}’ has no member named ‘bPowerOnScreensaver’

    Add the option to disable CEC
  
    -DENABLE_CEC=off
    #make clean and make again

or

Add the old sources from xenial

    https://packages.ubuntu.com/xenial/libs/libcec3
    https://packages.ubuntu.com/xenial/libcec-dev

    wget http://mirrors.kernel.org/ubuntu/pool/universe/libc/libcec/libcec3_3.0.1+dfsg2-9build1_amd64.deb
    wget http://mirrors.kernel.org/ubuntu/pool/universe/libc/libcec/libcec-dev_3.0.1+dfsg2-9build1_amd64.deb

    sudo dpkg --force-all -i libcec3_3.0.1+dfsg2-9build1_amd64.deb
    sudo dpkg --force-all -i libcec-dev_3.0.1+dfsg2-9build1_amd64.deb



 error: ‘SSL_R_SHORT_READ’ was not declared in this scope


    https://packages.ubuntu.com/xenial/libssl-dev

    wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.0.2g-1ubuntu4.14_amd64.deb

    sudo dpkg --force-all -i libssl-dev_1.0.2g-1ubuntu4.14_amd64.deb



Sources:


[^1]: https://github.com/RasPlex/OpenPHT/wiki/Building-OpenPHT-from-source-on-Ubuntu-14.04
[^2]: https://forums.plex.tv/t/build-working-openpht-1-9-0-from-source-on-ubuntu-bionic-18-04-lts/363351


https://forums.plex.tv/t/building-openpht-for-ubuntu/125965
https://techoverflow.net/2018/05/03/how-to-fix-apt-get-source-you-must-put-some-source-uris-in-your-sources-list/
https://github.com/RasPlex/OpenPHT/issues/246
https://www.linuxquestions.org/questions/linux-newbie-8/ubuntu-how-to-install-package-from-older-distro%27s-ppa-4175598045/
Comments