You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by pr...@apache.org on 2021/02/19 05:50:54 UTC

[ozone] branch master updated: HDDS-4844. Fixing build issue for some platforms. (#1935)

This is an automated email from the ASF dual-hosted git repository.

prashantpogde pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new ac8aee7  HDDS-4844. Fixing build issue for some platforms. (#1935)
ac8aee7 is described below

commit ac8aee7f8521ff3b70c8cc293432cee5d774896d
Author: prashantpogde <pr...@gmail.com>
AuthorDate: Thu Feb 18 21:50:37 2021 -0800

    HDDS-4844. Fixing build issue for some platforms. (#1935)
---
 tools/fault-injection-service/CMakeLists.txt | 229 ++++++++++++++-------------
 tools/fault-injection-service/README.md      |  37 ++++-
 2 files changed, 151 insertions(+), 115 deletions(-)

diff --git a/tools/fault-injection-service/CMakeLists.txt b/tools/fault-injection-service/CMakeLists.txt
index ebb3cad..8639237 100644
--- a/tools/fault-injection-service/CMakeLists.txt
+++ b/tools/fault-injection-service/CMakeLists.txt
@@ -1,114 +1,115 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more           
-# contributor license agreements.  See the NOTICE file distributed with this   
-# work for additional information regarding copyright ownership.  The ASF      
-# licenses this file to you 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                                      
-# <p>                                                                          
-# http://www.apache.org/licenses/LICENSE-2.0                                   
-# <p>                                                                          
-# 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.                                                                 
-#
-# cmake build file for C++ failure_injection_service.
-# Assumes protobuf and gRPC have been installed using cmake.
-
-cmake_minimum_required(VERSION 2.8)
-
-project(FailureInjectionService C CXX)
-
-set(BASE_DIR ".")
-set(FS_DIR "${BASE_DIR}/FileSystem")
-set(SRV_DIR "${BASE_DIR}/Service/cpp")
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fpermissive -Wall")
-
-# This assumes that gRPC and all its dependencies are already installed
-# on this system, so they can be located by find_package().
-
-# Find Protobuf installation
-# Looks for protobuf-config.cmake file installed by Protobuf's cmake
-# installation.
-set(protobuf_MODULE_COMPATIBLE TRUE)
-find_package(Protobuf CONFIG REQUIRED)
-message(STATUS "Using protobuf ${protobuf_VERSION}")
-
-set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf)
-set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
-
-# Find gRPC installation
-# Looks for gRPCConfig.cmake file installed by gRPC's cmake installation.
-find_package(gRPC CONFIG REQUIRED)
-message(STATUS "Using gRPC ${gRPC_VERSION}")
-
-set(_GRPC_GRPCPP_UNSECURE gRPC::grpc++_unsecure)
-set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
-
-# Proto file
-get_filename_component(hw_proto
-    "${BASE_DIR}/Service/protos/failure_injection_service.proto"
-    ABSOLUTE)
-get_filename_component(hw_proto_path "${hw_proto}" PATH)
-
-# Generated sources
-set(hw_proto_srcs
-    "${CMAKE_CURRENT_BINARY_DIR}/failure_injection_service.pb.cc")
-set(hw_proto_hdrs
-    "${CMAKE_CURRENT_BINARY_DIR}/failure_injection_service.pb.h")
-set(hw_grpc_srcs
-    "${CMAKE_CURRENT_BINARY_DIR}/failure_injection_service.grpc.pb.cc")
-set(hw_grpc_hdrs
-    "${CMAKE_CURRENT_BINARY_DIR}/failure_injection_service.grpc.pb.h")
-add_custom_command(
-      OUTPUT "${hw_proto_srcs}" "${hw_proto_hdrs}"
-             "${hw_grpc_srcs}" "${hw_grpc_hdrs}"
-      COMMAND ${_PROTOBUF_PROTOC}
-      ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
-        --cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
-        -I "${hw_proto_path}"
-        --plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
-        "${hw_proto}"
-      DEPENDS "${hw_proto}")
-
-# Include generated *.pb.h files
-include_directories("${CMAKE_CURRENT_BINARY_DIR}"
-    "${FS_DIR}"
-    "${SRV_DIR}")
-
-#add_compile_options("-fpermissive")
-
-# Build server
-add_executable(failure_injector_svc_server 
-    ${FS_DIR}/failure_injector_fs.cc ${FS_DIR}/failure_injector.cc
-    ${SRV_DIR}/failure_injector_svc_server.cc ${SRV_DIR}/run_grpc_service.cc 
-    ${hw_proto_srcs}
-    ${hw_grpc_srcs})
-target_link_libraries(failure_injector_svc_server
-    ${_GRPC_GRPCPP_UNSECURE}
-    fuse3 
-    ${_PROTOBUF_LIBPROTOBUF})
-
-# Build client
-add_executable(failure_injector_svc_client 
-    "${SRV_DIR}/failure_injector_svc_client.cc" 
-    ${hw_proto_srcs} 
-    ${hw_grpc_srcs})
-target_link_libraries(failure_injector_svc_client 
-    ${_GRPC_GRPCPP_UNSECURE}
-    ${_PROTOBUF_LIBPROTOBUF})
-
-# Build unit tests
-set(CPP_UNIT_FUSE cpp_unit)
-foreach(_target
-  TestFilePathFailures
-  TestFailureInjector)
-    add_executable(${_target}
-                   "${FS_DIR}/${CPP_UNIT_FUSE}/${_target}.cc"
-                   ${FS_DIR}/failure_injector.cc)
-    target_link_libraries(${_target} 
-            cppunit)
-endforeach()
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more           
+# contributor license agreements.  See the NOTICE file distributed with this   
+# work for additional information regarding copyright ownership.  The ASF      
+# licenses this file to you 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                                      
+# <p>                                                                          
+# http://www.apache.org/licenses/LICENSE-2.0                                   
+# <p>                                                                          
+# 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.                                                                 
+#
+# cmake build file for C++ failure_injection_service.
+# Assumes protobuf and gRPC have been installed using cmake.
+
+cmake_minimum_required(VERSION 2.8)
+
+project(FailureInjectionService C CXX)
+
+set(BASE_DIR ".")
+set(FS_DIR "${BASE_DIR}/FileSystem")
+set(SRV_DIR "${BASE_DIR}/Service/cpp")
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fpermissive -Wall")
+
+# This assumes that gRPC and all its dependencies are already installed
+# on this system, so they can be located by find_package().
+
+# Find Protobuf installation
+# Looks for protobuf-config.cmake file installed by Protobuf's cmake
+# installation.
+set(protobuf_MODULE_COMPATIBLE TRUE)
+find_package(Protobuf CONFIG REQUIRED)
+message(STATUS "Using protobuf ${protobuf_VERSION}")
+
+set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf)
+set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
+
+# Find gRPC installation
+# Looks for gRPCConfig.cmake file installed by gRPC's cmake installation.
+find_package(gRPC CONFIG REQUIRED)
+message(STATUS "Using gRPC ${gRPC_VERSION}")
+
+set(_GRPC_GRPCPP_UNSECURE gRPC::grpc++_unsecure)
+set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
+
+# Proto file
+get_filename_component(hw_proto
+    "${BASE_DIR}/Service/protos/failure_injection_service.proto"
+    ABSOLUTE)
+get_filename_component(hw_proto_path "${hw_proto}" PATH)
+
+# Generated sources
+set(hw_proto_srcs
+    "${CMAKE_CURRENT_BINARY_DIR}/failure_injection_service.pb.cc")
+set(hw_proto_hdrs
+    "${CMAKE_CURRENT_BINARY_DIR}/failure_injection_service.pb.h")
+set(hw_grpc_srcs
+    "${CMAKE_CURRENT_BINARY_DIR}/failure_injection_service.grpc.pb.cc")
+set(hw_grpc_hdrs
+    "${CMAKE_CURRENT_BINARY_DIR}/failure_injection_service.grpc.pb.h")
+add_custom_command(
+      OUTPUT "${hw_proto_srcs}" "${hw_proto_hdrs}"
+             "${hw_grpc_srcs}" "${hw_grpc_hdrs}"
+      COMMAND ${_PROTOBUF_PROTOC}
+      ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
+        --cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
+        -I "${hw_proto_path}"
+        --plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
+        "${hw_proto}"
+      DEPENDS "${hw_proto}")
+
+# Include generated *.pb.h files
+include_directories("${CMAKE_CURRENT_BINARY_DIR}"
+    "${FS_DIR}"
+    "${SRV_DIR}")
+
+#add_compile_options("-fpermissive")
+
+# Build server
+find_package(Threads)
+add_executable(failure_injector_svc_server 
+    ${FS_DIR}/failure_injector_fs.cc ${FS_DIR}/failure_injector.cc
+    ${SRV_DIR}/failure_injector_svc_server.cc ${SRV_DIR}/run_grpc_service.cc 
+    ${hw_proto_srcs}
+    ${hw_grpc_srcs})
+target_link_libraries(failure_injector_svc_server
+    ${_GRPC_GRPCPP_UNSECURE}
+    fuse3 
+    ${_PROTOBUF_LIBPROTOBUF})
+
+# Build client
+add_executable(failure_injector_svc_client 
+    "${SRV_DIR}/failure_injector_svc_client.cc" 
+    ${hw_proto_srcs} 
+    ${hw_grpc_srcs})
+target_link_libraries(failure_injector_svc_client 
+    ${_GRPC_GRPCPP_UNSECURE}
+    ${_PROTOBUF_LIBPROTOBUF})
+
+# Build unit tests
+set(CPP_UNIT_FUSE cpp_unit)
+foreach(_target
+  TestFilePathFailures
+  TestFailureInjector)
+    add_executable(${_target}
+                   "${FS_DIR}/${CPP_UNIT_FUSE}/${_target}.cc"
+                   ${FS_DIR}/failure_injector.cc)
+    target_link_libraries(${_target} 
+            cppunit)
+endforeach()
diff --git a/tools/fault-injection-service/README.md b/tools/fault-injection-service/README.md
index 7fffd23..86952b6 100644
--- a/tools/fault-injection-service/README.md
+++ b/tools/fault-injection-service/README.md
@@ -27,8 +27,43 @@ Dependencies
 	built/installed from sources
 - cppunit & cppunit-devel
 
+Building Dependencies
+======================
+
+Building libfuse3 from the sources
+------------------------------------
+    - You can get it from https://github.com/libfuse/libfuse/releases/
+        * https://github.com/libfuse/libfuse/releases/tag/fuse-3.10.2
+    - follow the README.md for building libfuse
+    - you may need to get "meson-0.42.0" or above to build this.
+
+CMAKE
+======
+    - this will need cmake-3.14.0 or higher
+    - if required build from the sources. (tested with cmake-3.14.0 and
+       cmake-3.6.2)
+    
+Building grpc from the sources
+------------------------------------
+    - https://grpc.io/docs/languages/cpp/quickstart/
+    - sudo apt install -y build-essential autoconf libtool pkg-config
+    - git clone --recurse-submodules -b v1.35.0 https://github.com/grpc/grpc
+    - Follow build instructions
+        - mkdir -p cmake/build
+        - pushd cmake/build
+        - cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF\
+                 -DCMAKE_INSTALL_PREFIX=$MY_INSTALL_DIR  ../..
+        - make -j
+        - make install 
+
+Finally
+-------
+    - Make sure all the dependencies are in $PATH.
+    - This build was last tested on (debian 4.18.5-1.el7.elrepo.x86_64
+       GNU/Linux) and Ubuntu 18:0.1.0.0-4.
+
 Installation                                                                    
------------- 
+=============
 mkdir Build 
 cd Build
 do 'cmake ..'


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org