Skip to contentSkip to conversation

vlc: depends on NPTL

PATCH New Waldemar Brodkorb 2 participants 2 messages Aug 21, 2016 – Aug 23, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vlc: depends on NPTL

VLC requires NPTL.

Required functions and symbols (_POSIX_CLOCK_SELECTION) are only available for NPTL.

Fixes:
http://autobuild.buildroot.net/results/3122287ddea1e316a64ccf0d0dc9415bfefebb49/

---
 package/vlc/Config.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/vlc/Config.in +2 -2
index 166e7d2..6870f0f 100644
@@ -9,7 +9,7 @@ config BR2_PACKAGE_VLC
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_USE_WCHAR
-	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_7
 	select BR2_PACKAGE_LIBVORBIS if BR2_PACKAGE_OPUS
 	select BR2_PACKAGE_VLC_OPENCV_BACKEND if BR2_PACKAGE_OPENCV
@@ -32,7 +32,7 @@ config BR2_PACKAGE_VLC_OPENCV3_BACKEND
 	select BR2_PACKAGE_OPENCV3_LIB_IMGPROC
 	select BR2_PACKAGE_OPENCV3_LIB_OBJDETECT
 
-comment "vlc needs a toolchain w/ C++, dynamic library, wchar, threads, headers >= 3.7"
+comment "vlc needs a toolchain w/ C++, dynamic library, wchar, NPTL, headers >= 3.7"
 	depends on BR2_USE_MMU
 	depends on !BR2_INSTALL_LIBSTDCPP || BR2_STATIC_LIBS || !BR2_USE_WCHAR \
 		|| !BR2_TOOLCHAIN_HAS_THREADS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_7
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 vlc: depends on NPTL

Hello,

Quoted 9 lines · Waldemar Brodkorb

VLC requires NPTL.

Required functions and symbols (_POSIX_CLOCK_SELECTION) are only available for NPTL.

Fixes:
http://autobuild.buildroot.net/results/3122287ddea1e316a64ccf0d0dc9415bfefebb49/

I don't think this is the right fix: vlc can fallback to CLOCK_REALTIME perfectly fine, it just has a bug in its code.

From src/posix/thread.c:

# if (_POSIX_MONOTONIC_CLOCK > 0) && (_POSIX_CLOCK_SELECTION > 0)
/* Compile-time POSIX monotonic clock support */
#  define vlc_clock_id (CLOCK_MONOTONIC)
# elif (_POSIX_MONOTONIC_CLOCK == 0) && (_POSIX_CLOCK_SELECTION > 0)
/* Run-time POSIX monotonic clock support (see clock_setup() below) */
static clockid_t vlc_clock_id;
# else
/* No POSIX monotonic clock support */
#   define vlc_clock_id (CLOCK_REALTIME)
#   warning Monotonic clock not available. Expect timing issues.
# endif /* _POSIX_MONOTONIC_CLOCK */

static void vlc_clock_setup_once (void)
{

# if (_POSIX_MONOTONIC_CLOCK == 0)
    long val = sysconf (_SC_MONOTONIC_CLOCK);
    assert (val != 0);
    vlc_clock_id = (val < 0) ? CLOCK_REALTIME : CLOCK_MONOTONIC;
# endif

The problem is that the vlk_clock_setup_once() code believes vlc_clock_id is a variable as soon as _POSIX_MONOTONIC_CLOCK == 0. However, that's not true: it's a variable only if _POSIX_MONOTONIC_CLOCK == 0 && _POSIX_CLOCK_SELECTION > 0.

So, to fix the build issue, you simply need to:

-# if (_POSIX_MONOTONIC_CLOCK == 0)
+# if (_POSIX_MONOTONIC_CLOCK == 0) && (_POSIX_CLOCK_SELECTION > 0)

However, once you do this, the build goes further up to the link step of libvlccore, where it fails with:

/home/thomas/projets/buildroot/output/build/vlc-2.2.4/src/.libs/libvlccore.so: undefined reference to posix_spawnp' /home/thomas/projets/buildroot/output/build/vlc-2.2.4/src/.libs/libvlccore.so: undefined reference to posix_spawn_file_actions_adddup2' /home/thomas/projets/buildroot/output/build/vlc-2.2.4/src/.libs/libvlccore.so: undefined reference to `posix_spawn_file_actions_addopen'

And this is because VLC does not link with librt, which contains those functions in uClibc. I'm not sure how vlc builds on uClibc with other toolchains. I'm adding Bernd in Cc: since he is doing most of the VLC related modifications. Hopefully he can help here.

A configure.ac check needs to be added, probably something like:

AC_CHECK_LIB(rt, clock_nanosleep, [

    VLC_ADD_LIBS([libvlccore],[-lrt]))

Could you look into this?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com