Building Mythtv from source on raspbian

For discussion of topics specific to MythTV on Raspberry Pi devices
Post Reply
dingo35
Newcomer
Posts: 4
Joined: Sun Feb 09, 2020 6:19 pm
Netherlands

Building Mythtv from source on raspbian

Post by dingo35 »

When building Mythtv from source on raspbian on my Raspberry Pi 4, I follow these instructions the instructions on wiki/Build_from_Source (for some strange reason i am not allowed to post the link here).

Since a few months, I get this error (on branch 30/fixes, 31/fixes and master):

Code: Select all

In file included from ./libavutil/bswap.h:38,
                 from ./libavutil/intreadwrite.h:25,
                 from libavfilter/vf_curves.c:25:
libavfilter/vf_curves.c: In function ‘parse_psfile’:
./libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
     __asm__("rev16 %w0, %w0" : "+r"(x));
     ^~~~~~~
./libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
./libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
     __asm__("rev16 %w0, %w0" : "+r"(x));
     ^~~~~~~
./libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
./libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
     __asm__("rev16 %w0, %w0" : "+r"(x));
     ^~~~~~~
./libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
./libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
     __asm__("rev16 %w0, %w0" : "+r"(x));
     ^~~~~~~
./libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
make[2]: *** [ffbuild/common.mak:60: libavfilter/vf_curves.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/home/hans/mythtv/build2/mythtv/mythtv/external/FFmpeg'
make[1]: *** [Makefile:28: FFmpeg-all] Error 2
make[1]: Leaving directory '/home/hans/mythtv/build2/mythtv/mythtv/external'
make: *** [Makefile:68: external] Error 2
I suspect something changed in recent kernel reporting on Raspbian (especially on the Raspberry Pi 4 things were changing rapidly), I suspect that it has to do with the kernel now reporting AARCH64 ; dpkg --print-architecture reports armhf, which seems to be the right architecture for compiling FFmpeg. It can be solved by adding --arch=armhf to the configure line.

If you are trying to compile fixes/31 or master, you will find that a couple of command-line switches of configure are no longer valid. This is due to an upgrade from FFmpeg which is used in the Mythtv source code.

So the configure options for compiling fixes/30 are:

Code: Select all

./configure --arch=armhf --enable-openmax --disable-vdpau --disable-opengl-video --enable-opengl --disable-opengl-themepainter --disable-vaapi
For fixes/31 and master it is:

Code: Select all

./configure --arch=armhf --disable-vdpau --enable-opengl --disable-vaapi
Hope this helps!
User avatar
pgbennett
Developer
Posts: 503
Joined: Mon Apr 27, 2015 5:41 pm
United States of America

Re: Building Mythtv from source on raspbian

Post by pgbennett »

You may want to take a look at https://github.com/MythTV/packaging/blo ... Readme.rst This documents building the mythtv-light packages including for raspberry pi and should be more up to date. I have not tried that on pi4, probably it will have the same issue with arch.
dingo35
Newcomer
Posts: 4
Joined: Sun Feb 09, 2020 6:19 pm
Netherlands

Re: Building Mythtv from source on raspbian

Post by dingo35 »

Hi Peter,

Thanks for that link; I haven't tested it, but when I look at config_dot_sh (somehow I get an error message about emailing links if I try to use the normal filename here ;) ):

Code: Select all

if [[ `arch` == arm* ]] ; then
            if echo "$branch" | grep "0.28" ; then
                omx_option="--enable-openmax"
            else
                omx_option="--enable-omx-rpi"
            fi
            config_opt="$omx_option --disable-vdpau \
              --disable-opengl-video --enable-opengl --disable-opengl-themepainter \
              --disable-vaapi --disable-vaapi2 $MYTHTV_CONFIG_OPT_EXTRA"
        fi
....it looks as this will have exactly the same issues I ran into....
MikeB2013
Senior
Posts: 519
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: Building Mythtv from source on raspbian

Post by MikeB2013 »

Re: kernel now reporting AARCH64
I don't have this problem using Raspbian Buster on my Pi2, Pi3 or Pi4 using either local build of mythtv (./configure etc.) or packaging/deb-light/build_package.sh
AARCH64 implies a 64 bit is being detected, but Raspbian Buster is 32 bit.

There is an issue with packaging/deb-light for mythplugins, the plugins configure line has not been updated for fixes/31 or master.
Changes are also required due to the move to python3.

Mike
dingo35
Newcomer
Posts: 4
Joined: Sun Feb 09, 2020 6:19 pm
Netherlands

Re: Building Mythtv from source on raspbian

Post by dingo35 »

That's strange, I'm running Raspbian/Buster on Raspi 4, too. Fully updated/upgraded, but no use of rpi-update.

Some parameters to compare between our Raspi 4's:

Code: Select all

root@raspi4desk:~# uname -a
Linux raspi4desk 4.19.97-v8+ #1294 SMP PREEMPT Thu Jan 30 13:27:08 GMT 2020 aarch64 GNU/Linux

Code: Select all

root@raspi4desk:~# lscpu
Architecture:        aarch64
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           1
Vendor ID:           ARM
Model:               3
Model name:          Cortex-A72
Stepping:            r0p3
CPU max MHz:         1500.0000
CPU min MHz:         600.0000
BogoMIPS:            108.00
Flags:               fp asimd evtstrm crc32 cpuid

Code: Select all

root@raspi4desk:~# dpkg --print-architecture
armhf

Code: Select all

root@raspi4desk:~# getconf LONG_BIT
32

Code: Select all

root@raspi4desk:~# arch
aarch64

Code: Select all

root@raspi4desk:~# file /sbin/init
/sbin/init: symbolic link to /lib/systemd/systemd
root@raspi4desk:~# file /lib/systemd/systemd
/lib/systemd/systemd: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=ca029fe68355ce31b20558d3d89e329ca2efb746, stripped
How does this compare to your rig?
MikeB2013
Senior
Posts: 519
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: Building Mythtv from source on raspbian

Post by MikeB2013 »

Linux raspi4desk 4.19.97-v8+ #1294 SMP PREEMPT Thu Jan 30 13:27:08 GMT 2020 aarch64 GNU/Linux is the 64bit kernel, which according to https://www.raspberrypi.org/documentati ... xt/boot.md will only be run on a Pi4 if arm_64bit= entry in /boot/config.txt is set to greater than 1.

In my Raspbian images downloaded from https://www.raspberrypi.org/downloads/raspbian/ there is no entry for arm_64bit in /boot/config.txt so I get the v7l image from /boot/:

Code: Select all

pi@pi4-20200210-2:~ $ uname -a
Linux pi4-20200210-2 4.19.97-v7l+ #1294 SMP Thu Jan 30 13:21:14 GMT 2020 armv7l GNU/Linux

Code: Select all

pi@pi4-20200210-2:~ $ lscpu
Architecture:        armv7l
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           1
Vendor ID:           ARM
Model:               3
Model name:          Cortex-A72
Stepping:            r0p3
CPU max MHz:         1500.0000
CPU min MHz:         600.0000
BogoMIPS:            270.00
Flags:               half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32

Code: Select all

pi@pi4-20200210-2:~ $ dpkg --print-architecture
armhf

Code: Select all

pi@pi4-20200210-2:~ $ getconf LONG_BIT
32

Code: Select all

pi@pi4-20200210-2:~ $ arch
armv7l

Code: Select all

pi@pi4-20200210-2:~ $ file /sbin/init
/sbin/init: symbolic link to /lib/systemd/systemd
pi@pi4-20200210-2:~ $ file /lib/systemd/systemd
/lib/systemd/systemd: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=ca029fe68355ce31b20558d3d89e329ca2efb746, stripped
extract from start of dmesg following boot:

Code: Select all

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.19.97-v7l+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1294 SMP Thu Jan 30 13:21:14 GMT 2020
[    0.000000] CPU: ARMv7 Processor [410fd083] revision 3 (ARMv7), cr=30c5383d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[    0.000000] OF: fdt: Machine model: Raspberry Pi 4 Model B Rev 1.1
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] cma: Reserved 256 MiB at 0x000000001bc00000
[    0.000000] On node 0 totalpages: 950272
[    0.000000]   DMA zone: 1584 pages used for memmap
[    0.000000]   DMA zone: 0 pages reserved
[    0.000000]   DMA zone: 180224 pages, LIFO batch:63
[    0.000000]   HighMem zone: 770048 pages, LIFO batch:63
[    0.000000] random: get_random_bytes called from start_kernel+0xc0/0x4e8 with crng_init=0
[    0.000000] percpu: Embedded 17 pages/cpu s36928 r8192 d24512 u69632
[    0.000000] pcpu-alloc: s36928 r8192 d24512 u69632 alloc=17*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 948688
[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 cma=64M cma=256M video=HDMI-A-1:3840x2160M@60,margin_left=0,margin_right=0,margin_top=0,margin_bottom=0 smsc95xx.macaddr=DC:A6:32:01:34:B4 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  usb-storage.quirks=174c:1153:u,2109:0715:u,152d:1561:u console=ttyS0,115200 console=tty1 root=PARTUUID=b0f44574-ee6b-4de9-bfb9-f3a67647033e rootdelay=5  rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 3487908K/3801088K available (8192K kernel code, 687K rwdata, 2408K rodata, 2048K init, 850K bss, 51036K reserved, 262144K cma-reserved, 3080192K highmem)
If I put arm_64bit=1 in /boot/config.txt I see what you have on your Pi4.

Code: Select all

pi@pi4-20200210-2:~ $ lscpu
Architecture:        aarch64
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           1
Vendor ID:           ARM
Model:               3
Model name:          Cortex-A72
Stepping:            r0p3
CPU max MHz:         1500.0000
CPU min MHz:         600.0000
BogoMIPS:            108.00
Flags:               fp asimd evtstrm crc32 cpuid

Code: Select all

pi@pi4-20200210-2:~ $ arch
aarch64
EDIT : just to add, I have not used rpi-update on the Pi4 I ran the tests on.

Mike
dingo35
Newcomer
Posts: 4
Joined: Sun Feb 09, 2020 6:19 pm
Netherlands

Re: Building Mythtv from source on raspbian

Post by dingo35 »

YES, this was the big mystery! I had a "arm_64bit=1" in my /boot/config.txt , from earlier experiments with wine under Raspbian. I totally forgot about that!!

And now, without the arm_64bit=1, the arch=armhf isn't necessary anymore.

Thanks Mike for clarifying this!
"
Post Reply