Project

General

Profile

Bug #5667

Broken build with uClibc

Added by b kuhls 26 days ago. Updated 19 days ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
2019-06-24
Due date:
% Done:

0%

Estimated time:
Found in version:
HEAD
Affected Versions:

Description

Current git head
https://github.com/tvheadend/tvheadend/commit/771dfd6bea7bd4035ed991eccbe735dc00d3f800
does not build with uClibC:

src/tvh_thread.h:163:25: error: unknown type name ‘__do_not_use_pthread_mutex_t’
 #define pthread_mutex_t __do_not_use_pthread_mutex_t

Removing
#ifndef TVH_THREAD_C
#define pthread_cond    __do_not_use_pthread_cond
#define pthread_cond_t  __do_not_use_pthread_cond_t
#define pthread_mutex   __do_not_use_pthread_mutex
#define pthread_mutex_t __do_not_use_pthread_mutex_t
#endif

from src/tvh_thread.h fixes the problem but I am unsure whether such a patch would be accepted.

History

#1

Updated by Jaroslav Kysela 26 days ago

Which .c file causes this problem? The pthread_mutex_t should not be used anywhere in tvh except in the tvh_thread.c.

#2

Updated by b kuhls 26 days ago

CC              src/main.o
In file included from src/main.c:19:0:
/home/buildroot/br5/output/build/tvheadend-771dfd6bea7bd4035ed991eccbe735dc00d3f800/src/tvh_thread.h:163:25: error: unknown type name ‘__do_not_use_pthread_mutex_t’
 #define pthread_mutex_t __do_not_use_pthread_mutex_t
                         ^
#3

Updated by Jaroslav Kysela 25 days ago

main.c does not use pthread_mutex_t . It apears like a compiler issue.

#4

Updated by b kuhls 23 days ago

src/main.c includes tvh_thread.h in line 19:
https://github.com/tvheadend/tvheadend/blob/master/src/main.c#L19

This header file in line 163 has the code which is broken on uClibc:
https://github.com/tvheadend/tvheadend/blob/master/src/tvh_thread.h#L163

This line is only included when TVH_THREAD_C is not defined.

TVH_THREAD_C is only defined in tvh_thread.c but not in main.c which seems
to me the cause of the problem. I see two possible solutions here:
- delete at least line 163 from tvh_thread.h
- add "#define TVH_THREAD_C 1" to main.c (and tvhlog.c & tvh_locale.c)

If you agree on either one of these solutions I will send a patch.

#5

Updated by Jaroslav Kysela 21 days ago

You've not got the point. It's only define, so if the pthread_mutex_t is not used in the code (and it should not be used in main.c) then the compilation error should not occur because of the forced invalid symbol (and yes - it's defined by purpose to catch all occurences of pthread usage to not mix the special tvheadend mutex code). I don't see anything from your report why uclibc compilation ends with such error. So again, where is the pthread_mutex_t symbol used when main.c is being compiled?

You may use 'gcc -E' and inspect the source code after the preprocessor run to get an overview where is pthread_mutex_t used in uclibc.

#6

Updated by b kuhls 20 days ago

#7

Updated by Jaroslav Kysela 20 days ago

What about to include uclibc's stdio.h before tvheadend's header files? It would be probably nice to make those hacks visible using #ifdef like:

#ifdef __UCLIBC_HAS_THREADS__
#include <stdio.h> /* uses pthread_mutex_t */
#endif
#8

Updated by b kuhls 19 days ago

Jaroslav Kysela wrote:

What about to include uclibc's stdio.h before tvheadend's header files?

Thx, this fixes the problem for me, sent PR: https://github.com/tvheadend/tvheadend/pull/1283

#9

Updated by Jaroslav Kysela 19 days ago

  • Status changed from New to Fixed

Merged.

Also available in: Atom PDF