Project

General

Profile

TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners

Added by Jonas Lang about 2 years ago

I am setting out below what instructions I used to build TVHeadend from source on Ubuntu 22.04 64 bit based on the x86_64 architecture in a simple copy/paste format.Obviously this is aimed at the TVH beginner who wants to build a version of TVH to run on their own particular machine based on the x86_64 architecture.

This was the build process I followed:

You need to install build tools,Git and any possible missing dependencies.

sudo apt install build-essential git 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 

You need to clone the TVH Git

git clone https://github.com/tvheadend/tvheadend.git ~/build/tvheadend/master

Next change to the folder that the Git clone is located in

cd ~/build/tvheadend/master

Then run the autobuild.sh script like this..This command builds Tvheadend with transcoding built-in.

AUTOBUILD_CONFIGURE_EXTRA=--enable-libffmpeg_static\ --enable-trace\ --enable-debug ./Autobuild.sh

You may be missing dependencies.If so the output from the Autobuild script will tell you which ones need to be installed. All you have to do is copy/paste the name of each missing package and use the following command to install them.

If as already reported the build process complains it can't find Python, check with the following command if it is actually installed. Ubuntu 22.04 base installation usually comes with Python 3 installed.

python3 --version

If the system reports that Python 3 is indeed installed we need to inform the Autobuild script of this fact. This useful utility will create automatic symlinks pointing the autobuild script to the fact that Python 3 is installed so the autobuild script can continue.

sudo apt install python-is-python3

Now continue on and install any of the missing packages reported by the autobuild script.

sudo apt install [ _any of the missing dependencies that the build process reported missing_ ]

Once all the missing dependencies are installed run the autobuild script again. It could take 20-30 minutes to complete.

AUTOBUILD_CONFIGURE_EXTRA=--enable-libffmpeg_static\ --enable-trace\ --enable-debug ./Autobuild.sh

Once the build is complete you will be back at the terminal prompt.The build files will look something like this.You will see them in /build/tvheadend.Take note of the name of the .deb file that build created.That's the file you will be installing.

tvheadend_4.3-373~gcb5f6a1_amd64.deb
tvheadend-dbg_4.3-373~gcb5f6a1_amd64.deb

Finally you can then install them both by running dpkg like this..

cd ~/build/tvheadend
sudo dpkg -i tvheadend*4.3-373~gcb5f6a1_amd64.deb

I suggest you restart you computer once the above is complete. Once restarted you should be ready to configure TVH. It will be located at port 9981

I've been usinf TVH for many years but have never built it myself. I've now got a copy of TVH tailored for my computer which also includes transcoding.

Just to conclude this post

To stay up to date with the latest code (commit) from the TVH Github you can use the following procedure

I followed this procedure to keep my build version up to date with the master version

To get the latest of the TVH code (commit) enter the following

cd ~/build/tvheadend/master

This will navigate you to the folder where your own local version of the TVH code is located

Next we will need to fetch the latest code (commit) from the TVH Github

git pull origin master

Next we need to build TVH again with the latest TVH code (commit)

AUTOBUILD_CONFIGURE_EXTRA=--enable-libffmpeg_static\ --enable-trace\ --enable-debug ./Autobuild.sh

Now your should see your new build by doing the following

cd
cd ~/build/tvheadend
ls 

Take note of the name of the newly built deb package as you will need it to install it.

The following steps will stop the current TVH service daemon and remove TVH but not all your configuration.

sudo systemctl stop tvheadend
sudo apt remove tvheadend -y

Finally you can now install your freshly built TVH package you built earlier. I'll use the deb package name I created earlier but you will get the actual name of your build from the ls command you used above.

sudo dpkg -i  tvheadend_4.3-2038~g5f9404117_amd64.deb

You should now have your latest build of TVH running which can be accessed in the usual way at port 9981 with all your previous configuration settings in place


Replies (45)

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by D M almost 2 years ago

I was able to successfully build for Debian on Ubuntu 22.04 using WPS. The deb is giving me some trouble though.

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

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Eric Young almost 2 years ago

D M wrote:

I was able to successfully build for Debian on Ubuntu 22.04 using WPS. The deb is giving me some trouble though.

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

I am having the exact same issue as above. I have followed the links listed in the reply. I had success with installing libssl3 package etc but remain stuck with the exact same error.
Any ideas on how to proceed. I am very new to all of this and feel like I am close.

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Süheyl Karakas almost 2 years ago

sudo apt install build-essential git libpcre2-dev pkg-config libssl-dev bzip2 wget libavahi-client-dev zlib1g-dev libavcodec-dev libavutil-dev libavformat-dev libswscale-dev gettext cmake libiconv-hook-dev liburiparser-dev debhelper libcurl4-gnutls-dev
git clone https://github.com/tvheadend/tvheadend.git ~/build/tvheadend/master
cd ~/build/tvheadend/master
sudo apt install python-is-python3
sudo apt install python3-requests libdvbcsa-dev
AUTOBUILD_CONFIGURE_EXTRA=--enable-libffmpeg_static\ --enable-trace\ --enable-debug ./Autobuild.sh

Once the build is complete you will be back at the terminal prompt.The build files will look something like this.You will see them in /build/tvheadend.Take note of the name of the .deb file that build created.That's the file you will be installing.
tvheadend_4.3-373~gcb5f6a1_amd64.deb
tvheadend-dbg_4.3-373~gcb5f6a1_amd64.deb
cd ~/build/tvheadend
sudo dpkg -i tvheadend*4.3-373~gcb5f6a1_amd64.deb

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Jonas Lang almost 2 years ago

Could you edit your post using html reflecting the copy/paste commands the user would be expected to use.

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Eric Young almost 2 years ago

Süheyl Karakas wrote:

sudo apt install build-essential git libpcre2-dev pkg-config libssl-dev bzip2 wget libavahi-client-dev zlib1g-dev libavcodec-dev libavutil-dev libavformat-dev libswscale-dev gettext cmake libiconv-hook-dev liburiparser-dev debhelper libcurl4-gnutls-dev
git clone https://github.com/tvheadend/tvheadend.git ~/build/tvheadend/master
cd ~/build/tvheadend/master
sudo apt install python-is-python3
sudo apt install python3-requests libdvbcsa-dev
AUTOBUILD_CONFIGURE_EXTRA=--enable-libffmpeg_static\ --enable-trace\ --enable-debug ./Autobuild.sh

Once the build is complete you will be back at the terminal prompt.The build files will look something like this.You will see them in /build/tvheadend.Take note of the name of the .deb file that build created.That's the file you will be installing.
tvheadend_4.3-373~gcb5f6a1_amd64.deb
tvheadend-dbg_4.3-373~gcb5f6a1_amd64.deb
cd ~/build/tvheadend
sudo dpkg -i tvheadend*4.3-373~gcb5f6a1_amd64.deb

I am attempting this now. Are you saying to simply ignore the errors after the first command line and continue?

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Eric Young almost 2 years ago

I got it working! Thank you so much for your help.
I had to slow down on those last few commands.

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Süheyl Karakas almost 2 years ago

Eric Young wrote:

I got it working! Thank you so much for your help.
I had to slow down on those last few commands.

Nice to hear! I'm not an expert, but reading the errors made me clear I was missing packages. I created a manual for my myself with all I need after a fresh install. That's why it was not formatted, just pasted it from there, sorry for the laziness

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Eric Young almost 2 years ago

Süheyl Karakas wrote:

Eric Young wrote:

I got it working! Thank you so much for your help.
I had to slow down on those last few commands.

Nice to hear! I'm not an expert, but reading the errors made me clear I was missing packages. I created a manual for my myself with all I need after a fresh install. That's why it was not formatted, just pasted it from there, sorry for the laziness

Are you user Movies2017 from that other site? :)
I'm sure I will have many more questions as I attempt to get my setup optimised. Again, can't thank you enough for the quick replies and patience.

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Süheyl Karakas almost 2 years ago

Eric Young wrote:

Süheyl Karakas wrote:

Eric Young wrote:

I got it working! Thank you so much for your help.
I had to slow down on those last few commands.

Nice to hear! I'm not an expert, but reading the errors made me clear I was missing packages. I created a manual for my myself with all I need after a fresh install. That's why it was not formatted, just pasted it from there, sorry for the laziness

Are you user Movies2017 from that other site? :)
I'm sure I will have many more questions as I attempt to get my setup optimised. Again, can't thank you enough for the quick replies and patience.

Again, I'm not an expert, just a noob, with some interest in this. And no, I'm not that user. Feel free to ask, not sure if I have the answer.

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Jonas Lang almost 2 years ago

Guys, the installer will clearly indicate what, if any, packages or dependencies are missing during the build process. All you need to do is take note of the names, install them and run the build process again. It really is that easy.

These missing dependencies/packages may vary from user to user so there’s no definitive list that can be used. The steps I created above in the original post point this out.

If someone feels they have a better way of doing things create a new post to reflect this rather than cluttering this one up.

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Dinesh Patel over 1 year ago

Why should i build when i can just install it on the libreelecc? what am i missing?

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Ukn Unknown over 1 year ago

Dinesh Patel wrote:

Why should i build when i can just install it on the libreelecc? what am i missing?

If you don't like to compile, use the repo where @flole998 is pushing master in many distros.

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Sean Warner over 1 year ago

Sounds like @Dinesh already knows how to install TVHeadend from a pre-built package. The question was.. what is the point of building TVHeadend yourself.

The answer is.... for the challenge and to learn something new.

