mackron / miniaudio

Audio playback and capture library written in C, in a single source file.
https://miniaud.io
Other
4.07k stars 361 forks source link

Android: Build failure of dev branch due to pthread_attr_setinheritsched #805

Closed LouisDuVerdier closed 10 months ago

LouisDuVerdier commented 10 months ago

Hello,

Just reporting that latest dev branch seems to fail under Android due to commit https://github.com/mackron/miniaudio/commit/c29c001840b5de7740655fee0e3845d49ecd58e7

Output of the failure is as follows:

C:/Users/louis/Documents/Projets/MyGame/3rdparty/miniaudio/miniaudio.h:16172:21: error: use of undeclared identifier 'pthread_attr_setinheritsched'; did you mean 'pthread_attr_setguardsize'?
                    pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    pthread_attr_setguardsize
C:/Users/louis/Android/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/pthread.h:112:5: note: 'pthread_attr_setguardsize' declared here
int pthread_attr_setguardsize(pthread_attr_t* __attr, size_t __size);
    ^
1 error generated.

Seems like this is available starting from API 28, so it might require an ifdef? In case it's helpful to know, I'm using Android Min API level 26.

Thank you, Louis

mackron commented 10 months ago

Thanks for reporting this one. I was able to replicate. Fixed in the dev branch - would you be able to give that a quick try just to confirm it's compiling on your end?

LouisDuVerdier commented 10 months ago

Seems to be working now, thank you very much!