Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
3feb6d0c
Commit
3feb6d0c
authored
Nov 30, 2020
by
Zhangyi Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bazel build in macos
testing on 11.0-bigsur
parent
ce7c45f1
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
86 additions
and
13 deletions
+86
-13
.bazelrc
.bazelrc
+3
-0
BUILD
BUILD
+9
-5
WORKSPACE
WORKSPACE
+22
-0
openssl.BUILD
openssl.BUILD
+41
-0
span.h
src/brpc/span.h
+1
-1
key.cpp
src/bthread/key.cpp
+1
-1
task_group.cpp
src/bthread/task_group.cpp
+1
-1
find_cstr.cpp
src/butil/find_cstr.cpp
+1
-1
find_cstr.h
src/butil/find_cstr.h
+1
-1
baidu_thread_local_unittest.cpp
test/baidu_thread_local_unittest.cpp
+3
-1
bthread_futex_unittest.cpp
test/bthread_futex_unittest.cpp
+1
-0
file_util_unittest.cc
test/file_util_unittest.cc
+2
-2
No files found.
.bazelrc
View file @
3feb6d0c
...
...
@@ -17,5 +17,8 @@ build --copt -DHAVE_ZLIB=1
# bazel build with glog
# build --define=with_glog=true
build -c opt
build --incompatible_disable_deprecated_attr_params=false
build --incompatible_new_actions_api=false
# unittest
test --define=unittest=true
test --copt=-g
BUILD
View file @
3feb6d0c
...
...
@@ -79,8 +79,8 @@ LINKOPTS = [
"-lpthread",
"-ldl",
"-lz",
"-lssl",
"-lcrypto",
#
"-lssl",
#
"-lcrypto",
] + select({
":darwin": [
"-framework CoreFoundation",
...
...
@@ -304,6 +304,7 @@ objc_library(
"src/butil/threading/thread_restrictions.h",
"src/butil/threading/thread_id_name_manager.h",
"src/butil/type_traits.h",
"src/butil/third_party/murmurhash3/murmurhash3.h",
],
non_arc_srcs = [
"src/butil/mac/bundle_locations.mm",
...
...
@@ -332,8 +333,7 @@ cc_library(
"src/butil/**/*.h",
"src/butil/**/*.hpp",
"src/butil/**/**/*.h",
"src/butil/**/**/*.hpp",
"src/butil/**/**/**/*.h",
"src/butil/**/**/*.hpp", "src/butil/**/**/**/*.h",
"src/butil/**/**/**/*.hpp",
"src/butil/third_party/dmg_fp/dtoa.cc",
]) + [":config_h"],
...
...
@@ -342,8 +342,13 @@ cc_library(
"@com_github_gflags_gflags//:gflags",
] + select({
":with_glog": ["@com_github_google_glog//:glog"],
"//conditions:default": [],
}) + select({
":darwin": [":macos_lib"],
"//conditions:default": [],
}) + select({
":darwin": ["//external:ssl_macos"],
"//conditions:default": ["//external:ssl"],
}),
includes = [
"src/",
...
...
@@ -532,4 +537,3 @@ cc_binary(
linkopts = LINKOPTS,
visibility = ["//visibility:public"],
)
WORKSPACE
View file @
3feb6d0c
...
...
@@ -65,3 +65,25 @@ http_archive(
strip_prefix = "googletest-0fe96607d85cf3a25ac40da369db62bbee2939a5",
url = "https://github.com/google/googletest/archive/0fe96607d85cf3a25ac40da369db62bbee2939a5.tar.gz",
)
new_local_repository(
name = "openssl",
path = "/usr",
build_file = "//:openssl.BUILD",
)
new_local_repository(
name = "openssl_macos",
build_file = "//:openssl.BUILD",
path = "/usr/local/opt/openssl",
)
bind(
name = "ssl",
actual = "@openssl//:ssl"
)
bind(
name = "ssl_macos",
actual = "@openssl_macos//:ssl"
)
openssl.BUILD
0 → 100644
View file @
3feb6d0c
package(
default_visibility=["//visibility:public"]
)
config_setting(
name = "macos",
values = {
"cpu": "darwin",
},
visibility = ["//visibility:private"],
)
cc_library(
name = "crypto",
srcs = select({
":macos": ["lib/libcrypto.dylib"],
"//conditions:default": []
}),
linkopts = select({
":macos" : [],
"//conditions:default": ["-lcrypto"],
}),
)
cc_library(
name = "ssl",
hdrs = select({
":macos": glob(["include/openssl/*.h"]),
"//conditions:default": ["lib/libssl.so"]
}),
srcs = select ({
":macos": ["lib/libssl.dylib"],
"//conditions:default": []
}),
includes = ["include"],
linkopts = select({
":macos" : [],
"//conditions:default": ["-lssl"],
}),
deps = [":crypto"]
)
src/brpc/span.h
View file @
3feb6d0c
...
...
@@ -34,7 +34,7 @@
#include "brpc/span.pb.h"
namespace
bthread
{
extern
__thread
bthread
::
LocalStorage
tls_bls
;
extern
thread_local
bthread
::
LocalStorage
tls_bls
;
}
...
...
src/bthread/key.cpp
View file @
3feb6d0c
...
...
@@ -34,7 +34,7 @@ class KeyTable;
// defined in task_group.cpp
extern
__thread
TaskGroup
*
tls_task_group
;
extern
__thread
LocalStorage
tls_bls
;
extern
thread_local
LocalStorage
tls_bls
;
static
__thread
bool
tls_ever_created_keytable
=
false
;
// We keep thread specific data in a two-level array. The top-level array
...
...
src/bthread/task_group.cpp
View file @
3feb6d0c
...
...
@@ -61,7 +61,7 @@ __thread TaskGroup* tls_task_group = NULL;
// Sync with TaskMeta::local_storage when a bthread is created or destroyed.
// During running, the two fields may be inconsistent, use tls_bls as the
// groundtruth.
__thread
LocalStorage
tls_bls
=
BTHREAD_LOCAL_STORAGE_INITIALIZER
;
thread_local
LocalStorage
tls_bls
=
BTHREAD_LOCAL_STORAGE_INITIALIZER
;
// defined in bthread/key.cpp
extern
void
return_keytable
(
bthread_keytable_pool_t
*
,
KeyTable
*
);
...
...
src/butil/find_cstr.cpp
View file @
3feb6d0c
...
...
@@ -21,6 +21,6 @@
namespace
butil
{
__thread
StringMapThreadLocalTemp
tls_stringmap_temp
=
{
false
,
{}
};
thread_local
StringMapThreadLocalTemp
tls_stringmap_temp
=
{
false
,
{}
};
}
// namespace butil
src/butil/find_cstr.h
View file @
3feb6d0c
...
...
@@ -95,7 +95,7 @@ struct StringMapThreadLocalTemp {
}
};
extern
__thread
StringMapThreadLocalTemp
tls_stringmap_temp
;
extern
thread_local
StringMapThreadLocalTemp
tls_stringmap_temp
;
template
<
typename
T
,
typename
C
,
typename
A
>
typename
std
::
map
<
std
::
string
,
T
,
C
,
A
>::
const_iterator
...
...
test/baidu_thread_local_unittest.cpp
View file @
3feb6d0c
...
...
@@ -174,7 +174,9 @@ void fun4(void* arg) {
}
static
void
check_result
()
{
ASSERT_EQ
(
"fun4(0)
\n
fun3(0x2)
\n
fun2
\n
"
,
get_oss
().
str
());
// Don't use gtest function since this function might be invoked when the main
// thread quits, instances required by gtest functions are likely destroyed.
assert
(
get_oss
().
str
()
==
"fun4(0)
\n
fun3(0x2)
\n
fun2
\n
"
);
}
TEST_F
(
BaiduThreadLocalTest
,
call_order_and_cancel
)
{
...
...
test/bthread_futex_unittest.cpp
View file @
3feb6d0c
...
...
@@ -135,6 +135,7 @@ TEST(FutexTest, futex_wake_many_waiters_perf) {
printf
(
"N=%lu, futex_wake a thread = %"
PRId64
"ns
\n
"
,
N
,
tm
.
n_elapsed
()
/
N
);
ASSERT_EQ
(
N
,
(
size_t
)
nwakeup
);
sleep
(
2
);
const
size_t
REP
=
10000
;
nwakeup
=
0
;
tm
.
start
();
...
...
test/file_util_unittest.cc
View file @
3feb6d0c
...
...
@@ -2131,12 +2131,12 @@ TEST_F(FileUtilTest, TouchFile) {
// 784915200000000 represents the timestamp of "Wed, 16 Nov 1994, 00:00:00".
// This timestamp is divisible by one day (in local timezone), to make it work
// on FAT too.
Time
access_time
(
784915200000000
);
auto
access_time
=
Time
::
FromUTCExploded
({
1994
,
11
,
4
,
16
,
0
,
0
,
0
,
0
}
);
// 784903526000000 represents the timestamp of "Tue, 15 Nov 1994, 12:45:26 GMT".
// Note that this timestamp is divisible by two (seconds) - FAT stores
// modification times with 2s resolution.
Time
modification_time
(
784903526000000
);
auto
modification_time
=
Time
::
FromUTCExploded
({
1994
,
11
,
3
,
15
,
12
,
45
,
26
,
0
}
);
ASSERT_TRUE
(
TouchFile
(
foobar
,
access_time
,
modification_time
));
File
::
Info
file_info
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment