[
https://issues.apache.org/jira/browse/MESOS-1427?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14011618#comment-14011618
]
Dominic Hamon commented on MESOS-1427:
--------------------------------------
I build with clang (3.4 and 3.5) on Ubuntu with no problem so it would be good
to know the version.
My complete guess is that the friend statement in Variable is resolving to a
different State class than the one we want. Perhaps a forward declaration of
State above the Variable class declaration might help.
> Build error: clang++ not respecting 'friend' keyword?
> -----------------------------------------------------
>
> Key: MESOS-1427
> URL: https://issues.apache.org/jira/browse/MESOS-1427
> Project: Mesos
> Issue Type: Bug
> Affects Versions: 0.19.0
> Reporter: Yan Xu
>
> 'State' is a
> [friend|https://github.com/apache/mesos/blob/a3170e0a9f85ee8230b7323ea97bf2d15fa2539f/src/state/protobuf.hpp#L60]
> of 'Variable' but the following error nonetheless.
> {noformat}
> libtool: compile: clang++ -DPACKAGE_NAME=\"mesos\"
> -DPACKAGE_TARNAME=\"mesos\" -DPACKAGE_VERSION=\"0.19.0\"
> "-DPACKAGE_STRING=\"mesos 0.19.0\"" -DPACKAGE_BUGREPORT=\"\"
> -DPACKAGE_URL=\"\" -DPACKAGE=\"mesos\" -DVERSION=\"0.19.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_PTHREAD=1
> -DMESOS_HAS_JAVA=1 -DHAVE_PYTHON=\"2.7\" -DMESOS_HAS_PYTHON=1 -DHAVE_LIBZ=1
> -DHAVE_LIBCURL=1 -DHAVE_LIBSASL2=1 -I. -Wall -Werror
> -DLIBDIR=\"/usr/local/lib\" -DPKGLIBEXECDIR=\"/usr/local/libexec/mesos\"
> -DPKGDATADIR=\"/usr/local/share/mesos\" -I../include
> -I../3rdparty/libprocess/include
> -I../3rdparty/libprocess/3rdparty/stout/include -I../include
> -I../3rdparty/libprocess/3rdparty/boost-1.53.0
> -I../3rdparty/libprocess/3rdparty/protobuf-2.5.0/src
> -I../3rdparty/libprocess/3rdparty/picojson-4f93734
> -I../3rdparty/libprocess/3rdparty/glog-0.3.3/src
> -I../3rdparty/leveldb/include -I../3rdparty/zookeeper-3.4.5/src/c/include
> -I../3rdparty/zookeeper-3.4.5/src/c/generated -pthread -g -g2 -O2 -std=c++11
> -MT master/libmesos_no_3rdparty_la-registrar.lo -MD -MP -MF
> master/.deps/libmesos_no_3rdparty_la-registrar.Tpo -c master/registrar.cpp
> -fPIC -DPIC -o master/.libs/libmesos_no_3rdparty_la-registrar.o
> In file included from master/registrar.cpp:43:
> In file included from ./master/registrar.hpp:32:
> ./state/protobuf.hpp:124:10: error: calling a private constructor of class
> 'mesos::internal::state::protobuf::Variable<mesos::internal::Registry>'
> return Variable<T>(variable, t.get());
> ^
> ./state/protobuf.hpp:111:41: note: in instantiation of function template
> specialization
> 'mesos::internal::state::protobuf::State::_fetch<mesos::internal::Registry>'
> requested here
> .then(lambda::bind(&State::template _fetch<T>, lambda::_1));
> ^
> master/registrar.cpp:315:37: note: in instantiation of function template
> specialization
> 'mesos::internal::state::protobuf::State::fetch<mesos::internal::Registry>'
> requested here
> metrics.state_fetch.time(state->fetch<Registry>("registry"))
> ^
> ./state/protobuf.hpp:62:3: note: declared private here
> Variable(const state::Variable& _variable, const T& _t)
> ^
> ./state/protobuf.hpp:132:57: error: 't' is a private member of
> 'mesos::internal::state::protobuf::Variable<mesos::internal::Registry>'
> Try<std::string> value = messages::serialize(variable.t);
> ^
> master/registrar.cpp:441:35: note: in instantiation of function template
> specialization
> 'mesos::internal::state::protobuf::State::store<mesos::internal::Registry>'
> requested here
> metrics.state_store.time(state->store(variable.get().mutate(registry)))
> ^
> ./state/protobuf.hpp:67:5: note: declared private here
> T t;
> ^
> ./state/protobuf.hpp:138:39: error: 'variable' is a private member of
> 'mesos::internal::state::protobuf::Variable<mesos::internal::Registry>'
> return state::State::store(variable.variable.mutate(value.get()))
> ^
> ./state/protobuf.hpp:66:19: note: declared private here
> state::Variable variable; // Not const to keep Variable assignable.
> ^
> ./state/protobuf.hpp:139:61: error: 't' is a private member of
> 'mesos::internal::state::protobuf::Variable<mesos::internal::Registry>'
> .then(lambda::bind(&State::template _store<T>, variable.t, lambda::_1));
> ^
> ./state/protobuf.hpp:67:5: note: declared private here
> T t;
> ^
> ./state/protobuf.hpp:149:17: error: calling a private constructor of class
> 'mesos::internal::state::protobuf::Variable<mesos::internal::Registry>'
> return Some(Variable<T>(variable.get(), t));
> ^
> ./state/protobuf.hpp:139:41: note: in instantiation of function template
> specialization
> 'mesos::internal::state::protobuf::State::_store<mesos::internal::Registry>'
> requested here
> .then(lambda::bind(&State::template _store<T>, variable.t, lambda::_1));
> ^
> master/registrar.cpp:441:35: note: in instantiation of function template
> specialization
> 'mesos::internal::state::protobuf::State::store<mesos::internal::Registry>'
> requested here
> metrics.state_store.time(state->store(variable.get().mutate(registry)))
> ^
> ./state/protobuf.hpp:62:3: note: declared private here
> Variable(const state::Variable& _variable, const T& _t)
> ^
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.2#6252)