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.
pull/3810/head
terrencetang2023 1 year ago committed by GitHub
parent fbb8c16496
commit 5b31225d7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -7,6 +7,7 @@ The changelog for SRS.
<a name="v6-changes"></a>
## SRS 6.0 Changelog
* v6.0, 2023-09-22, Merge [#3777](https://github.com/ossrs/srs/pull/3777): Compile: Add a __GLIBC__ definition for the pthread_setname_np. v6.0.83 (#3777)
* v6.0, 2023-09-21, Merge [#3806](https://github.com/ossrs/srs/pull/3806): Build: Support sys-ssl for srt. v6.0.82 (#3806)
* v6.0, 2023-09-21, Merge [#3808](https://github.com/ossrs/srs/pull/3808): Upgrade libsrt to v1.5.3. v6.0.81 (#3808)
* v6.0, 2023-09-21, Merge [#3404](https://github.com/ossrs/srs/pull/3404): WebRTC: Support WHEP for play. v6.0.80 (#3404)

@ -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

@ -9,6 +9,6 @@
#define VERSION_MAJOR 6
#define VERSION_MINOR 0
#define VERSION_REVISION 82
#define VERSION_REVISION 83
#endif

Loading…
Cancel
Save