HADOOP-14670. Increase minimum cmake version for all platforms

Signed-off-by: Chris Douglas <cdouglas@apache.org>
This commit is contained in:
Allen Wittenauer 2017-07-19 17:51:14 -07:00
parent ce79f7be29
commit 71bbb86d69
No known key found for this signature in database
GPG Key ID: E01B34FBE846DF38
14 changed files with 49 additions and 41 deletions

View File

@ -7,7 +7,7 @@ Requirements:
* JDK 1.8+ * JDK 1.8+
* Maven 3.3 or later * Maven 3.3 or later
* ProtocolBuffer 2.5.0 * ProtocolBuffer 2.5.0
* CMake 2.6 or newer (if compiling native code), must be 3.0 or newer on Mac * CMake 3.1 or newer (if compiling native code)
* Zlib devel (if compiling native code) * Zlib devel (if compiling native code)
* openssl devel (if compiling native hadoop-pipes and to get the best HDFS encryption performance) * openssl devel (if compiling native hadoop-pipes and to get the best HDFS encryption performance)
* Linux FUSE (Filesystem in Userspace) version 2.6 or above (if compiling fuse_dfs) * Linux FUSE (Filesystem in Userspace) version 2.6 or above (if compiling fuse_dfs)
@ -345,7 +345,7 @@ Requirements:
* JDK 1.8+ * JDK 1.8+
* Maven 3.0 or later * Maven 3.0 or later
* ProtocolBuffer 2.5.0 * ProtocolBuffer 2.5.0
* CMake 2.6 or newer * CMake 3.1 or newer
* Windows SDK 7.1 or Visual Studio 2010 Professional * Windows SDK 7.1 or Visual Studio 2010 Professional
* Windows SDK 8.1 (if building CPU rate control for the container executor) * Windows SDK 8.1 (if building CPU rate control for the container executor)
* zlib headers (if building native code bindings for zlib) * zlib headers (if building native code bindings for zlib)

View File

@ -35,7 +35,6 @@ ENV DEBCONF_TERSE true
RUN apt-get -q update && apt-get -q install --no-install-recommends -y \ RUN apt-get -q update && apt-get -q install --no-install-recommends -y \
build-essential \ build-essential \
bzip2 \ bzip2 \
cmake \
curl \ curl \
doxygen \ doxygen \
fuse \ fuse \
@ -89,11 +88,22 @@ RUN apt-get -q update && apt-get -q install --no-install-recommends -y ant
###### ######
RUN mkdir -p /opt/maven && \ RUN mkdir -p /opt/maven && \
curl -L -s -S \ curl -L -s -S \
http://www-us.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz \ https://www-us.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz \
-o /opt/maven.tar.gz && \ -o /opt/maven.tar.gz && \
tar xzf /opt/maven.tar.gz --strip-components 1 -C /opt/maven tar xzf /opt/maven.tar.gz --strip-components 1 -C /opt/maven
ENV MAVEN_HOME /opt/maven ENV MAVEN_HOME /opt/maven
ENV PATH "$PATH:/opt/maven/bin" ENV PATH "${PATH}:/opt/maven/bin"
######
# Install cmake
######
RUN mkdir -p /opt/cmake && \
curl -L -s -S \
https://cmake.org/files/v3.1/cmake-3.1.0-Linux-x86_64.tar.gz \
-o /opt/cmake.tar.gz && \
tar xzf /opt/cmake.tar.gz --strip-components 1 -C /opt/cmake
ENV CMAKE_HOME /opt/cmake
ENV PATH "${PATH}:/opt/cmake/bin"
###### ######
# Install findbugs # Install findbugs
@ -104,6 +114,7 @@ RUN mkdir -p /opt/findbugs && \
-o /opt/findbugs.tar.gz && \ -o /opt/findbugs.tar.gz && \
tar xzf /opt/findbugs.tar.gz --strip-components 1 -C /opt/findbugs tar xzf /opt/findbugs.tar.gz --strip-components 1 -C /opt/findbugs
ENV FINDBUGS_HOME /opt/findbugs ENV FINDBUGS_HOME /opt/findbugs
ENV PATH "${PATH}:/opt/findbugs/bin"
#### ####
# Install shellcheck # Install shellcheck

View File

@ -117,19 +117,25 @@ macro(hadoop_set_find_shared_library_without_version)
endif() endif()
endmacro() endmacro()
#
# Configuration.
#
# Initialise the shared gcc/g++ flags if they aren't already defined. # set the shared compiler flags
if(NOT DEFINED GCC_SHARED_FLAGS) # support for GNU C/C++, add other compilers as necessary
set(GCC_SHARED_FLAGS "-g -O2 -Wall -pthread -D_FILE_OFFSET_BITS=64")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
if(NOT DEFINED GCC_SHARED_FLAGS)
find_package(Threads REQUIRED)
if(CMAKE_USE_PTHREADS_INIT)
set(GCC_SHARED_FLAGS "-g -O2 -Wall -pthread -D_FILE_OFFSET_BITS=64")
else()
set(GCC_SHARED_FLAGS "-g -O2 -Wall -D_FILE_OFFSET_BITS=64")
endif()
endif()
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
set(GCC_SHARED_FLAGS "-g -O2 -Wall -D_FILE_OFFSET_BITS=64")
endif() endif()
# Add in support other compilers here, if necessary, # Set the shared linker flags.
# the assumption is that GCC or a GCC-compatible compiler is being used.
# Set the shared GCC-compatible compiler and linker flags.
hadoop_add_compiler_flags("${GCC_SHARED_FLAGS}") hadoop_add_compiler_flags("${GCC_SHARED_FLAGS}")
hadoop_add_linker_flags("${LINKER_SHARED_FLAGS}") hadoop_add_linker_flags("${LINKER_SHARED_FLAGS}")

View File

@ -20,7 +20,7 @@
# CMake configuration. # CMake configuration.
# #
cmake_minimum_required(VERSION 2.6 FATAL_ERROR) cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/..) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/..)
include(HadoopCommon) include(HadoopCommon)

View File

@ -27,7 +27,9 @@
#include "org_apache_hadoop.h" #include "org_apache_hadoop.h"
#ifndef HADOOP_BZIP2_LIBRARY
#define HADOOP_BZIP2_LIBRARY "libbz2.so.1" #define HADOOP_BZIP2_LIBRARY "libbz2.so.1"
#endif
/* A helper macro to convert the java 'stream-handle' to a bz_stream pointer. */ /* A helper macro to convert the java 'stream-handle' to a bz_stream pointer. */

View File

@ -16,7 +16,7 @@
# limitations under the License. # limitations under the License.
# #
cmake_minimum_required(VERSION 2.6 FATAL_ERROR) cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
enable_testing() enable_testing()

View File

@ -16,6 +16,8 @@
# limitations under the License. # limitations under the License.
# #
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
set(CMAKE_SKIP_RPATH TRUE) set(CMAKE_SKIP_RPATH TRUE)
# Flatten a list into a string. # Flatten a list into a string.

View File

@ -16,6 +16,8 @@
# limitations under the License. # limitations under the License.
# #
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../libhdfs/include ${CMAKE_CURRENT_SOURCE_DIR}/../libhdfs/include
${GENERATED_JAVAH} ${GENERATED_JAVAH}

View File

@ -15,6 +15,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
add_definitions(-DLIBHDFS_DLL_EXPORT) add_definitions(-DLIBHDFS_DLL_EXPORT)
include_directories( include_directories(

View File

@ -16,7 +16,7 @@
# limitations under the License. # limitations under the License.
# #
cmake_minimum_required(VERSION 2.6 FATAL_ERROR) cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../../../../hadoop-common-project/hadoop-common/) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../../../../hadoop-common-project/hadoop-common/)
include(HadoopCommon) include(HadoopCommon)

View File

