This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new c6f520fab4 [thirdparty](brpc) fix _dl_sym undefined reference on
Ubuntu22.04 (#11643)
c6f520fab4 is described below
commit c6f520fab44c1a8f4f586deca26e7d88bf288f3d
Author: Dongyang Li <[email protected]>
AuthorDate: Wed Aug 10 19:23:10 2022 +0800
[thirdparty](brpc) fix _dl_sym undefined reference on Ubuntu22.04 (#11643)
Co-authored-by: qcloud <[email protected]>
---
thirdparty/download-thirdparty.sh | 3 +++
thirdparty/patches/brpc-1.1.0-_dl_sym.patch | 28 ++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/thirdparty/download-thirdparty.sh
b/thirdparty/download-thirdparty.sh
index a621ae68c6..251124810e 100755
--- a/thirdparty/download-thirdparty.sh
+++ b/thirdparty/download-thirdparty.sh
@@ -372,6 +372,9 @@ if [[ ! -f $PATCHED_MARK ]]; then
if [[ "$(uname -s)" == 'Darwin' ]]; then
patch -p1 <"${TP_PATCH_DIR}/brpc-1.1.0.patch"
touch ${PATCHED_MARK}
+ else
+ patch -p0 <"$TP_PATCH_DIR/brpc-1.1.0-_dl_sym.patch"
+ touch ${PATCHED_MARK}
fi
fi
cd -
diff --git a/thirdparty/patches/brpc-1.1.0-_dl_sym.patch
b/thirdparty/patches/brpc-1.1.0-_dl_sym.patch
new file mode 100644
index 0000000000..35d06b7708
--- /dev/null
+++ b/thirdparty/patches/brpc-1.1.0-_dl_sym.patch
@@ -0,0 +1,28 @@
+--- src/bthread/mutex.cpp 2022-08-10 13:14:11.792739916 +0800
++++ src/bthread/mutex.cpp 2022-08-10 13:04:54.644764937 +0800
+@@ -44,7 +44,7 @@
+ #include "bthread/log.h"
+
+ extern "C" {
+-extern void* _dl_sym(void* handle, const char* symbol, void* caller);
++extern void* __attribute__((weak)) _dl_sym(void* handle, const char* symbol,
void* caller);
+ }
+
+ namespace bthread {
+@@ -408,8 +408,14 @@ static void init_sys_mutex_lock() {
+ #if defined(OS_LINUX)
+ // TODO: may need dlvsym when GLIBC has multiple versions of a same
symbol.
+ //
http://blog.fesnel.com/blog/2009/08/25/preloading-with-multiple-symbol-versions
+- sys_pthread_mutex_lock = (MutexOp)_dl_sym(RTLD_NEXT,
"pthread_mutex_lock", (void*)init_sys_mutex_lock);
+- sys_pthread_mutex_unlock = (MutexOp)_dl_sym(RTLD_NEXT,
"pthread_mutex_unlock", (void*)init_sys_mutex_lock);
++ if (_dl_sym) {
++ sys_pthread_mutex_lock = (MutexOp)_dl_sym(RTLD_NEXT,
"pthread_mutex_lock", (void*)init_sys_mutex_lock);
++ sys_pthread_mutex_unlock = (MutexOp)_dl_sym(RTLD_NEXT,
"pthread_mutex_unlock", (void*)init_sys_mutex_lock);
++ } else {
++ // _dl_sym may be undefined reference in some system, fallback to
dlsym
++ sys_pthread_mutex_lock = (MutexOp)dlsym(RTLD_NEXT,
"pthread_mutex_lock");
++ sys_pthread_mutex_unlock = (MutexOp)dlsym(RTLD_NEXT,
"pthread_mutex_unlock");
++ }
+ #elif defined(OS_MACOSX)
+ // TODO: look workaround for dlsym on mac
+ sys_pthread_mutex_lock = (MutexOp)dlsym(RTLD_NEXT, "pthread_mutex_lock");
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]