Project

General

Profile

[MANUAL] Building .DEB packages on clean Ubuntu or other Debian distros

Added by saen acro almost 8 years ago

Manual debugging step by step

There is a manual in WIKI with says there is a some needed packages dependency
https://tvheadend.org/projects/tvheadend/wiki/Building

Following this manual (from wiki) there is no chance to make any package

So here is how to solve this:
(Ubuntu 14.04LTS x86_64 used but possible to be used on newer, even "x86" version)

There is a lot of packages with need to install

First packages from wiki

sudo apt install build-essential git pkg-config libssl-dev bzip2 wget libavahi-client-dev zlib1g-dev libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libavresample-dev

so let see is this correct by running

./configure

and result is

surprise nothing happens

so we need package gettext

sudo apt install gettext

again configure command

Again missing essential part

sudo apt install cmake

Again configure

And success, there is a chance to build .DEB, but is it so simple are we miss some?

  checking for cc libiconv ...                      fail
  checking for cc libdvben50221 ...                 fail
  checking for pkg liburiparser  ...                fail (detected <none>)

those maby not 100% needed but lets install it:


libiconv
there is some strange with this library in newer version it is build in in in other library

sudo apt install libiconv-hook-dev

/// this will not solve dependency error message, maby error in configure script


libdvben50221
this is DVB-CI support for hardware CAM module on some devices
solved by instaling dvb-apps

sudo apt install dvb-apps


liburiparser

sudo apt install liburiparser-dev

Let's see with configure

Some will ask about

  checking for cc nvEncodeAPI.h ...                 fail

this is NVENC (nVidia hardware accelerator for transcoding)
I don't use nVidia can't help, there is a separate topic

So let's continue with bulding of .DEB packages.

Next step is to use Autobuild.sh, with will make all automatically. or not.


Again something missing
sudo apt install debhelper libcurl4-gnutls-dev

Crossing fingers an run again Autobuild.sh

If everything is OK,
compilation of FFMPEG X264/5 OGG AAC and some other codecs will be compiled before TVHeadend and finally .DEB files.

If there is no critical errors at the end there is show something as this

dpkg-buildpackage: binary only upload (no source included)
doozer-versioned-artifact:/opt/tvheadend/../tvheadend_4.1-2398~gc38af4c_amd64.deb:deb:application/x-deb:tvheadend_4.1-2398~gc38af4c_amd64.deb
doozer-versioned-artifact:/opt/tvheadend/../tvheadend-dbg_4.1-2398~gc38af4c_amd64.deb:deb:application/x-deb:tvheadend-dbg_4.1-2398~gc38af4c_amd64.deb
doozer-versioned-artifact:/opt/tvheadend/../tvheadend_4.1-2398~gc38af4c_amd64.changes:changes:text/plain:tvheadend_4.1-2398~gc38af4c_amd64.changes


/opt/tvheadend/../

this mean that I'm using /opt/tvheadend/ (source from git)
and files are generated in ../ (upper level) in this case /opt
installation can be done by command
sudo  dpkg -i tvheadend_4.1-2398~gc38af4c_amd64.deb


=====
Edit new dependency libpcre /Perl 5 Compatible Regular Expression Library/
to install it add

Sudo apt instal libpcre2-dev

Warning library is not accessible to all OS versions then use libpcre3-dev


GPU VA hardware acceleration aka Transcoding

  checking for pkg libva >=0.38.0 ...               ok (detected 0.39.0)
  checking for pkg libva-x11 >=0.38.0 ...           ok (detected 0.39.0)
  checking for pkg libva-drm >=0.38.0 ...           ok (detected 0.39.0)

libva-dev
libva-drm1 (libva-drm2)
libva-x11-1 (libva-x11-1)
i965-va-driver-shaders
(Latest Debian probably Ubuntu 20.04 for Intel GPU)

to work hardware need to support VA-API version minimum 0.39.0
ex.

there is a situation when Intel drivers are very buggy but work also
ex:


Short version of all needed packages

