Error: unrecognized command line option ‘-Wno-invalid-source-encoding’ [-Werror] within building Mesos

Error: unrecognized command line option ‘-Wno-invalid-source-encoding’ [-Werror] within building Mesos

我的操作系统是 Ubuntu 18.10。我在三个节点上执行以下步骤: 为了安装 Mesos 我一步一步地做了这些步骤,没有任何错误,除了每个节点已经有 Open JDK 8,所以我没有再次安装 Open JDK 8。

   sudo apt-get update
   sudo apt-get install -y tar wget git
   sudo apt-get install -y openjdk8-jdk (I did not do that)
   sudo apt-get install -y autoconf libtool
   sudo apt-get -y install build-essential python-dev python-six python- 
   virtualenv libcurl4-nss-dev libsasl2-dev libsasl2-modules maven 
   libapr1-dev libsvn-dev zlib1g-dev iputils-ping
   

当我要构建 Mesos 时,问题就开始了。我为此做了这些步骤:

cd mesos-1.7.0
./bootstrap
mkdir build
cd build
../configure
make

我的IP地址是150.20.11.137,150.20.11.134,150.20.11.157。我在所有这些上下载了 Mesos 包,并在相同的路径中解压。 我在每个节点上都做了 <../configure> 没有任何问题,但是当我 运行 “make” 我在每个节点上都遇到了这个错误:

third_party/cares/cares/ares_init.c: In function ‘ares_dup’: third_party/cares/cares/ares_init.c:301:17: error: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer- memaccess]

       sizeof(src->local_dev_name));
             ^

third_party/cares/cares/ares_init.c: At top level:

cc1: error: unrecognized command line option ‘-Wno-invalid-source- encoding’ [-Werror] cc1: all warnings being treated as errors

make[4]: *** [Makefile:2635: /home/spark/mesos- 1.7.0/build/3rdparty/grpc- 1.10.0/objs/opt/third_party/cares/cares/ares_init.o] Error 1

make[4]: Leaving directory '/home/spark/mesos- 1.7.0/build/3rdparty/grpc-1.10.0'

make[3]: *** [Makefile:1446: grpc-1.10.0-build-stamp] Error 2

make[3]: Leaving directory '/home/spark/mesos-1.7.0/build/3rdparty'

make 2]: *** [Makefile:1035: all-recursive] Error 1

make[2]: Leaving directory '/home/spark/mesos-1.7.0/build/3rdparty'

make[1]: *** [Makefile:765: all] Error 2

make[1]: Leaving directory '/home/spark/mesos-1.7.0/build/3rdparty'

make: *** [Makefile:768: all-recursive] Error 1

问题已解决。问题是因为 GCC 版本。 Ubuntu 18.10 中的 GCC 版本是 8.2.0。我用这条指令安装了 gcc-5 和 g++-5:

 sudo add-apt-repository ppa:ubuntu-toolchain-r/test
 sudo apt-get update
 sudo apt-get install gcc-5 g++-5

然后要选择我想要的 GCC 版本,我必须为 gcc 安装 "update-alternatives"。因此,我 运行 这些命令:

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 500 --slave 
/usr/bin/g++ g++ /usr/bin/g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave 
/usr/bin/g++ g++ /usr/bin/g++-8

之后我用这个命令选择了 gcc-5 :

sudo update-alternatives --config gcc

此外,我有一个与OpenSSL相关的错误;然后我通过这个命令安装它:

sudo apt-get install libssl-dev

在这些修改之后,我开始安装 Mesos 并且安装没有任何错误。我希望这个插图对其他人有帮助。