Bug #5667

Broken build with uClibc

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

Target version:
Start date:
Due date:
% Done:


Estimated time:
Found in version:
Affected Versions:


Current git head
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

#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

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



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.


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

Updated by Jaroslav Kysela 25 days ago

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


Updated by b kuhls 23 days ago

src/main.c includes tvh_thread.h in line 19:

This header file in line 163 has the code which is broken on uClibc:

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.


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.


Updated by b kuhls 20 days ago


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:

#include <stdio.h> /* uses pthread_mutex_t */

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:


Updated by Jaroslav Kysela 19 days ago

  • Status changed from New to Fixed


Also available in: Atom PDF