Skip to main content
Topic: How do I run ldconfig manually to link individual libs? (Read 1448 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How do I run ldconfig manually to link individual libs?

libdvd{nav,read}-6.1.0 break vlc-3 (vlc-2.2.8 mostly works but is unmaintained). I built older versions in /opt, but I cannot get ldconfig to make vlc-4 use the current versions in /usr/lib. How do I configure the /usr/lib/ and /opt/libdvd{nav,read}/lib/ directories individually, so I can use both VLC versions? Otherwise I'll have to give up experimenting with vlc-4 and permanently downgrade libdvd{nav,read}.

VLC apparently cannot be configured to ignore directories when searching for installed libs. I patched configure.ac to search for libdvd{nav,read}-6.1.0, but it still links incorrectly.

sudo ldconfig -n /usr/lib doesn't work, or I wouldn't have to ask. Manual linking (ldconfig -l) is undocumented (Intended for use by experts only, says man ldconfig)

Don't tell me it can't be done, or I'll have to switch to Ubuntu, which has versioned libraries.

I will give more information if needed.

Re: How do I run ldconfig manually to link individual libs?

Reply #1
VLC 3.x seems to work for me? Does your's give error launching or what?

Re: How do I run ldconfig manually to link individual libs?

Reply #2
vlc-git is in the AUR, it would build the latest. But it fails as libmicrodns is too old.
Here is an updated PKGBUILD that builds the latest release, it has switched to meson:
Code: [Select]
# Contributor: Niklas <[email protected]>

pkgname=libmicrodns
pkgver=0.1.2
pkgrel=1
pkgdesc='Minimal mDNS resolver library'
url='https://github.com/videolabs/libmicrodns'
arch=('x86_64')
license=('LGPL2.1')
depends=('glibc')
provides=('libmicrodns.so')
source=(https://github.com/videolabs/libmicrodns/releases/download/${pkgver}/microdns-${pkgver}.tar.xz)
sha512sums=('a6b15c65c74560fdba8973c63ffae9cdde4445f54196bb2d7d6348f6c15f8f162ef0a4e91b969ea3f2a60c701c3cc72799fcfba2fbf08c37f71ba8d5e3409702')

build() {
  cd microdns-${pkgver}
  meson setup --prefix=/usr --buildtype=release builddir
  ninja -C builddir
}

package() {
  cd microdns-${pkgver}
  DESTDIR="$pkgdir" ninja -C builddir install
}

# vim: ts=2 sw=2 et:

VLC is now past configure at least, and building, I'll update you here if it actually works later!
Next build failure: too many lua's, I removed lua52 and it's rdep wireshark-cli to try again:
https://aur.archlinux.org/packages/vlc-nightly/?O=0&PP=10
The vlc-git build then succeeded, but whenever I tried to play a video vlc crashed. So I reinstalled the regular vlc Artix package which works for me.

Re: How do I run ldconfig manually to link individual libs?

Reply #3
I rebuilt vlc-3 with /opt disabled and confirmed linking against libdvd{nav,read}-6.1.0 with ldd. The problem persists. The Lua interface seems to be broken; scripts to run Lua commands after VLC startup take a long time. With libdvdnav-6.0.1 and libdvdread-6.0.2 Lua commands work properly.

The problem is that I'm probably the only one who actually uses VLC's Lua interface, which is primitive and clumsy. I wrote a script package for DVD playback, and I'm having a hard time keeping up with the breaking changes the VLC people make. (The latest is different seek times for dvdread:// and dvdnav:// since they switched to dvdnav_jump_to_sector_by_time(), which forces me to use 2 bookmark files. I'd use mpv, whose Lua interface is superior to VLC's, but mpv's DVD playback capacity is rudimentary. No menu support - how do you know which episode of a TV series DVD is the first without menu access? It isn't always the longest title. Unrealistic assumptions like this make a media player unusable).

I found I can (sometimes) start vlc-2.2.8 (which was built against /opt/libdvd{nav,read}) with
Code: [Select]
LD_PRELOAD='/opt/libdvdread/lib/libdvdread.so.7.0.0:/opt/libdvdnav/lib/libdvdnav.so.4.2.0' <vlc_command> /path/to/dvd
Doesn't work yet with vlc-4. or when I reinstall anything. The behaviour of LD_PRELOAD is confusing. There has to be a better way.

I installed the libdvd libs to /opt/libdvdnav and /opt/libdvdread and patched all the headers to point to the new directories, but they are still not enough out of the way to hide them from vlc-4 (not even if I use CFLAGS to point at /usr/lib). I'd like to find a way to avoid adding /opt/libdvd{nav,read}/lib to ld.so.conf (currently I have to do this).

Everything works as long as I keep libdvd{nav,read} downgraded.
#######, thanks for the PKGBUILD. Will try it.

Re: How do I run ldconfig manually to link individual libs?

Reply #4
The correct libmicrodns PKGBUILD is:
Code: [Select]
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Niklas <[email protected]>

pkgname=libmicrodns
pkgver=0.1.2
pkgrel=1
pkgdesc='Minimal mDNS resolver library'
url='https://github.com/videolabs/libmicrodns'
arch=('x86_64')
license=('LGPL2.1')
depends=('glibc')
makedepends=('meson')
provides=('libmicrodns.so')
source=(git+https://github.com/videolabs/libmicrodns)
sha512sums=('SKIP')

build() {
  meson ${pkgname} build
  meson configure --prefix=/usr build

  ninja -C build
}

package() {
  cd ${pkgname}
  DESTDIR="${pkgdir}" ninja install -C ${srcdir}/build
}

# vim: ts=2 sw=2 et:
No luck so far with building a full vlc-4.

Re: How do I run ldconfig manually to link individual libs?

Reply #5
Here's a vlc-4 build that sort of works (no context menu in fullscreen though, and the video is always in a separate window. I use openbox, maybe I'd need transparency, but I haven't found a compositor yet that doesn't cause tearing - not even picom). Note that this is a much reduced build, mainly for DVD playback. Maybe one can build up from this, adding stuff one by one:
Code: [Select]
# $Id: PKGBUILD 269066 2016-06-05 22:53:44Z arojas $
# Maintainer: Giovanni Scafora <[email protected]>
# Contributor: Sarah Hay <[email protected]>
# Contributor: Martin Sandsmark <[email protected]>

pkgname=vlc4
pkgver=4.0.0+dev+11561+g8a1441c0e6
pkgrel=1
pkgdesc="A multi-platform MPEG, VCD/DVD, and DivX player"
arch=('i686' 'x86_64')
url="http://www.videolan.org/vlc/"
license=('LGPL2.1' 'GPL2')
depends=('ffmpeg' 'a52dec' 'libxpm' 'libdca' 'qt5-base' 'qt5-x11extras'
         'sdl_image' 'libdvdnav' 'lua' 'libmatroska' 'qt5-svg'
         'faad2' 'twolame' 'libidn' 'qt5-quickcontrols2' 'qt5-graphicaleffects'
         'libmpeg2' 'xcb-util-keysyms' 'libplacebo'
         'libxinerama')
makedepends=('libnotify' 'flac'
             'libdc1394'
             'librsvg' 'portaudio'
             'twolame' 'libdvdcss' 'vulkan-headers'
             'mesa')
install=vlc4.install

options=('!emptydirs')

source=("git+https://github.com/videolan/vlc"
        lua53_compat.patch)
sha256sums=('SKIP'
            'd1cb88a1037120ea83ef75b2a13039a16825516b776d71597d0e2eae5df2d8fa')
validpgpkeys=('65F7C6B4206BD057A7EB73787180713BE58D1ADC') # VideoLAN Release Signing Key



pkgver() {
  cd vlc
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd vlc
  sed -i -e 's:truetype/ttf-dejavu:TTF:g' modules/visualization/projectm.cpp

  patch -p1 < ${srcdir}/lua53_compat.patch

  ./bootstrap
  sed -e 's|-Werror-implicit-function-declaration||g' -i configure
  #sed 's|whoami|echo builduser|g' -i configure
  #sed 's|hostname -f|echo arch|g' -i configure
}

build() {
  cd vlc
  export LUA_CFLAGS='-I/usr/include'
  export CXXFLAGS+=" -std=c++11"
  export DVDREAD_CFLAGS='-I/opt/libdvdread/include'
  export DVDREAD_LIBS='-L/opt/libdvdread/lib -ldvdread'
  export DVDNAV_CFLAGS='-I/opt/libdvdnav/include'
  export DVDNAV_LIBS='-L/opt/libdvdnav/lib -ldvdnav -lpthread'
  export LUAC=/usr/bin/luac
  export LUA_LIBS="`pkg-config --libs lua`"
  export QT_CFLAGS='-DQT_QUICKCONTROLS2_LIB -I/usr/include/qt/QtQuickControls2 -DQT_QML_LIB -I/usr/include/qt/QtQml -DQT_QUICK_LIB -I/usr/include/qt/QtQuick -DQT_QUICKWIDGETS_LIB -I/usr/include/qt/QtQuickWidgets -DQT_SHARED -I/usr/include/qt -I/usr/include/qt/QtGui -I/usr/include/qt/QtCore -I/usr/include/qt/QtWidgets -I/usr/include/qt/QtSvg'
  export QT_LIBS='-lQt5QuickControls2 -lQt5Qml -lQt5Widgets -lQt5Quick -lQt5QuickWidgets -lQt5Gui -lQt5Core -lQt5Svg'
  export SYSTEMD_LIBS='-lelogind'

  ./configure --prefix=/opt/vlc4 --libexecdir=/opt/vlc4/lib --disable-nls --disable-gnutls --disable-smbclient --disable-skins2 --disable-vdpau --disable-vlm --disable-jack --disable-addonmanagermodules --disable-bluray --disable-pulse --disable-fribidi --disable-live555 --disable-speex --disable-libtar --disable-kate --disable-caca --enable-libva --enable-a52 --enable-avcodec --enable-avformat --enable-swscale --enable-dvdread --enable-dvdnav --enable-postproc --enable-faad --enable-twolame --enable-flac --enable-libmpeg2 --enable-png --enable-jpeg --enable-sdl-image --enable-svg --enable-svgdec --enable-alsa --enable-freetype --disable-mtp --disable-avahi --disable-upnp --disable-microdns --disable-telx --disable-zvbi --disable-fdkaac --disable-update-check --disable-debug --disable-matroska --enable-libplacebo #--disable-medialibrary
  make
}

package() {
  cd vlc
  make DESTDIR="${pkgdir}" install

  for res in 16 32 48 128; do
    install -D -m644 "${srcdir}/vlc/share/icons/${res}x${res}/vlc.png" \
                     "${pkgdir}/opt/vlc4/share/icons/hicolor/${res}x${res}/apps/vlc.png"
  done
  #mkdir -p "${pkgdir}/usr/share/libalpm/hooks"
  #install -Dm644 "${srcdir}/update-vlc4-plugin-cache.hook" "${pkgdir}/usr/share/libalpm/hooks/update-vlc4-plugin-cache.hook"
}
# vim: ft=sh: set et sw=2:

vlc4.install:
Code: [Select]
post_install() {
ln -sf /opt/vlc4/lib/libvlc.so.12.0.0 /usr/lib/libvlc.so.12
ln -sf /opt/vlc4/lib/libvlccore.so.9.0.0 /usr/lib/libvlccore.so.9 #same soname as vlc-3, which is a bug
/opt/vlc4/lib/vlc/vlc-cache-gen /opt/vlc4/lib/vlc/plugins
}

post_upgrade() {
post_install
}
libplacebo doesn't seem to make any difference, it can be left out, at least on my box. I'm not sure I need it, I'm on Intel.
Installing to /usr didn't work (Note the soname conflict - that's why I have vlc-3 in /opt). Note I'm linking against my custom (previous version) libdvd libs. This works with the standard libdvd{nav,read} packages installed (which also have the same sonames as the previous versions).

We are getting a bit off topic, but linking is still a theme because of the soname conflict.

 

Re: How do I run ldconfig manually to link individual libs?

Reply #6
 meson configure --prefix=/usr build
That will build a debug build as default btw, as you didn't specify release. Also my pkgbuild built the latest stable release while yours is a git pkg, but they are at the same commit at present anyway.
The package name should be changed to libmicrodns-git and it should "provide" and "replace" libmicrodns to integrate smoothly with your existing packages.

Code: [Select]
/microdns-0.1.2$ meson configure --help
...etc
  --buildtype {plain,debug,debugoptimized,release,minsize,custom}  Build type to use (default: debug).
...etc