Skip to content

Commit

Permalink
[fix] Make libfiu as a local dependency.
Browse files Browse the repository at this point in the history
Signed-off-by: Ketor <[email protected]>
  • Loading branch information
ketor committed Jul 15, 2024
1 parent 8ae601b commit d6643d7
Show file tree
Hide file tree
Showing 17 changed files with 184 additions and 24 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "thirdparties/memcache/libmemcached-1.1.2"]
path = thirdparties/memcache/libmemcached-1.1.2
url = https://github.com/awesomized/libmemcached
[submodule "thirdparties/libfiu/libfiu"]
path = thirdparties/libfiu/libfiu
url = https://github.com/albertito/libfiu
6 changes: 6 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ new_local_repository(
path = "thirdparties/memcache/libmemcached-1.1.2",
)

new_local_repository(
name = "libfiu",
build_file = "//:thirdparties/libfiu/libfiu.BUILD",
path = "thirdparties/libfiu/libfiu",
)

http_archive(
name = "aws",
urls = ["https://github.com/aws/aws-sdk-cpp/archive/1.7.340.tar.gz"],
Expand Down
11 changes: 10 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@
# # for rocksdb
# sudo apt install libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev libgflags-dev
# # for curve
# sudo apt install libfuse3-dev uuid-dev libfiu-dev liblz4-dev libbz2-dev libnl-genl-3-dev
# sudo apt install libfuse3-dev uuid-dev libfiu-dev liblz4-dev libbz2-dev libnl-genl-3-dev libunwind-dev
#
# for rocky8:
# # for cpp compile
# sudo dnf install -y vim unzip nmap-ncat net-tools tzdata wget git gcc gcc-c++ make automake maven openssl openssl-devel cmake libtool gnupg2
# # for rocksdb
# sudo dnf install -y snappy-devel zlib-devel bzip2-devel lz4-devel libzstd-devel gflags-devel
# # for curve
# sudo dnf install -y fuse3-devel libuuid-devel lz4-devel bzip2-devel libnl3-devel libunwind-devel
#
# 3. Setup compile currency, for example:
# export BAZEL_JOBS=16
# 4. Execute build_thirdparties.sh to build thirdparties.
Expand Down
13 changes: 12 additions & 1 deletion build_thirdparties.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ then
fi
cd ${dir}

# # compile libmemcached manual
# compile libmemcached manual
cd ${dir}/thirdparties/memcache
make clean
make all
Expand All @@ -40,6 +40,17 @@ then
fi
cd ${dir}

# compile libfiu manual
cd ${dir}/thirdparties/libfiu
make clean
make all
if [ $? -ne 0 ]
then
echo "make libfiu failed"
exit
fi
cd ${dir}

# compile rocksdb manual
cd ${dir}/thirdparties/rocksdb
make clean
Expand Down
99 changes: 99 additions & 0 deletions curvefs_python/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#
# Copyright (c) 2020 NetEase Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library

COPTS = [
"-DGFLAGS=gflags",
"-DOS_LINUX",
"-DSNAPPY",
"-DHAVE_SSE42",
"-DNDEBUG",
"-fno-omit-frame-pointer",
"-momit-leaf-frame-pointer",
"-msse4.2",
"-pthread",
"-Wsign-compare",
"-Wno-unused-parameter",
"-Wno-unused-variable",
"-Woverloaded-virtual",
"-Wnon-virtual-dtor",
"-Wno-missing-field-initializers",
"-std=c++11",
"-I /usr/include/python2.7",
]

cc_library(
name = "curvefs",
srcs = glob(["*.cxx", "*.cpp"]),
hdrs = glob(["*h"]),
deps = [
"//external:gflags",
"//external:glog",
"//external:leveldb",
"//external:brpc",
"//external:braft",
"//external:protobuf",
"//src/common:curve_common",
"//src/common:curve_auth",
"//include/client:include_client",
"//include:include-common",
"//proto:nameserver2_cc_proto",
"//proto:common_cc_proto",
"//proto:topology_cc_proto",
"//proto:scan_cc_proto",
"//proto:chunkserver-cc-protos",
"//src/client:curve_client"
],
copts = COPTS,
linkopts = [
"-lcbd",
"-lcurve_client",
"-lbrpc",
"-lbthread",
"-lbvar",
"-ljson2pb",
"-lmcpack2pb",
"-lbutil",
"-lprotoc_lib",
"-lcc_brpc_internal_proto",
"-lcc_brpc_idl_options_proto",
"-lleveldb",
"-lcurve_common",
"-lcurve_auth",
"-lcurve_concurrent",
"-lglog",
"-lgflags",
"-lnameserver2_proto",
"-ltopology_proto",
"-lcommon_proto",
"-lscan_proto",
"-lchunkserver-protos",
"-lprotobuf",
"-lprotobuf_lite",
"-lssl",
"-lrt",
"-lcrypto",
"-ldl",
"-lz",
"-lpthread",
"-lunwind",
"-lstdc++",
"-lm",
"-Wl,-rpath=$$ORIGIN",
],
visibility = ["//visibility:public"],
)
3 changes: 2 additions & 1 deletion src/leader_election/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ cc_library(
"//external:glog",
"//src/kvstorageclient:kvstorage_client",
"//src/mds/nameserver2/helper",
"@libfiu",
],
)

Expand All @@ -36,12 +37,12 @@ cc_library(
hdrs = ["leader_election.h"],
copts = CURVE_TEST_COPTS,
defines = ["FIU_ENABLE"],
linkopts = ["-lfiu"],
visibility = ["//visibility:public"],
deps = [
"//external:gflags",
"//external:glog",
"//src/common:curve_common",
"//src/kvstorageclient:kvstorage_client",
"@libfiu",
],
)
14 changes: 7 additions & 7 deletions test/client/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ cc_test(
),
copts = CURVE_TEST_COPTS,
defines = ["UNIT_TEST", "FIU_ENABLE"],
linkopts = ["-lfiu"],
visibility = ["//visibility:public"],
deps = [
"//external:braft",
Expand All @@ -60,6 +59,7 @@ cc_test(
"@com_google_googletest//:gtest_main",
"//test/integration/cluster_common:integration_cluster_common",
"//test/client/mock:client_mock_lib",
"@libfiu",
],
)

Expand All @@ -69,7 +69,6 @@ cc_test(
"mds_failover_test.cpp"],
copts = CURVE_TEST_COPTS,
defines = ["UNIT_TEST", "FIU_ENABLE"],
linkopts = ["-lfiu"],
visibility = ["//visibility:public"],
deps = [
"//external:braft",
Expand All @@ -89,6 +88,7 @@ cc_test(
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"//test/integration/cluster_common:integration_cluster_common",
"@libfiu",
],
)

Expand All @@ -100,7 +100,6 @@ cc_test(
),
copts = CURVE_TEST_COPTS,
defines = ["UNIT_TEST", "FIU_ENABLE"],
linkopts = ["-lfiu"],
visibility = ["//visibility:public"],
deps = [
"//external:braft",
Expand All @@ -118,6 +117,7 @@ cc_test(
"//src/common/concurrent:curve_concurrent",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"@libfiu",
],
)

Expand Down Expand Up @@ -145,7 +145,6 @@ cc_test(
]),
copts = CURVE_TEST_COPTS,
defines = ["UNIT_TEST"],
linkopts = ["-lfiu"],
visibility = ["//visibility:public"],
deps = [
"//external:braft",
Expand All @@ -166,6 +165,7 @@ cc_test(
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"//test/integration/cluster_common:integration_cluster_common",
"@libfiu",
],
)

Expand Down Expand Up @@ -206,7 +206,6 @@ cc_test(
),
copts = CURVE_TEST_COPTS,
defines = ["UNIT_TEST"],
linkopts = ["-lfiu"],
visibility = ["//visibility:public"],
deps = [
"//external:braft",
Expand All @@ -226,6 +225,7 @@ cc_test(
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"//test/integration/cluster_common:integration_cluster_common",
"@libfiu",
],
)

Expand Down Expand Up @@ -279,7 +279,6 @@ cc_test(
),
copts = CURVE_TEST_COPTS,
defines = ["UNIT_TEST"],
linkopts = ["-lfiu"],
visibility = ["//visibility:public"],
deps = [
"//external:braft",
Expand All @@ -299,6 +298,7 @@ cc_test(
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"//test/integration/cluster_common:integration_cluster_common",
"@libfiu",
],
)

Expand Down Expand Up @@ -335,7 +335,6 @@ cc_test(
],
copts = CURVE_TEST_COPTS,
defines = ["UNIT_TEST", "FIU_ENABLE"],
linkopts = ["-lfiu"],
deps = [
"//include/client:include_client",
"//src/client:curve_client",
Expand All @@ -344,5 +343,6 @@ cc_test(
"//test/integration/cluster_common:integration_cluster_common",
"//test/client/mock:client_mock_lib",
"@com_google_absl//absl/memory",
"@libfiu",
]
)
4 changes: 2 additions & 2 deletions test/client/fake/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ cc_library(
],
),
hdrs = glob(["*.h"]),
linkopts = ["-lfiu"],
deps = [
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
Expand All @@ -42,7 +41,8 @@ cc_library(
"//proto:nameserver2_cc_proto",
"//proto:chunkserver-cc-protos",
"//proto:schedule_cc_proto",
"//src/client:curve_client"
"//src/client:curve_client",
"@libfiu",
],
visibility = ["//visibility:public"],
copts = CURVE_TEST_COPTS,
Expand Down
2 changes: 1 addition & 1 deletion test/failpoint/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ cc_test(
deps = [
"@com_google_googletest//:gtest_main",
"@com_google_googletest//:gtest",
"@libfiu",
],
linkopts = ["-lfiu"],
)

# https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library
Expand Down
9 changes: 3 additions & 6 deletions test/integration/client/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ cc_test(
),
copts = CURVE_TEST_COPTS,
defines = ["FIU_ENABLE"],
linkopts = ["-lfiu",
],
visibility = ["//visibility:public"],
deps = [
"//external:braft",
Expand All @@ -42,6 +40,7 @@ cc_test(
"//test/integration/cluster_common:integration_cluster_common",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"@libfiu",
],
)

Expand All @@ -55,8 +54,6 @@ cc_test(
),
copts = CURVE_TEST_COPTS,
defines = ["FIU_ENABLE"],
linkopts = ["-lfiu",
],
visibility = ["//visibility:public"],
deps = [
"//external:braft",
Expand All @@ -73,6 +70,7 @@ cc_test(
"//test/integration/cluster_common:integration_cluster_common",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"@libfiu",
],
)

Expand All @@ -85,8 +83,6 @@ cc_test(
),
copts = CURVE_TEST_COPTS,
defines = ["FIU_ENABLE"],
linkopts = ["-lfiu",
],
visibility = ["//visibility:public"],
deps = [
"//external:braft",
Expand All @@ -103,5 +99,6 @@ cc_test(
"//test/integration/cluster_common:integration_cluster_common",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"@libfiu",
],
)
2 changes: 1 addition & 1 deletion test/integration/client/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ cc_library(
),
copts = CURVE_TEST_COPTS,
defines = ["FIU_ENABLE"],
linkopts = ["-lfiu"],
visibility = ["//visibility:public"],
deps = [
"//external:braft",
Expand All @@ -39,5 +38,6 @@ cc_library(
"//src/common/concurrent:curve_concurrent",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"@libfiu",
],
)
Loading

0 comments on commit d6643d7

Please sign in to comment.