From 5b31225d7c611adb804886d35ce4f453bcc7617c Mon Sep 17 00:00:00 2001 From: terrencetang2023 Date: Fri, 22 Sep 2023 09:44:29 +0800 Subject: [PATCH] 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. --- trunk/doc/CHANGELOG.md | 1 + trunk/src/app/srs_app_threads.cpp | 2 +- trunk/src/core/srs_core_version6.hpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index a0e31d412..e01c07f86 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -7,6 +7,7 @@ The changelog for SRS. ## 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) diff --git a/trunk/src/app/srs_app_threads.cpp b/trunk/src/app/srs_app_threads.cpp index e8e2399c7..0eb0bb0fe 100644 --- a/trunk/src/app/srs_app_threads.cpp +++ b/trunk/src/app/srs_app_threads.cpp @@ -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 diff --git a/trunk/src/core/srs_core_version6.hpp b/trunk/src/core/srs_core_version6.hpp index f4132d6da..57aca38b5 100644 --- a/trunk/src/core/srs_core_version6.hpp +++ b/trunk/src/core/srs_core_version6.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 6 #define VERSION_MINOR 0 -#define VERSION_REVISION 82 +#define VERSION_REVISION 83 #endif