文章目录
环境说明
Linux local-wwj-icu 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
g++ (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
error: unnecessary parentheses in declaration of ‘assert_arg’ [-Werror=parentheses]
日志片段
make all-am
make[2]: Entering directory '/home/wuweijie/mesos/mesos-1.9.0/build/src'
g++ -DPACKAGE_NAME=\"mesos\" -DPACKAGE_TARNAME=\"mesos\" -DPACKAGE_VERSION=\"1.9.0\" -DPACKAGE_STRING=\"mesos\ 1.9.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"mesos\" -DVERSION=\"1.9.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_CXX11=1 -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DHAVE_FTS_H=1 -DHAVE_APR_POOLS_H=1 -DHAVE_LIBAPR_1=1 -DHAVE_LIBCURL=1 -DMESOS_HAS_JAVA=1 -DHAVE_LIBSASL2=1 -DHAVE_SVN_VERSION_H=1 -DHAVE_LIBSVN_SUBR_1=1 -DHAVE_SVN_DELTA_H=1 -DHAVE_LIBSVN_DELTA_1=1 -DHAVE_ZLIB_H=1 -DHAVE_LIBZ=1 -DHAVE_PYTHON=\"2.7\" -DMESOS_HAS_PYTHON=1 -I. -I../../src -Werror -DLIBDIR=\"/usr/local/lib\" -DPKGLIBEXECDIR=\"/usr/local/libexec/mesos\" -DPKGDATADIR=\"/usr/local/share/mesos\" -DPKGMODULEDIR=\"/usr/local/lib/mesos/modules\" -I../../include -I../include -I../include/mesos -D__STDC_FORMAT_MACROS -I../3rdparty/boost-1.65.0 -I../3rdparty/concurrentqueue-7b69a8f -I../3rdparty/elfio-3.2 -I../3rdparty/glog-0.4.0/src -I../3rdparty/grpc-1.10.0/include -I../3rdparty/leveldb-1.19/include -I../3rdparty/libarchive-3.3.2/libarchive/ -I../../3rdparty/libprocess/include -I../3rdparty/nvml-352.79 -I../3rdparty/picojson-1.3.0 -I../3rdparty/protobuf-3.5.0/src -I../3rdparty/rapidjson-1.1.0/include -I../../3rdparty/stout/include -I../3rdparty/zookeeper-3.4.8/src/c/include -I../3rdparty/zookeeper-3.4.8/src/c/generated -I/usr/include/subversion-1 -I/usr/include/apr-1 -I/usr/include/apr-1.0 -pthread -Wall -Wsign-compare -Wformat-security -fstack-protector-strong -fPIC -fPIE -g1 -O0 -Wno-unused-local-typedefs -std=c++11 -MT local/mesos_local-main.o -MD -MP -MF local/.deps/mesos_local-main.Tpo -c -o local/mesos_local-main.o `test -f 'local/main.cpp' || echo '../../src/'`local/main.cpp
In file included from ../3rdparty/boost-1.65.0/boost/mpl/aux_/na_assert.hpp:23,
from ../3rdparty/boost-1.65.0/boost/mpl/arg.hpp:25,
from ../3rdparty/boost-1.65.0/boost/mpl/placeholders.hpp:24,
from ../3rdparty/boost-1.65.0/boost/iterator/iterator_categories.hpp:17,
from ../3rdparty/boost-1.65.0/boost/iterator/iterator_facade.hpp:14,
from ../3rdparty/boost-1.65.0/boost/range/iterator_range_core.hpp:27,
from ../3rdparty/boost-1.65.0/boost/lexical_cast.hpp:30,
from ../../3rdparty/stout/include/stout/numify.hpp:19,
from ../../3rdparty/stout/include/stout/bytes.hpp:24,
from ../../3rdparty/stout/include/stout/os.hpp:31,
from ../../src/local/main.cpp:22:
../3rdparty/boost-1.65.0/boost/mpl/assert.hpp:188:21: error: unnecessary parentheses in declaration of ‘assert_arg’ [-Werror=parentheses]
188 | failed ************ (Pred::************
| ^
../3rdparty/boost-1.65.0/boost/mpl/assert.hpp:193:21: error: unnecessary parentheses in declaration of ‘assert_not_arg’ [-Werror=parentheses]
193 | failed ************ (boost::mpl::not_<Pred>::************
| ^
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:11037: local/mesos_local-main.o] Error 1
make[2]: Leaving directory '/home/wuweijie/mesos/mesos-1.9.0/build/src'
make[1]: *** [Makefile:4742: all] Error 2
make[1]: Leaving directory '/home/wuweijie/mesos/mesos-1.9.0/build/src'
make: *** [Makefile:790: all-recursive] Error 1
具体错误
../3rdparty/boost-1.65.0/boost/mpl/assert.hpp:188:21: error: unnecessary parentheses in declaration of ‘assert_arg’ [-Werror=parentheses]
188 | failed ************ (Pred::************
| ^
../3rdparty/boost-1.65.0/boost/mpl/assert.hpp:193:21: error: unnecessary parentheses in declaration of ‘assert_not_arg’ [-Werror=parentheses]
193 | failed ************ (boost::mpl::not_<Pred>::************
| ^
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:11037: local/mesos_local-main.o] Error 1
解决方案
修改 mesos-1.9.0/src/Makefile.am
文件,将 MESOS_CPPFLAGS += @WERROR@
注释。
error: ambiguating new declaration of ‘long int gettid()’
问题描述
该问题在编译 gRPC 过程中发生。
相关 Issue
解决方案
直接进入 gRPC 源码包修改源码:
vim 3rdparty/grpc-1.10.0.tar.gz
需要修改以下两个文件:
- grpc-1.10.0/src/core/lib/gpr/log_posix.cc
- grpc-1.10.0/src/core/lib/gpr/log_linux.cc
将文件中的 gettid
函数声明及调用的地方重命名为 sys_gettid
。