Skip to contentSkip to conversation

vlc: fix compile error with uClibc-ng Linuxthreads

PATCH Superseded Waldemar Brodkorb 2 participants 2 messages Aug 25, 2016 – Aug 26, 2016

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 vlc: fix compile error with uClibc-ng Linuxthreads

The fallback code path didn't work correctly, so fix it.

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

---
v1 -> v2:
- rework autobuild failure, there is fallback code for non-NPTL, so fix it up. Suggested by Thomas Petazzoni

---
 package/vlc/0008-fix-fallback-time.patch | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 package/vlc/0008-fix-fallback-time.patch
package/vlc/0008-fix-fallback-time.patch new file +27 -0
new file mode 100644
index 0000000..9692001
@@ -0,0 +1,27 @@
+fix fallback code and add missing libraries to link command
+
+Signed-off-by: Waldemar Brodkorb <[email protected]>
+
+diff -Nur vlc-2.2.4.orig/configure.ac vlc-2.2.4/configure.ac
+--- vlc-2.2.4.orig/configure.ac	2016-05-31 18:11:07.000000000 +0200
++++ vlc-2.2.4/configure.ac	2016-08-24 21:15:50.555256426 +0200
+@@ -121,6 +121,7 @@
+     ;;
+   linux*)
+     SYS=linux
++    AC_CHECK_LIB([rt], [posix_spawnp], [VLC_ADD_LIBS([libvlccore],[-lpthread -lrt])], [], [-lpthread])
+     ;;
+   bsdi*)
+     SYS=bsdi
+diff -Nur vlc-2.2.4.orig/src/posix/thread.c vlc-2.2.4/src/posix/thread.c
+--- vlc-2.2.4.orig/src/posix/thread.c	2015-02-02 20:42:32.000000000 +0100
++++ vlc-2.2.4/src/posix/thread.c	2016-08-24 19:46:02.717783031 +0200
+@@ -85,7 +85,7 @@
+ 
+ static void vlc_clock_setup_once (void)
+ {
+-# if (_POSIX_MONOTONIC_CLOCK == 0)
++# if (_POSIX_MONOTONIC_CLOCK == 0) && (_POSIX_CLOCK_SELECTION > 0)
+     long val = sysconf (_SC_MONOTONIC_CLOCK);
+     assert (val != 0);
+     vlc_clock_id = (val < 0) ? CLOCK_REALTIME : CLOCK_MONOTONIC;
Signature · 1 line
2.1.4
#1 lore raw

PATCH v2 1/1 vlc: fix compile error with uClibc-ng Linuxthreads

Hello,

package/vlc/0008-fix-fallback-time.patch line 3

Quoted 9 lines · Waldemar Brodkorb
package/vlc/0008-fix-fallback-time.patch new file +3 -0
new file mode 100644
index 0000000..9692001
@@ -0,0 +1,27 @@
+fix fallback code and add missing libraries to link command
+
+Signed-off-by: Waldemar Brodkorb <[email protected]>

VLC is hosted in a Git repository, so a Git-formatted patch would be preferred.

package/vlc/0008-fix-fallback-time.patch line 12

Quoted 1 line
package/vlc/0008-fix-fallback-time.patch new file +1 -0
++    AC_CHECK_LIB([rt], [posix_spawnp], [VLC_ADD_LIBS([libvlccore],[-lpthread -lrt])], [], [-lpthread])

Why are you linking with -lpthread here?

With uClibc, seems like linking with -lrt is sufficient:

thomas at skate:~/projets/buildroot (master)$ ./output/host/usr/bin/arm-linux-gcc -o foo foo.c /tmp/ccigljuI.o: In function `main':
foo.c:(.text+0x2c): undefined reference to `posix_spawn'
collect2: error: ld returned 1 exit status
thomas at skate:~/projets/buildroot (master)$ ./output/host/usr/bin/arm-linux-gcc -o foo foo.c -lrt thomas at skate:~/projets/buildroot (master)$

And it builds fine with glibc with no additional library at all (neither -lrt nor -lpthread).

Thomas

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