在MacOSCatalina中编译hadoop本机库错误:未知类型名“constexpr”别名声明是一个c++11扩展

eivgtgni  于 2021-05-31  发布在  Hadoop
关注(0)|答案(1)|浏览(657)

我正在尝试在unix中编译hadoop本机库,我使用的是:
hadoop:branch-3.2(这里是hadoop存储库)
macos:catalina版本10.15.5
协议:libprotoc 2.5.0
openssl 1.0.2t 2019年9月10日
gcc:apple-clangversion 11.0.3(clang-1103.0.32.62)目标:x86\u 64-apple-darwin19.5.0线程模型:posix installeddir:/library/developer/commandlinetools/usr/bin
java版本“1.8.0\u 251”(内部版本1.8.0\u 251-b08)
我遵循了这里的所有步骤:在修复了openssl和protobuf的几个问题之后,在mac上编译hadoop现在看来,apache hadoop mapreduce nativetask的编译由于与c11的依赖性而失败。
我是否需要以某种方式指定将cxxflags参数设置为-std=c
11?我该怎么做?或者我的gcc中缺少了一些配置?
我试着将一个别名设置为gcc,然后立即用下面解释的标志调用它:如何在默认情况下使clang支持c++11,但仍然不起作用。
到目前为止,这些是我遇到的许多类似错误之一:

[WARNING] /usr/local/include/snappy-stubs-public.h:61:16: warning: alias declarations are a C++11 extension [-Wc++11-extensions]

[WARNING] using uint64 = std::uint64_t;

[WARNING] In file included from /Users/josh/Dev/hadoop/repo/hadoop/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/test/TestCompressions.cc:29:

[WARNING] /usr/local/include/snappy.h:197:10: error: unknown type name 'constexpr'

[WARNING]   static constexpr int kBlockLog = 16;

[INFO] Apache Hadoop MapReduce NativeTask ................. FAILURE [  1.995 s]

在更仔细地阅读了输出之后,我认为这是最终抛出错误的命令:

[WARNING] /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/nttest.dir/build.make CMakeFiles/nttest.dir/build
[WARNING] [ 75%] Building CXX object CMakeFiles/nttest.dir/main/native/test/TestCompressions.cc.o
[WARNING] /Library/Developer/CommandLineTools/usr/bin/c++   -I/Users/josh/Dev/hadoop/repo/hadoop/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/target/native/javah -I/Users/josh/Dev/hadoop/repo/hadoop/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src -I/Users/josh/Dev/hadoop/repo/hadoop/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/util -I/Users/josh/Dev/hadoop/repo/hadoop/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib -I/Users/josh/Dev/hadoop/repo/hadoop/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/test -I/Users/josh/Dev/hadoop/repo/hadoop/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src -I/Users/josh/Dev/hadoop/repo/hadoop/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/target/native -I/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home/include/darwin -I/usr/local/include -isystem /Users/josh/Dev/hadoop/repo/hadoop/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/../../../../hadoop-common-project/hadoop-common/src/main/native/gtest/include  -g -O2 -Wall -pthread -D_FILE_OFFSET_BITS=64 -DNDEBUG -DSIMPLE_MEMCPY -fno-strict-aliasing -fsigned-char -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -o CMakeFiles/nttest.dir/main/native/test/TestCompressions.cc.o -c /Users/josh/Dev/hadoop/repo/hadoop/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/test/TestCompressions.cc
[WARNING] In file included from /Users/josh/Dev/hadoop/repo/hadoop/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/test/TestCompressions.cc:29:
[WARNING] In file included from /usr/local/include/snappy.h:45:
[WARNING] /usr/local/include/snappy-stubs-public.h:54:14: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
[WARNING] using int8 = std::int8_t;

谢谢您!

wxclj1h5

wxclj1h51#

我在osx上构建hadoop本机libs时也遇到了困难 clang . 我更成功地改用 gcc 10
首次使用自制软件安装:

brew install gcc

这应该把 gcc 路径中的二进制文件,但它们将 gcc-10 , g++-10 因此,设置一些环境魔法应该促使cmake使用这些而不是内置的二进制文件:

export CC=$(which gcc-10)
export CXX=$(which g++-10)
export CPP=$(which cpp-10)
export LD=$(which gcc-10)

相关问题