You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by am...@apache.org on 2016/12/04 19:21:16 UTC

[4/5] drill git commit: DRILL-5050: C++ client library has symbol resolution issues when loaded by a process that already uses boost::asio

DRILL-5050: C++ client library has symbol resolution issues when loaded by a process that already uses boost::asio

Build with Boost static libs and drill_boost namespace on mac. Added
readme with instructions

DRILL-5050: Addressed review comments

DRILL-5050: address more review comments

close apache/drill#659


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/42006ad3
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/42006ad3
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/42006ad3

Branch: refs/heads/master
Commit: 42006ad3324c778b3f3867079c9e75121c743c73
Parents: 9062901
Author: Parth Chandra <pa...@apache.org>
Authored: Mon Nov 14 14:01:29 2016 -0800
Committer: Aman Sinha <as...@maprtech.com>
Committed: Sun Dec 4 07:25:35 2016 -0800

----------------------------------------------------------------------
 contrib/native/client/CMakeLists.txt |  14 ++--
 contrib/native/client/readme.boost   |  56 ++++++++++++++++
 contrib/native/client/readme.macos   | 108 ++++++++++++++++++++++++++++++
 3 files changed, 173 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/42006ad3/contrib/native/client/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/contrib/native/client/CMakeLists.txt b/contrib/native/client/CMakeLists.txt
index 7e22ce8..65e3b85 100644
--- a/contrib/native/client/CMakeLists.txt
+++ b/contrib/native/client/CMakeLists.txt
@@ -84,23 +84,27 @@ add_definitions("-DGIT_COMMIT_PROP=${GIT_COMMIT_PROP}")
 
 
 # Find Boost
+set(Boost_USE_STATIC_LIBS ON)
+set(Boost_USE_MULTITHREADED ON)
 if(MSVC)
-    set(Boost_USE_STATIC_LIBS ON)
-    set(Boost_USE_MULTITHREADED ON)
     set(Boost_USE_STATIC_RUNTIME OFF)
 else()
-    set(Boost_USE_STATIC_LIBS OFF)
-    set(Boost_USE_MULTITHREADED ON)
-    set(Boost_USE_STATIC_RUNTIME OFF)
+    #    To build a production version, the linux/macos build must use a shaded version
+    #    of boost. Arbirtarily, we choose the new namspace to be drill_boost.
+    #    See the instructions in the readme for linux/macos and rebuild boost. Then
+    #    uncomment the line below to build
+    #    set(Boost_NAMESPACE drill_boost)
 endif()
 
 find_package(Boost 1.53.0 REQUIRED COMPONENTS regex system date_time chrono thread random)
 include_directories(${Boost_INCLUDE_DIRS})
 
+
 if(CMAKE_COMPILER_IS_GNUCXX)
     set(CMAKE_EXE_LINKER_FLAGS "-lrt -lpthread")
     set(CMAKE_CXX_FLAGS "-fPIC")
 endif()
+
 if(MSVC)
     set(CMAKE_CXX_FLAGS "/EHsc")
 endif()

http://git-wip-us.apache.org/repos/asf/drill/blob/42006ad3/contrib/native/client/readme.boost
----------------------------------------------------------------------
diff --git a/contrib/native/client/readme.boost b/contrib/native/client/readme.boost
new file mode 100644
index 0000000..a6035e4
--- /dev/null
+++ b/contrib/native/client/readme.boost
@@ -0,0 +1,56 @@
+/*
+ * 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
+ *
+ * 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.
+ */
+
+Building Boost for Drill on MacOs/Linux
+--------------------------------
+
+These instructions are using Boost version 1.60.0
+
+Assuming there is a BOOST_BUILD_DIR 
+
+$ cd $BOOST_BUILD_DIR
+$ tar zxf boost_1_60_0.tar.gz
+$ cd $BOOST_BUILD_DIR/boost_1_60_0
+$ ./bootstrap.sh --prefix=$BOOST_BUILD_DIR/boost_1_60_0/
+$ ./b2 tools/bcp
+$ cd $BOOST_BUILD_DIR/drill_boost_1_60_0
+
+# Use boost bcp to rename the boost namespace to drill_boost
+# the following builds a subset of boost without icu. You may need to add more modules to include icu. 
+# bcp documentation can be found here: http://www.boost.org/doc/libs/1_60_0/tools/bcp/doc/html/index.html
+
+$ $BOOST_BUILD_DIR/boost_1_60_0/dist/bin/bcp --namespace=drill_boost --namespace-alias --boost=$BOOST_BUILD_DIR/boost_1_60_0/ shared_ptr random context chrono date_time regex system timer thread asio smart_ptr bind config build regex config assign functional multiprecision $BOOST_BUILD_DIR/drill_boost_1_60_0 
+
+$ cd $BOOST_BUILD_DIR/drill_boost_1_60_0
+$ ./bootstrap.sh --prefix=$BOOST_BUILD_DIR/drill_boost_1_60_0/
+
+# change the variant to debug for a debug build
+  # For linux 
+  $ ./b2 --build-dir=$BOOST_BUILD_DIR/drill_boost_1_60_0/build variant=release link=static threading=multi cxxflags="-fPIC"
+  # For MacOS
+  $ ./b2 --build-dir=$BOOST_BUILD_DIR/drill_boost_1_60_0/build variant=release link=static threading=multi 
+
+
+# To build the Drill client library , export the following to make sure boost is picked up correctly
+$ export BOOST_INCLUDEDIR=$BOOST_BUILD_DIR/drill_boost_1_60_0
+$ export BOOST_LIBRARYDIR=$BOOST_BUILD_DIR/drill_boost_1_60_0/stage/lib
+$ export Boost_NO_SYSTEM_PATHS=ON
+
+# Then follow the usual CMake build steps.
+
+

http://git-wip-us.apache.org/repos/asf/drill/blob/42006ad3/contrib/native/client/readme.macos
----------------------------------------------------------------------
diff --git a/contrib/native/client/readme.macos b/contrib/native/client/readme.macos
new file mode 100644
index 0000000..4785e87
--- /dev/null
+++ b/contrib/native/client/readme.macos
@@ -0,0 +1,108 @@
+/*
+ * 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
+ *
+ * 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.
+ */
+
+
+MacOS build (tested on OS X El Capitan)
+
+Install Prerequisites
+---------------------
+
+0.1) Install XCode 
+  Download and install from here: https://developer.apple.com/xcode/downloads/
+  or from the App store https://itunes.apple.com/us/app/xcode/id497799835?mt=12
+  In Terminal, install the command line tools 
+    $> xcode-select --install
+
+0.2) Install brew following the instructions here: http://brew.sh/
+
+1) CMAKE 3.0 or above
+  Download and install Cmake : https://cmake.org/download/
+  or use brew to install 
+  $> brew install cmake
+
+
+2.1) Install protobuf 2.5.0 (or higher)
+  $> brew install protobuf
+
+2.2) Install zookeeper
+  $> brew install zookeeper
+
+2.3) Install boost
+  $> brew install boost
+
+2.3.1) For production builds, see the readme.boost file  
+  
+2.3.1.1 Build using XCODE
+=========================  
+(Optional) Refresh protobuf source files
+----------------------------------------
+When changes have been introduced to the protocol module, you might need to refresh the protobuf C++ source files too.
+  $> cd DRILL_DIR/contrib/native/client
+  $> mkdir build
+  $> cd build && cmake3 -G "XCode" -D CMAKE_BUILD_TYPE=Debug ..
+  $> xcodebuild -project drillclient.xcodeproj -configuration ${BUILDTYPE} -target fixProtobufs
+  $> xcodebuild -project drillclient.xcodeproj -configuration ${BUILDTYPE} -target cpProtobufs
+
+Open a pull request with the changes to DRILL_DIR/contrib/native/client/src/protobuf
+
+Build drill client
+-------------------
+  $> cd DRILL_DIR/contrib/native/client
+  $> mkdir build
+  $> cd build && cmake3 -G "XCode" -D CMAKE_BUILD_TYPE=Debug ..
+  $> xcodebuild -project drillclient.xcodeproj -configuration ${BUILDTYPE} -target ALL_BUILD
+
+
+XCode IDE
+---------
+  You can open the drillclient.xcodeproj file in the XCode ide and run/debug as with any other command line app
+
+2.3.1.2 Build using MAKE
+========================
+(Optional) Refresh protobuf source files
+----------------------------------------
+When changes have been introduced to the protocol module, you might need to refresh the protobuf C++ source files too.
+    $> cd DRILL_DIR/contrib/native/client
+    $> mkdir build
+    $> cd build && cmake3 -G "Unix Makefiles" ..
+    $> make cpProtobufs
+
+Open a pull request with the changes to DRILL_DIR/contrib/native/client/src/protobuf
+
+Build drill client
+-------------------
+    $> cd DRILL_DIR/contrib/native/client
+    $> mkdir build
+    $> cd build && cmake3 -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ..
+    $> make
+
+
+2.4 Test
+--------
+Run query submitter from the command line
+  $> querySubmitter query='select * from dfs.`/Users/pchandra/work/data/tpc-h/customer.parquet`' type=sql connectStr=local=10.250.0.146:31010 api=async logLevel=trace user=yourUserName password=yourPassWord
+
+2.5 Valgrind
+------------
+  Install valgrind using brew
+  $> brew install valgrind
+  $> valgrind --leak-check=yes querySubmitter query='select LINEITEM from dfs.`/Users/pchandra/work/data/tpc-h/customer.parquet`' type=sql connectStr=local=10.250.0.146:31010 api=async logLevel=trace
+
+
+
+