These guides might encourage new people to learn programming, study a little the TVHeadend codebase, start fixing bugs and adding new features.

Cheers,

Flex

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Jonas Lang over 1 year ago

I’d also add if you require transcoding capabilities on your system self build is the way to go. The self build will be completely unique to your machine too. I actually used those original instructions I posted here yesterday to build TVH on a new machine and they are still valid. Saved me time looking around again.

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Mike Matthias over 1 year ago

All right, I'm stumped on a failing step in this process. Running a Raspberry Pi 4 (32GB SD card) with ubuntu server Ubuntu 22.04.2 LTS (jammy) installed.

Problem in: AUTOBUILD_CONFIGURE_EXTRA=--enable-libffmpeg_static\ --enable-trace\ --enable-debug ./Autobuild.sh

Seems to run properly until I get this:

CC src/rtsp.o
src/rtsp.c: In function ‘rtsp_describe_decode’:
src/rtsp.c:292:23: error: format ‘%lld’ expects argument of type ‘long long int *’, but argument 3 has type ‘time_t *’ {aka ‘long int *’} [-Werror=format=]
292 | sscanf(p + 8, "npt=%" PRItime_t "-%" PRItime_t, &hc->hc_rtsp_range_start, | ^~~~~ ~~~~~~~~~~~~~~~~~~~~~~ | | | time_t * {aka long int *}
In file included from src/htsmsg.h:21,
from src/hts_strtab.h:22,
from src/tvheadend.h:36,
from src/rtsp.c:21:
/usr/include/inttypes.h:57:41: note: format string is defined here
57 | # define PRId64 __PRI64_PREFIX "d"
src/rtsp.c:292:23: error: format ‘%lld’ expects argument of type ‘long long int *’, but argument 4 has type ‘time_t *’ {aka ‘long int *’} [-Werror=format=]
292 | sscanf(p + 8, "npt=%" PRItime_t "-%" PRItime_t, &hc->hc_rtsp_range_start, | ^~~~~
293 | &hc->hc_rtsp_range_end); | ~~~~~~~~~~~~~~~~~~~~ | | | time_t * {aka long int *}
In file included from src/htsmsg.h:21,
from src/hts_strtab.h:22,
from src/tvheadend.h:36,
from src/rtsp.c:21:
/usr/include/inttypes.h:57:41: note: format string is defined here
57 | # define PRId64 __PRI64_PREFIX "d"
src/rtsp.c: In function ‘rtsp_set_position’:
src/rtsp.c:333:30: error: format ‘%lld’ expects argument of type ‘long long int’, but argument 4 has type ‘time_t’ {aka ‘long int’} [-Werror=format=]
333 | snprintf(buf, sizeof(buf), "npt=%" PRItime_t "-", position); | ^~~~~ ~~~~~~ | | | time_t {aka long int}
In file included from src/htsmsg.h:21,
from src/hts_strtab.h:22,
from src/tvheadend.h:36,
from src/rtsp.c:21:
/usr/include/inttypes.h:57:41: note: format string is defined here
57 | # define PRId64 __PRI64_PREFIX "d"
cc1: all warnings being treated as errors
make2: * [Makefile:715: /home/mike/build/tvheadend/master/build.linux/src/rtsp.o] Error 1
make2: Leaving directory '/home/mike/build/tvheadend/master'
make1:
[debian/rules:15: override_dh_auto_build] Error 2
make1: Leaving directory '/home/mike/build/tvheadend/master'
make: *
* [debian/rules:6: build] Error 2

I've hunted high and low on the internet and cannot find anything that would resolve this. Would love to try tvheadend as EyeTV has gone south, NextPVR doesn't run on a Mac very well. What happens when you try to shoehorn a Windows app into a Mac

With Thanks in advance.

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Dave Pickles over 1 year ago

There was a Tvheadend commit yesterday titled "fix for 64bit time_t on 32bit systems" which might have something to do with this.

If your source code includes the commit you could try reversing it; alternatively if your source is older try updating.

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Sean Warner over 1 year ago

Google is your friend to figure out how to use git to compile an older version of tvheadend.

If you are impatient the latest pre-compiled build that runs on a Pi 4 is available from Michael Marley Ubuntu PPA from here https://tvheadend.org/projects/tvheadend/wiki/AptRepositories

And from here..

https://launchpad.net/~mamarley/+archive/ubuntu/tvheadend-git

Flex

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Jonas Lang over 1 year ago

As the title suggests I posted these instructions for the x86_64 processor. You’re building for ARM. These instructions still hold firm for x86_64 processor as of the latest master commit.

RE: TVHeadend build and install on Ubuntu 22.04 64 bit x86_64 platform for beginners - Added by Mike Matthias over 1 year ago

Thanks Jonas. Ding Dong. IMI. My only excuse is I'm new at this. More of a background in system management than development. Thanks Again, Mike

(26-45/45)