-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error: unknown type name 'thrd_t #353
Comments
Interesting It should fallback to pthread. Can you try: --- a/include/re_thread.h
+++ b/include/re_thread.h
-#if defined(HAVE_THREADS)
+#if defined(HAVE_THREADS) && !defined(__STDC_NO_THREADS__) |
Is |
Sebastian Reimers writes:
Interesting It should fallback to pthread. Can you try:
```diff
--- a/include/re_thread.h
+++ b/include/re_thread.h
-#if defined(HAVE_THREADS)
+#if defined(HAVE_THREADS) && !defined(__STDC_NO_THREADS__)
```
The above patch didn't help.
|
Sebastian Reimers writes:
Is HAVE_PTHREAD maybe not defined by your app?
I have this PTHREAD related in the Makefile that builds libbaresip:
COMMON_FLAGS := \
EXTRA_CFLAGS="$(CFLAGS) -DANDROID" \
EXTRA_CXXFLAGS="$(CFLAGS) -DANDROID -DHAVE_PTHREAD" \
EXTRA_LFLAGS="$(LFLAGS)" \
HAVE_PTHREAD=1 \
HAVE_PTHREAD_RWLOCK=1 \
HAVE_LIBPTHREAD= \
and then make like this:
make libbaresip.a -C baresip $(COMMON_FLAGS) ...
That has worked fine until very recently.
Just noticed that -DHAVE_PTHREAD is not in EXTRA_CFLAGS. I'll try if
adding that helps.
|
When I did this, Android app was built successfully:
/* #if defined(HAVE_THREADS) */
#if 0
#include <threads.h>
#else
/* #if defined(HAVE_PTHREAD) */
#if 1
#include <pthread.h>
#include <time.h>
#define ONCE_FLAG_INIT PTHREAD_ONCE_INIT
typedef pthread_once_t once_flag;
typedef pthread_t thrd_t;
typedef pthread_cond_t cnd_t;
typedef pthread_mutex_t mtx_t;
#elif defined(WIN32)
#include <windows.h>
#define ONCE_FLAG_INIT INIT_ONCE_STATIC_INIT
typedef INIT_ONCE once_flag;
typedef HANDLE thrd_t;
typedef CONDITION_VARIABLE cnd_t;
typedef CRITICAL_SECTION mtx_t;
#endif
My Makefile is here:
https://github.com/juha-h/libbaresip-android/blob/video/Makefile
|
I think you need to add the HAVE_PTHREAD definition here: https://github.com/juha-h/baresip-studio/blob/video/app/src/main/cpp/CMakeLists.txt Like we did: Line 96 in 1defe57
|
Sebastian Reimers writes:
I think you need to add the HAVE_PTHREAD definition here:
https://github.com/juha-h/baresip-studio/blob/video/app/src/main/cpp/CMakeLists.txt
Like we did:
https://github.com/baresip/re/blob/1defe575d2fa3c3059af688cc74df3af323b0ed7/CMakeLists.txt#L96
Before as you see, there is no compile time flags in my CMakeLists.txt,
because this file only handles linking.
Why are compile time flags now needed there?
|
You are compiling: |
Sebastian Reimers writes:
You are compiling: `baresip.c vidisp.c` with libre headers here:
https://github.com/juha-h/baresip-studio/blob/f0cc3813e5458a8b324923db94a2231a7f2447e3/app/src/main/cpp/CMakeLists.txt#L125
OK, thanks for help.
|
Sebastian Reimers writes:
I think you need to add the HAVE_PTHREAD definition here:
https://github.com/juha-h/baresip-studio/blob/video/app/src/main/cpp/CMakeLists.txt
Like we did:
https://github.com/baresip/re/blob/1defe575d2fa3c3059af688cc74df3af323b0ed7/CMakeLists.txt#L96
I added this to Android project's CMakeLists.txt:
add_definitions(-DHAVE_PTHREAD)
set(HAVE_PTHREAD ON)
and now the build worked. Still wondering, why only this particular
definition needs to be there.
|
I don't know where these comments come from. I haven't made them. Perhaps my GitHub account has been hacked. |
Looks like a late E-Mail reply comment. |
Sebastian Reimers writes:
Looks like a late E-Mail reply comment.
Yes, very late. I checked my GitHub logins and all was fine.
|
juha-h writes:
Just noticed that -DHAVE_PTHREAD is not in EXTRA_CFLAGS. I'll try if
adding that helps.
It didn't help either.
|
I just tried to my Android app using the latest main branches of re/rem/baresip. libbaresip build succeesed without errors, but build of the app failed like this:
Line 5 of vidisp.c has:
Am I missing some new include or something?
The text was updated successfully, but these errors were encountered: