-
-
Save ykazakov/472a46e3838bf9259921b273ca8a0173 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
LXC_IMAGE=images:debian/11/cloud/armhf # base image for LXC container | |
USER=debian # exsting user with sudo inside the container | |
CONTAINER=gstreamer # the name of the container | |
[ -n "$1" ] && CONTAINER=$1 # can be set from the command line | |
# Create a log file of the build as well as displaying the build on the tty as it runs | |
exec > >(tee build_gstreamer.log) | |
exec 2>&1 | |
# Create container | |
lxc init $LXC_IMAGE $CONTAINER | |
# Add paths from the host | |
lxc config device add $CONTAINER vc disk source=/opt/vc path=opt/vc # Broadcom EGL, GLESv2 libraries | |
lxc config device add $CONTAINER vchiq unix-char source=/dev/vchiq path=/dev/vchiq gid=44 # VideoCore | |
[ -e "/dev/video0" ] && lxc config device add $CONTAINER video0 unix-char source=/dev/video0 path=/dev/video0 gid=44 # usb camera | |
lxc snapshot $CONTAINER config | |
# Start containe and wait until it boots and the user is created | |
lxc start $CONTAINER | |
lxc exec $CONTAINER -- /bin/bash -c "while ! (id -u $USER 2> /dev/null); do sleep 1; done" | |
# Remaining commands are executed inside the container by the local user | |
lxc exec $CONTAINER -- sudo --login --user $USER /bin/bash <<'EOF' | |
set -ex | |
VERSION="1.18" # gstreamer version (branch or release) | |
# Make sure linkers find the libraries | |
sudo sh -c 'echo "/opt/vc/lib" > /etc/ld.so.conf.d/00-vmcs.conf' | |
# Update and Upgrade the Pi, otherwise the build may fail due to inconsistencies | |
grep -q BCM2 /proc/cpuinfo && sudo apt-get update && sudo apt-get upgrade -y | |
# Remove old versions of dependencies; these will be build from soures | |
# use dpkg since apt-get remove fail if the package is not installed | |
sudo dpkg --remove libnice-dev libsrtp2-dev libusrsctp-dev meson libgstreamer1.0 | |
sudo apt autoremove -y | |
# Install dependencies | |
sudo apt-get install -y meson ninja-build wget git pkgconf checkinstall \ | |
libegl1-mesa-dev libgbm-dev libgles2-mesa-dev \ | |
libssl-dev libavfilter-dev libglib2.0-dev flex bison libopus-dev libvisual-0.4-dev \ | |
libvorbis-dev libjpeg-dev libdv4-dev libsoup2.4-dev libpulse-dev libdrm-dev \ | |
libopenjp2-7-dev libx264-dev libjson-glib-dev \ | |
libtheora-dev libflac-dev libwavpack-dev liba52-0.7.4-dev libmp3lame-dev \ | |
libmpeg2-4-dev libx264-dev libx265-dev libwebrtc-audio-processing-dev libsrtp2-dev libusrsctp-dev | |
# gstreamer | |
PACKAGE=gstreamer-1.0 | |
wget https://github.com/GStreamer/gst-build/archive/$VERSION.tar.gz -O gst-build-$VERSION.tar.gz | |
tar xvf gst-build-$VERSION.tar.gz | |
cd gst-build-$VERSION | |
# include the renamed egl and glesv2 libraries | |
LIBDIR=$(pwd)/lib | |
mkdir -p $LIBDIR/pkconfig | |
ln -fs /opt/vc/lib/libbrcmEGL.so $LIBDIR/libEGL.so | |
ln -fs /opt/vc/lib/libbrcmGLESv2.so $LIBDIR/libGLESv2.so | |
ln -fs /opt/vc/lib/pkgconfig/brcmegl.pc $LIBDIR/pkconfig/egl.pc | |
ln -fs /opt/vc/lib/pkgconfig/brcmglesv2.pc $LIBDIR/pkconfig/glesv2.pc | |
PKG_CONFIG_PATH="/opt/vc/lib/pkgconfig:$LIBDIR/pkconfig" meson --prefix=/usr/ build \ | |
-D gst-plugins-base:gl_api=gles2 \ | |
-D gst-plugins-base:gl_platform=egl \ | |
-D gst-plugins-base:gl_winsys=dispmanx \ | |
-D gst-plugins-base:gles2_module_name=/opt/vc/lib/libbrcmGLESv2.so \ | |
-D gst-plugins-base:egl_module_name=/opt/vc/lib/libbrcmEGL.so \ | |
-D bad=enabled \ | |
-D gst-plugins-bad:webrtc=enabled -D gst-plugins-bad:webrtcdsp=enabled \ | |
-D omx=enabled -D gst-omx:header_path=/opt/vc/include/IL -D gst-omx:target=rpi \ | |
-D introspection=disabled -D examples=disabled | |
ninja -j 3 -C build | |
echo $PACKAGE > description-pak | |
sudo checkinstall -y --fstrans=no ninja -C build install | |
sudo ldconfig | |
cd .. | |
EOF | |
lxc snapshot $CONTAINER gstreamer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm having this error on a Raspbian 10 (buster), when installing
gst-plugins-bad