sudo apt install build-essential git ccache libpcre2-dev pkg-config libssl-dev bzip2 \
wget libavahi-client-dev zlib1g-dev libavcodec-dev libavutil-dev libavformat-dev \
libswscale-dev libavresample-dev gettext cmake libiconv-hook-dev liburiparser-dev \
debhelper libcurl4-gnutls-dev python-minimal libdvbcsa-dev python-requests

If libpcre2-dev not found use libpcre3-dev

Optional packages for optional features ;)

sudo apt install dvb-apps libva-dev libva-drm1 libva-x11-1

If used Ubuntu 18.04+ libva-drm2 libva-x11-2

To enable SYSTEMD service --enable-libsystemd_daemon on Ubuntu 18.04 and upper, install libsystemd-dev

Keep in mind, this will install ~400+Mb packages.
Some packages will install other packages to satisfy its dependencies


How to clone Github repo to local folder

Usually regular command to clone repo is

git clone https://github.com/tvheadend/tvheadend.git

This will download latest source code (unstable) ready for compilation
but if need stable or other
use command
git clone -b release/4.2 https://github.com/tvheadend/tvheadend.git

command explained
git clone -b <branch> <remote_repo>

branch list can be seen at https://github.com/tvheadend/tvheadend


ARM OpenMax support

Use only on ARM boards

apt install libomxil-bellagio-dev

do not forget to add option
--enable-omx

Python

Autobuild script search for python but it was replaced by python3
solution:

--python=/usr/bin/python3


Automated build script

Currently just clone only latest repo source code and compile it

#!/bin/bash

BASE=$(dirname "$0")
(
  if [ -d "$BASE/tvheadend" ]; then
    cd "$BASE/tvheadend" 
    git pull
  else
    cd "$BASE" 
    git clone https://github.com/tvheadend/tvheadend.git tvheadend # --depth=5 (need version tag workaround else 0.0.0 version)
    cd "$BASE/tvheadend" 
  fi
  time AUTOBUILD_CONFIGURE_EXTRA="--disable-bintray_cache --enable-vaapi --enable-nvenc --disable-hdhomerun_client --disable-hdhomerun_static " ./Autobuild.sh -j$(nproc) # edit only betwin "quotation marks" 
) | tee "$BASE/build.log" 

Use command

./configure --help

to see possible options.


Replies (92)

RE: [MANUAL] Building .DEB packages on clean Ubuntu or other Debian distros - Added by saen acro almost 2 years ago

D M wrote:

Can anyone help get this build to succeed? I tried ubuntu and Debian, but it always fails. It always ends with the following.

Use build script from first post and add this

--python=python3

to options

RE: [MANUAL] Building .DEB packages on clean Ubuntu or other Debian distros - Added by D M almost 2 years ago

It ends with the same error. UTOBUILD_CONFIGURE_EXTRA="--disable-bintray_cache --python=python3 --disable-vaapi --disable-nvenc --disable-hdhomerun_client --disable-hdhomerun_static --disable-libnpp --disable-ffmpeg_static " ./Autobuild.sh -j$(nproc)

