mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Build: Check __GLIBC__ for OpenHarmony to fix build fail. v6.0.83 (#3777)
When I compile on OpenHarmony, I encounter an error at the
pthread_setname_np function:
```
./src/app/srs_app_threads.cpp:53:10: error: functions that differ only in their return type cannot be overloaded
void pthread_setname_np(pthread_t trd, const char* name) {
/data/local/ohos-sdk/linux/native/llvm/bin/../../sysroot/usr/include/pthread.h:379:5: note: previous declaration is here
int pthread_setname_np(pthread_t, const char *);
```
Our libc is using musl-libc and has no defined __GLIBC__, so we wanted
to add a judgment that __GLIBC__ already defined.
This commit is contained in:
parent
fbb8c16496
commit
5b31225d7c
3 changed files with 3 additions and 2 deletions
|
|
@ -49,7 +49,7 @@ using namespace std;
|
|||
|
||||
// These functions first appeared in glibc in version 2.12.
|
||||
// See https://man7.org/linux/man-pages/man3/pthread_setname_np.3.html
|
||||
#if defined(SRS_CYGWIN64) || (defined(SRS_CROSSBUILD) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12)))
|
||||
#if defined(SRS_CYGWIN64) || (defined(SRS_CROSSBUILD) && defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12)))
|
||||
void pthread_setname_np(pthread_t trd, const char* name) {
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue