All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] vlc: depends on NPTL
@ 2016-08-21 22:18 Waldemar Brodkorb
  2016-08-23 14:12 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: Waldemar Brodkorb @ 2016-08-21 22:18 UTC (permalink / raw)
  To: buildroot

VLC requires NPTL.

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

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

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 package/vlc/Config.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/vlc/Config.in b/package/vlc/Config.in
index 166e7d2..6870f0f 100644
--- a/package/vlc/Config.in
+++ b/package/vlc/Config.in
@@ -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
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Buildroot] [PATCH] vlc: depends on NPTL
  2016-08-21 22:18 [Buildroot] [PATCH] vlc: depends on NPTL Waldemar Brodkorb
@ 2016-08-23 14:12 ` Thomas Petazzoni
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2016-08-23 14:12 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 22 Aug 2016 00:18:49 +0200, Waldemar Brodkorb wrote:
> VLC requires NPTL.
> 
> Required functions and symbols (_POSIX_CLOCK_SELECTION) are only
> available for NPTL.
> 
> Fixes:
>   http://autobuild.buildroot.net/results/3122287ddea1e316a64ccf0d0dc9415bfefebb49/
> 
> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>

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
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-23 14:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-21 22:18 [Buildroot] [PATCH] vlc: depends on NPTL Waldemar Brodkorb
2016-08-23 14:12 ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.