CC src/htsmsg_binary.o
src/htsmsg_binary.c: In function ‘htsmsg_binary_des0’:
src/htsmsg_binary.c:80:39: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
80 | ((char *)f->_hmf_name)[namelen] = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from src/htsmsg_binary.h:22,
from src/htsmsg_binary.c:26:
src/htsmsg.h:84:14: note: at offset 0 to object ‘_hmf_name’ with size 0 declared here
84 | const char _hmf_name0; | ^~~~~~~
In file included from /usr/include/string.h:495,
from src/htsmsg_binary.c:24:
In function ‘memcpy’,
inlined from ‘htsmsg_binary_des0’ at src/htsmsg_binary.c:98:7:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: error: writing 16 bytes into a region of size 0 [-Werror=stringop-overflow=]
34 | return builtinmemcpy_chk (_dest, _src, __len, __bos0 (_dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/htsmsg_binary.h:22,
from src/htsmsg_binary.c:26:
src/htsmsg_binary.c: In function ‘htsmsg_binary_des0’:
src/htsmsg.h:84:14: note: at offset 0 to object ‘_hmf_name’ with size 0 declared here
84 | const char _hmf_name0; | ^~~~~~~
CC src/htsmsg_binary2.o
cc1: all warnings being treated as errors
make2: * [Makefile:715: /home/debian/tvheadend/build.linux/src/htsmsg_binary.o] Error 1
make2: *
Waiting for unfinished jobs....
src/htsmsg_binary2.c: In function ‘htsmsg_binary2_des0’:
src/htsmsg_binary2.c:139:39: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
139 | ((char *)f->_hmf_name)[namelen] = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from src/htsmsg_binary2.h:22,
from src/htsmsg_binary2.c:26:
src/htsmsg.h:84:14: note: at offset 0 to object ‘_hmf_name’ with size 0 declared here
84 | const char _hmf_name0; | ^~~~~~~
In file included from /usr/include/string.h:495,
from src/htsmsg_binary2.c:24:
In function ‘memcpy’,
inlined from ‘htsmsg_binary2_des0’ at src/htsmsg_binary2.c:157:7:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: error: writing 16 bytes into a region of size 0 [-Werror=stringop-overflow=]
34 | return builtinmemcpy_chk (_dest, _src, __len, __bos0 (_dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/htsmsg_binary2.h:22,
from src/htsmsg_binary2.c:26:
src/htsmsg_binary2.c: In function ‘htsmsg_binary2_des0’:
src/htsmsg.h:84:14: note: at offset 0 to object ‘_hmf_name’ with size 0 declared here
84 | const char _hmf_name0; | ^~~~~~~
cc1: all warnings being treated as errors
make2: * [Makefile:714: /home/debian/tvheadend/build.linux/src/htsmsg_binary2.o] Error 1
make2: Leaving directory '/home/debian/tvheadend'
make1:
[debian/rules:15: override_dh_auto_build] Error 2
make1: Leaving directory '/home/debian/tvheadend'
make: *
* [debian/rules:6: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2

RE: [MANUAL] Building .DEB packages on clean Ubuntu or other Debian distros - Added by D M almost 2 years ago

Still same result. It crashes when it gets to this line

CC              src/htsmsg_binary.o

RE: [MANUAL] Building .DEB packages on clean Ubuntu or other Debian distros - Added by Jonas Lang almost 2 years ago

What hardware are you building TVH for. Using these simple build instructions from @Dave Pickles work flawlessly


cd /tmp
        mkdir -p makepkg
        cd makepkg
        git clone https://github.com/tvheadend/tvheadend.git
        cd tvheadend

        echo "LANGUAGES_ALL = en_GB" > Makefile.common

        ./configure \
                --prefix=/usr \
                --enable-ffmpeg_static \
                --disable-ffmpeg
        make -j3
        make install

RE: [MANUAL] Building .DEB packages on clean Ubuntu or other Debian distros - Added by D M almost 2 years ago

I tried building on Ubuntu x64 and Debian x64. They both end with the same error on different machines. I even tried them on windows and still ended with the same error. I am beginning to think there is something wrong. The repo has new builds for everything but AMD x64.

RE: [MANUAL] Building .DEB packages on clean Ubuntu or other Debian distros - Added by saen acro almost 2 years ago

D M wrote:

I tried building on Ubuntu x64 and Debian x64. They both end with the same error on different machines. I even tried them on windows and still ended with the same error. I am beginning to think there is something wrong. The repo has new builds for everything but AMD x64.

Do you install all recommended packages?
I don't have any problem with latest Ubuntu and PopOS

root@flamingoxl:/opt# cat build.sh
#!/bin/bash

BASE=$(dirname "$0")
(
  if [ -d "$BASE/tvheadend" ]; then
    cd "$BASE/tvheadend" 
    git pull
  else
    cd "$BASE" 
    git clone https://github.com/tvheadend/tvheadend.git tvheadend # --depth=5 (need version tag workaround else 0.0.0 version)
    cd "$BASE/tvheadend" 
  fi
  time AUTOBUILD_CONFIGURE_EXTRA="--python=python3 --disable-bintray_cache --disable-hdhomerun_client --disable-hdhomerun_static " ./Autobuild.sh -j$(nproc) # edit only betwin "quotation marks" 
) | tee "$BASE/build.log" 

root@flamingoxl:/opt# lsb_release -a && uname -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy
Linux flamingoxl 5.15.0-53-generic #59-Ubuntu SMP Mon Oct 17 18:53:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux


Jonas Lang wrote:

Using these simple build instructions from @Dave Pickles work flawlessly

This is uninstallable later, some install scripts are not executed also.

build.log (362 KB) build.log

RE: [MANUAL] Building .DEB packages on clean Ubuntu or other Debian distros - Added by Jonas Lang almost 2 years ago

What PC are you building on. There’s no reason why the build instructions don’t work. Is this a straightforward build or are you trying to build in a VM or Docker.

As one last option you could try this beginners install guide on an x86_64 using Ubuntu 23.04 LTS https://tvheadend.org/boards/4/topics/47932

RE: [MANUAL] Building .DEB packages on clean Ubuntu or other Debian distros - Added by Michael W almost 2 years ago

I have the same error on Debian 11 x64 and aarch64 (raspberry). Building fails at htsmsg_binary.o. The last working version for me is 4.3-2058~g5543ce518.

log.txt (1.88 KB) log.txt

RE: [MANUAL] Building .DEB packages on clean Ubuntu or other Debian distros - Added by D M almost 2 years ago

Is there a way to specify 4.3-2058~g5543ce518 for building? I completed the build on ubuntu 22.04 for windows but couldn't install the deb on my debian machine. I get this error. The dependencies are not available.

The build ends with the same error on Debian native and Debian for Windows.

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package libssl3 is not available but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Edit: Maybe Debian 11 packages are outdated. Everything worked if I changed to testing.

RE: [MANUAL] Building .DEB packages on clean Ubuntu or other Debian distros - Added by Jonas Lang almost 2 years ago

Have you tried building on a PC purely with Ubuntu or one that can dual boot Ubuntu or Windows.

You’re trying to build on a sub system which I can’t help you with. You could try building and suppressing errors to see if the build process completes.

You have the instructions I pointed you to which I can confirm as of today work. You also have the instructions here.

Maybe start a new post with your issue and others can join in to.

RE: [MANUAL] Building .DEB packages on clean Ubuntu or other Debian distros - Added by D M almost 2 years ago

I tried building on a native-installed Debian 11 PC x64. It failed until I switched to testing. SO this issue is Debian 11. I see another user received the same exact error. That can't be a coincidence.

RE: [MANUAL] Building .DEB packages on clean Ubuntu or other Debian distros - Added by D M almost 2 years ago

I switched to Debian bookworms. Everything is working fine there. The missing dependency isn't available for Bullseye and I have already wasted enough time trying to get this up and running. Someone will figure this out eventually.

RE: [MANUAL] Building .DEB packages on clean Ubuntu or other Debian distros - Added by Jonas Lang almost 2 years ago

It may have helped if you answered a few simple questions at the start of your post.

There’s absolutely nothing wrong with the instructions for building on an x86_64 on Ubuntu 22.04 I linked to earlier. In fact I tried them again this evening just to verify that. You mentioned someone else experienced your problem yet you didn’t include a link to that post to show this to others.

Not sure about you wasting your time but it’s normal practice to acknowledge assistance from wherever you get it.

Who exactly do you think “that someone” your refer to sorting this out will be.

RE: [MANUAL] Building .DEB packages on clean Ubuntu or other Debian distros - Added by D M almost 2 years ago

Jonas Lang wrote:

It may have helped if you answered a few simple questions at the start of your post.

There’s absolutely nothing wrong with the instructions for building on an x86_64 on Ubuntu 22.04 I linked to earlier. In fact I tried them again this evening just to verify that. You mentioned someone else experienced your problem yet you didn’t include a link to that post to show this to others.

Not sure about you wasting your time but it’s normal practice to acknowledge assistance from wherever you get it.

Who exactly do you think “that someone” your refer to sorting this out will be.

I am using Debian 11 on an x86_x64 PC. I have said this a few times. The Build failed there but worked on Ubuntu 22.04 running on windows. It also worked on Debian testing running on an x86_x64 PC. It did not work when using Debian 11 Stable at all. Take a look at the screenshot. The build is broken.

I was able to compile tvheadend_4.3-2058~g5543ce518~buster_amd64.deb using my Debian PC but anything after fails.

(76-92/92)