@ -96,8 +96,6 @@ public void execute() throws MojoExecutionException {
validatePlatform(); validatePlatform();
runCMake(); runCMake();
runMake(); runMake();
runMake(); // The second make is a workaround for HADOOP-9215. It can be
// removed when cmake 2.6 is no longer supported.
long end = System.nanoTime(); long end = System.nanoTime();
getLog().info("cmake compilation finished successfully in " + getLog().info("cmake compilation finished successfully in " +
TimeUnit.MILLISECONDS.convert(end - start, TimeUnit.NANOSECONDS) + TimeUnit.MILLISECONDS.convert(end - start, TimeUnit.NANOSECONDS) +

View File

@ -16,7 +16,7 @@
# limitations under the License. # limitations under the License.
# #
cmake_minimum_required(VERSION 2.6 FATAL_ERROR) cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../../../hadoop-common-project/hadoop-common) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../../../hadoop-common-project/hadoop-common)
include(HadoopCommon) include(HadoopCommon)

View File

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required(VERSION 2.6 FATAL_ERROR) cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../../../../../hadoop-common-project/hadoop-common) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../../../../../hadoop-common-project/hadoop-common)
include(HadoopCommon) include(HadoopCommon)
@ -29,25 +29,7 @@ set(GTEST_SRC_DIR ${CMAKE_SOURCE_DIR}/../../../../../hadoop-common-project/hadoo
string(REGEX MATCH . HCD_ONE "${HADOOP_CONF_DIR}") string(REGEX MATCH . HCD_ONE "${HADOOP_CONF_DIR}")
string(COMPARE EQUAL ${HCD_ONE} / HADOOP_CONF_DIR_IS_ABS) string(COMPARE EQUAL ${HCD_ONE} / HADOOP_CONF_DIR_IS_ABS)
if (CMAKE_VERSION VERSION_LESS "3.1") set (CMAKE_C_STANDARD 99)
# subset of CMAKE_<LANG>_COMPILER_ID
# https://cmake.org/cmake/help/v3.0/variable/CMAKE_LANG_COMPILER_ID.html
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
set (CMAKE_C_FLAGS "-std=c99 -Wall -pedantic-errors ${CMAKE_C_FLAGS}")
elseif (CMAKE_C_COMPILER_ID STREQUAL "Intel")
set (CMAKE_C_FLAGS "-std=c99 -Wall ${CMAKE_C_FLAGS}")
elseif (CMAKE_C_COMPILER_ID STREQUAL "SunPro")
set (CMAKE_C_FLAGS "-xc99 ${CMAKE_C_FLAGS}")
endif ()
else ()
set (CMAKE_C_STANDARD 99)
endif ()
# Note: can't use -D_FILE_OFFSET_BITS=64, see MAPREDUCE-4258
string(REPLACE "-D_FILE_OFFSET_BITS=64" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REPLACE "-D_FILE_OFFSET_BITS=64" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
include(CheckIncludeFiles) include(CheckIncludeFiles)
check_include_files("sys/types.h;sys/sysctl.h" HAVE_SYS_SYSCTL_H) check_include_files("sys/types.h;sys/sysctl.h" HAVE_SYS_SYSCTL_H)

View File

@ -35,7 +35,9 @@ docker build -t "hadoop-build-${USER_ID}" - <<UserSpecificDocker
FROM hadoop-build FROM hadoop-build
RUN groupadd --non-unique -g ${GROUP_ID} ${USER_NAME} RUN groupadd --non-unique -g ${GROUP_ID} ${USER_NAME}
RUN useradd -g ${GROUP_ID} -u ${USER_ID} -k /root -m ${USER_NAME} RUN useradd -g ${GROUP_ID} -u ${USER_ID} -k /root -m ${USER_NAME}
RUN echo "${USER_NAME}\tALL=NOPASSWD: ALL" > "/etc/sudoers.d/hadoop-build-${USER_ID}"
ENV HOME /home/${USER_NAME} ENV HOME /home/${USER_NAME}
UserSpecificDocker UserSpecificDocker
# By mapping the .m2 directory you can do an mvn install from # By mapping the .m2 directory you can do an mvn install from