Hi, Clang 3.5 should be OK.
In the build log you gave, the "-std=gnu++1y" flag is not being passed to the compiler, which explains the errors that follow. One reason this could happen is if you are building from source and you are using an older version of libtool. libtool is known to drop flags from CXXFLAGS if it doesn't recognize them, and perhaps it doesn't recognize "-std=gnu++1y". Note that normally the configure script automatically detects which -std= flag to use and automatically works around this bug in libtool, however since you specified -std= manually in your CXXFLAGS, you've disabled the auto-detection. I suggest starting over and letting the autodetection do its thing: make distclean ./configure CXX=clang++ CXXFLAGS=-g Or if you really want to enable C++14 (even though Cap'n Proto doesn't use it), put it in CXX to work around libtool: make distclean ./configure CXX="clang++ -std=gnu++1y" CXXFLAGS=-g BTW, I see you are using 0.5.3.1, but note that the current version is 0.6.0. -Kenton On Thu, May 25, 2017 at 12:14 PM, Lucky Boy <sxl...@gmail.com> wrote: > Hi everyone, > > I am a beginner on Cap'n Proto and I would like to ask a build question. I > am using Clang 3.5.0 to build Cap'n Proto but failed. What I did for build > was > > ./configure CXX=clang++ CXXFLAGS='-std=gnu++1y -g' > > make > > and the build error is as follows: > > > luckyboy@cse-322osu10:capnproto-c++-0.5.3.1$ make > depbase=`echo src/capnp/compiler/module-loader.o | sed > 's|[^/]*$|.deps/&|;s|\.o$||'`;\ > clang++ -stdlib=libc++ -DHAVE_CONFIG_H -I. -I./src -I./src > -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS > -DCAPNP_INCLUDE_DIR='"/usr/local/include"' > -pthread -g -pthread -MT src/capnp/compiler/module-loader.o -MD -MP -MF > $depbase.Tpo -c -o src/capnp/compiler/module-loader.o > src/capnp/compiler/module-loader.c++ &&\ > mv -f $depbase.Tpo $depbase.Po > In file included from src/capnp/compiler/module-loader.c++:22: > In file included from src/capnp/compiler/module-loader.h:29: > In file included from src/capnp/compiler/compiler.h:29: > In file included from ./src/capnp/compiler/grammar.capnp.h:7: > In file included from ./src/capnp/generated-header-support.h:31: > In file included from ./src/capnp/layout.h:36: > ./src/kj/common.h:35:4: error: "This code requires C++11. Either your > compiler does not support it or it is not enabled." > #error "This code requires C++11. Either your compiler does not support > it or it is not enabled." > ^ > ./src/kj/common.h:38:6: error: "Pass -std=c++11 on the compiler command > line to enable C++11." > #error "Pass -std=c++11 on the compiler command line to enable C++11." > ^ > ./src/kj/common.h:289:39: warning: alias declarations are a C++11 > extension [-Wc++11-extensions] > template <typename T> using NoInfer = typename NoInfer_<T>::Type; > ^ > ./src/kj/common.h:295:43: warning: alias declarations are a C++11 > extension [-Wc++11-extensions] > template <typename T> using RemoveConst = typename RemoveConst_<T>::Type; > ^ > ./src/kj/common.h:297:56: error: unknown type name 'constexpr' > template <typename> struct IsLvalueReference_ { static constexpr bool > value = false; }; > ^ > ./src/kj/common.h:297:66: error: expected member name or ';' after > declaration specifiers > template <typename> struct IsLvalueReference_ { static constexpr bool > value = false; }; > ~~~~~~~~~~~~~~~~ ^ > ./src/kj/common.h:298:62: error: unknown type name 'constexpr' > template <typename T> struct IsLvalueReference_<T&> { static constexpr > bool value = true; }; > ^ > ./src/kj/common.h:298:72: error: expected member name or ';' after > declaration specifiers > template <typename T> struct IsLvalueReference_<T&> { static constexpr > bool value = true; }; > ~~~~~~~~~~~~~~~~ ^ > ./src/kj/common.h:300:8: error: unknown type name 'constexpr' > inline constexpr bool isLvalueReference() { return > IsLvalueReference_<T>::value; } > ^ > ./src/kj/common.h:300:18: error: expected unqualified-id > inline constexpr bool isLvalueReference() { return > IsLvalueReference_<T>::value; } > ^ > ./src/kj/common.h:303:30: error: explicit specialization of non-template > struct 'Decay_' > template <typename T> struct Decay_<T&> { typedef typename Decay_<T>::Type > Type; }; > ^ ~~~~ > ./src/kj/common.h:303:71: error: no type named 'Type' in 'Decay_<T>' > template <typename T> struct Decay_<T&> { typedef typename Decay_<T>::Type > Type; }; > ~~~~~~~~~~~~~~~~~~~~^~~~ > ./src/kj/common.h:304:38: warning: rvalue references are a C++11 extension > [-Wc++11-extensions] > template <typename T> struct Decay_<T&&> { typedef typename > Decay_<T>::Type Type; }; > ^ > ./src/kj/common.h:311:37: warning: alias declarations are a C++11 > extension [-Wc++11-extensions] > template <typename T> using Decay = typename Decay_<T>::Type; > ^ > ./src/kj/common.h:315:36: warning: alias declarations are a C++11 > extension [-Wc++11-extensions] > template <bool b> using EnableIf = typename EnableIf_<b>::Type; > ^ > ./src/kj/common.h:322:13: error: expected ';' at end of declaration > T instance() noexcept; > ^ > ; > ./src/kj/common.h:322:14: error: C++ requires a type specifier for all > declarations > T instance() noexcept; > ^~~~~~~~ > ./src/kj/common.h:343:25: warning: defaulted function definitions are a > C++11 extension [-Wc++11-extensions] > DisallowConstCopy() = default; > ^ > ./src/kj/common.h:345:38: warning: rvalue references are a C++11 extension > [-Wc++11-extensions] > DisallowConstCopy(DisallowConstCopy&&) = default; > ^ > ./src/kj/common.h:345:44: warning: defaulted function definitions are a > C++11 extension [-Wc++11-extensions] > DisallowConstCopy(DisallowConstCopy&&) = default; > ^ > ./src/kj/common.h:347:49: warning: rvalue references are a C++11 extension > [-Wc++11-extensions] > DisallowConstCopy& operator=(DisallowConstCopy&&) = default; > ^ > ./src/kj/common.h:347:55: warning: defaulted function definitions are a > C++11 extension [-Wc++11-extensions] > DisallowConstCopy& operator=(DisallowConstCopy&&) = default; > ^ > ./src/kj/common.h:351:67: warning: defaulted function definitions are a > C++11 extension [-Wc++11-extensions] > inline DisallowConstCopy::DisallowConstCopy(DisallowConstCopy&) = default; > ^ > ./src/kj/common.h:352:78: warning: defaulted function definitions are a > C++11 extension [-Wc++11-extensions] > inline DisallowConstCopy& DisallowConstCopy::operator=(DisallowConstCopy&) > = default; > > ^ > ./src/kj/common.h:364:48: error: unknown type name 'constexpr' > template <typename T> struct IsConst_ { static constexpr bool value = > false; }; > ^ > ./src/kj/common.h:364:58: error: expected member name or ';' after > declaration specifiers > template <typename T> struct IsConst_ { static constexpr bool value = > false; }; > ~~~~~~~~~~~~~~~~ ^ > ./src/kj/common.h:365:57: error: unknown type name 'constexpr' > template <typename T> struct IsConst_<const T> { static constexpr bool > value = true; }; > ^ > ./src/kj/common.h:365:67: error: expected member name or ';' after > declaration specifiers > template <typename T> struct IsConst_<const T> { static constexpr bool > value = true; }; > ~~~~~~~~~~~~~~~~ ^ > ./src/kj/common.h:366:23: error: unknown type name 'constexpr' > template <typename T> constexpr bool isConst() { return > IsConst_<T>::value; } > ^ > ./src/kj/common.h:366:33: error: expected unqualified-id > template <typename T> constexpr bool isConst() { return > IsConst_<T>::value; } > ^ > ./src/kj/common.h:369:30: error: explicit specialization of non-template > struct 'EnableIfNotConst_' > template <typename T> struct EnableIfNotConst_<const T>; > ^ ~~~~~~~~~ > ./src/kj/common.h:370:48: warning: alias declarations are a C++11 > extension [-Wc++11-extensions] > template <typename T> using EnableIfNotConst = typename > EnableIfNotConst_<T>::Type; > ^ > ./src/kj/common.h:374:45: warning: alias declarations are a C++11 > extension [-Wc++11-extensions] > template <typename T> using EnableIfConst = typename > EnableIfConst_<T>::Type; > ^ > ./src/kj/common.h:378:52: warning: alias declarations are a C++11 > extension [-Wc++11-extensions] > template <typename T> using RemoveConstOrDisable = typename > RemoveConstOrDisable_<T>::Type; > ^ > fatal error: too many errors emitted, stopping now [-ferror-limit=] > clang: /home/sxl463/working/softboundcets-3.5.0/softboundcets-llvm-3.5.0/ > include/llvm/Support/Casting.h:95: static bool > llvm::isa_impl_cl<clang::FunctionDecl, > const clang::DeclContext *>::doit(const From *) [To = clang::FunctionDecl, > From = const clang::DeclContext *]: Assertion `Val && "isa<> used on a null > pointer"' failed. > 0 clang 0x000000000288d535 llvm::sys::PrintStackTrace(_IO_FILE*) > + 37 > 1 clang 0x000000000288de33 > 2 libpthread.so.0 0x00002b42dfb1c330 > 3 libc.so.6 0x00002b42e09adc37 gsignal + 55 > 4 libc.so.6 0x00002b42e09b1028 abort + 328 > 5 libc.so.6 0x00002b42e09a6bf6 > 6 libc.so.6 0x00002b42e09a6ca2 > 7 clang 0x0000000000c60e1b clang::Sema:: > FinalizeDeclaration(clang::Decl*) + 3307 > 8 clang 0x0000000000b17115 clang::Parser:: > ParseCXXClassMemberDeclaration(clang::AccessSpecifier, > clang::AttributeList*, clang::Parser::ParsedTemplateInfo const&, > clang::ParsingDeclRAIIObject*) + 6069 > 9 clang 0x0000000000b136eb clang::Parser:: > ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, > clang::Parser::ParsedAttributesWithRange&, unsigned int, clang::Decl*) + > 2491 > 10 clang 0x0000000000b11f47 clang::Parser:: > ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, > clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, > clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, > clang::Parser::ParsedAttributesWithRange&) + 8231 > 11 clang 0x0000000000af51f8 clang::Parser:: > ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo > const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, > clang::Parser::LateParsedAttrList*) + 2888 > 12 clang 0x0000000000b645ec clang::Parser:: > ParseSingleDeclarationAfterTemplate(unsigned int, > clang::Parser::ParsedTemplateInfo > const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, > clang::AccessSpecifier, clang::AttributeList*) + 604 > 13 clang 0x0000000000b64037 clang::Parser:: > ParseTemplateDeclarationOrSpecialization(unsigned int, > clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + > 1015 > 14 clang 0x0000000000b63a30 clang::Parser:: > ParseDeclarationStartingWithTemplate(unsigned int, > clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 288 > 15 clang 0x0000000000af4228 clang::Parser:: > ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned int, > clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 872 > 16 clang 0x0000000000ae42db clang::Parser:: > ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, > clang::ParsingDeclSpec*) + 1755 > 17 clang 0x0000000000b0b149 clang::Parser:: > ParseInnerNamespace(std::vector<clang::SourceLocation, > std::allocator<clang::SourceLocation> >&, std::vector<clang::IdentifierInfo*, > std::allocator<clang::IdentifierInfo*> >&, std::vector<clang::SourceLocation, > std::allocator<clang::SourceLocation> >&, unsigned int, > clang::SourceLocation&, clang::ParsedAttributes&, > clang::BalancedDelimiterTracker&) > + 313 > 18 clang 0x0000000000b0aa11 clang::Parser::ParseNamespace(unsigned > int, clang::SourceLocation&, clang::SourceLocation) + 5921 > 19 clang 0x0000000000af4069 clang::Parser:: > ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned int, > clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 425 > 20 clang 0x0000000000ae42db clang::Parser:: > ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, > clang::ParsingDeclSpec*) + 1755 > 21 clang 0x0000000000b0b149 clang::Parser:: > ParseInnerNamespace(std::vector<clang::SourceLocation, > std::allocator<clang::SourceLocation> >&, std::vector<clang::IdentifierInfo*, > std::allocator<clang::IdentifierInfo*> >&, std::vector<clang::SourceLocation, > std::allocator<clang::SourceLocation> >&, unsigned int, > clang::SourceLocation&, clang::ParsedAttributes&, > clang::BalancedDelimiterTracker&) > + 313 > 22 clang 0x0000000000b0aa11 clang::Parser::ParseNamespace(unsigned > int, clang::SourceLocation&, clang::SourceLocation) + 5921 > 23 clang 0x0000000000af4069 clang::Parser:: > ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned int, > clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 425 > 24 clang 0x0000000000ae42db clang::Parser:: > ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, > clang::ParsingDeclSpec*) + 1755 > 25 clang 0x0000000000ae3b06 clang::Parser:: > ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 502 > 26 clang 0x0000000000adf816 clang::ParseAST(clang::Sema&, bool, > bool) + 406 > 27 clang 0x0000000000708bde clang::FrontendAction::Execute() + > 62 > 28 clang 0x00000000006dd513 clang::CompilerInstance:: > ExecuteAction(clang::FrontendAction&) + 851 > 29 clang 0x00000000006bfe70 > clang::ExecuteCompilerInvocation(clang::CompilerInstance*) > + 3104 > 30 clang 0x00000000006b7029 cc1_main(char const**, char const**, > char const*, void*) + 665 > 31 clang 0x00000000006bdb16 main + 9158 > 32 libc.so.6 0x00002b42e0998f45 __libc_start_main + 245 > 33 clang 0x00000000006b6cc9 > Stack dump: > 0. Program arguments: /usr/local/bin/clang -cc1 -triple > x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free > -main-file-name module-loader.c++ -mrelocation-model static > -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases > -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version > 2.24 -g -dwarf-column-info -coverage-file /home/sxl463/working/ > capnproto/capnproto-c++-0.5.3.1/src/capnp/compiler/module-loader.o > -resource-dir /usr/local/bin/../lib/clang/3.5.0 -dependency-file > src/capnp/compiler/.deps/module-loader.Tpo -sys-header-deps -MP -MT > src/capnp/compiler/module-loader.o -D HAVE_CONFIG_H -D KJ_HEADER_WARNINGS > -D CAPNP_HEADER_WARNINGS -D CAPNP_INCLUDE_DIR="/usr/local/include" -I . > -I ./src -I ./src -internal-isystem /usr/local/bin/../include/c++/v1 > -internal-isystem /usr/local/include -internal-isystem > /usr/local/bin/../lib/clang/3.5.0/include -internal-externc-isystem > /usr/include/x86_64-linux-gnu -internal-externc-isystem /include > -internal-externc-isystem /usr/include -fdeprecated-macro > -fdebug-compilation-dir /home/sxl463/working/ > capnproto/capnproto-c++-0.5.3.1 -ferror-limit 19 -fmessage-length 134 > -pthread -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions > -fdiagnostics-show-option -o src/capnp/compiler/module-loader.o -x c++ > src/capnp/compiler/module-loader.c++ > 1. ./src/capnp/generated-header-support.h:262:40: current parser token > 'const' > 2. ./src/capnp/generated-header-support.h:39:1: parsing namespace 'capnp' > 3. ./src/capnp/generated-header-support.h:48:1: parsing namespace '_' > 4. ./src/capnp/generated-header-support.h:260:1: parsing > struct/union/class body 'ChooseBrand' > clang: error: unable to execute command: Aborted (core dumped) > clang: error: clang frontend command failed due to signal (use -v to see > invocation) > clang version 3.5.0 (tags/RELEASE_350/final) > Target: x86_64-unknown-linux-gnu > Thread model: posix > clang: note: diagnostic msg: PLEASE submit a bug report to > http://llvm.org/bugs/ and include the crash backtrace, preprocessed > source, and associated run script. > clang: note: diagnostic msg: Error generating preprocessed source(s). > make: *** [src/capnp/compiler/module-loader.o] Error 254 > > > ------------------------------------------------------------ > -------------------------------------------------------------- > > It seems someone had asked similar questions 3 years ago but no official > solution. What I am eager to know is how should I handle this? If I want to > keep using Clang 3.5, is this unavoidable? > > Thanks very much for any hints and help! > > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Cap'n Proto" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to capnproto+unsubscr...@googlegroups.com. > Visit this group at https://groups.google.com/group/capnproto. > -- You received this message because you are subscribed to the Google Groups "Cap'n Proto" group. To unsubscribe from this group and stop receiving emails from it, send an email to capnproto+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/capnproto.