编译C应用程序时出错(Apache Thrift)

我想用C程序Apache Thrift进行一些开发,我将更改一些源代码并尝试向开源社区贡献一些代码.为此,我需要能够从源代码构建和安装Apache Thrift,但是当我尝试构建它时,我遇到了一些错误.

我在Google上搜索过,但我找不到任何可以解决我一直遇到的问题的答案.我正在运行OSX Mountain Lion 10.8.2,我想我已经安装了http://thrift.apache.org/docs/install/所列的所有要求.

我认为真正的问题是当我运行make时(向下滚动,如果你想现在看到这些信息),但为了以防万一,我会提到一切.

当我按照http://thrift.apache.org/docs/BuildingFromSource/的指示在thrift文件夹中运行./bootstrap.sh时,我在输出的顶部会收到一些警告,但我不认为它们是否是一个问题,因为我在“successful builds中看到它们. “以下是警告:

configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions
configure.ac: warning: missing AC_CHECK_HEADERS([wchar.h]) wanted by: lib/py/compat/win32/stdint.h:52 

如果需要,这是./bootstrap.sh命令的整个输出:

Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions
configure.ac: warning: missing AC_CHECK_HEADERS([wchar.h]) wanted by: lib/py/compat/win32/stdint.h:52
configure.ac:103: installing './config.guess'
configure.ac:103: installing './config.sub'
configure.ac:26: installing './install-sh'
configure.ac:26: installing './missing'
compiler/cpp/Makefile.am: installing './depcomp'
configure.ac: installing './ylwrap'
lib/cpp/test/Makefile.am:178: warning: variable 'concurrency_test_SOURCES' is defined but no program or
lib/cpp/test/Makefile.am:178: library has 'concurrency_test' as canonical name (possible typo)
lib/cpp/test/Makefile.am:187: warning: variable 'processor_test_SOURCES' is defined but no program or
lib/cpp/test/Makefile.am:187: library has 'processor_test' as canonical name (possible typo)
lib/cpp/test/Makefile.am:195: warning: variable 'processor_test_LDADD' is defined but no program or
lib/cpp/test/Makefile.am:195: library has 'processor_test' as canonical name (possible typo)
lib/cpp/test/Makefile.am:184: warning: variable 'concurrency_test_LDADD' is defined but no program or
lib/cpp/test/Makefile.am:184: library has 'concurrency_test' as canonical name (possible typo)

接下来,我运行./configure,它似乎成功运行.当我试图将输出放在我的帖子中时,我用完了字符,所以如果需要,我将整个输出放入Google Doc.

接下来我尝试运行make记录一堆错误.我认为罪魁祸首可能是第一个错误:

thriftl.ll:51:21: error: thrifty.h: No such file or directory

我不知道如何解决这个错误.以防万一,这是make命令的整个输出:

make  all-recursive
Making all in compiler/cpp
make  all-am
\
     \
    /bin/sh ../../ylwrap `test -f 'src/thrifty.yy' || echo './'`src/thrifty.yy y.tab.c thrifty.cc y.tab.h `echo thrifty.cc | sed -e s/cc$/hh/ -e s/cpp$/hpp/ -e s/cxx$/hxx/ -e s/c++$/h++/ -e s/c$/h/` y.output thrifty.output -- bison -y -d 
thrifty.hh is unchanged
g++ -DHAVE_CONFIG_H -I. -I../..  -I./src  -Wall -Wno-sign-compare -Wno-unused -g -O2 -MT libparse_a-thrifty.o -MD -MP -MF .deps/libparse_a-thrifty.Tpo -c -o libparse_a-thrifty.o `test -f 'thrifty.cc' || echo './'`thrifty.cc
mv -f .deps/libparse_a-thrifty.Tpo .deps/libparse_a-thrifty.Po
\
     \
    /bin/sh ../../ylwrap `test -f 'src/thriftl.ll' || echo './'`src/thriftl.ll lex.yy.c thriftl.cc -- flex  
g++ -DHAVE_CONFIG_H -I. -I../..  -I./src  -Wall -Wno-sign-compare -Wno-unused -g -O2 -MT libparse_a-thriftl.o -MD -MP -MF .deps/libparse_a-thriftl.Tpo -c -o libparse_a-thriftl.o `test -f 'thriftl.cc' || echo './'`thriftl.cc
thriftl.ll:51:21: error: thrifty.h: No such file or directory
thriftl.ll: In function ‘int yylex()’:
thriftl.ll:114: error: ‘yylval’ was not declared in this scope
thriftl.ll:114: error: ‘tok_int_constant’ was not declared in this scope
thriftl.ll:115: error: ‘yylval’ was not declared in this scope
thriftl.ll:115: error: ‘tok_int_constant’ was not declared in this scope
thriftl.ll:117: error: ‘tok_namespace’ was not declared in this scope
thriftl.ll:118: error: ‘tok_cpp_namespace’ was not declared in this scope
thriftl.ll:119: error: ‘tok_cpp_include’ was not declared in this scope
thriftl.ll:120: error: ‘tok_cpp_type’ was not declared in this scope
thriftl.ll:121: error: ‘tok_java_package’ was not declared in this scope
thriftl.ll:122: error: ‘tok_cocoa_prefix’ was not declared in this scope
thriftl.ll:123: error: ‘tok_csharp_namespace’ was not declared in this scope
thriftl.ll:124: error: ‘tok_delphi_namespace’ was not declared in this scope
thriftl.ll:125: error: ‘tok_php_namespace’ was not declared in this scope
thriftl.ll:126: error: ‘tok_py_module’ was not declared in this scope
thriftl.ll:127: error: ‘tok_perl_package’ was not declared in this scope
thriftl.ll:128: error: ‘tok_ruby_namespace’ was not declared in this scope
thriftl.ll:129: error: ‘tok_smalltalk_category’ was not declared in this scope
thriftl.ll:130: error: ‘tok_smalltalk_prefix’ was not declared in this scope
thriftl.ll:131: error: ‘tok_xsd_all’ was not declared in this scope
thriftl.ll:132: error: ‘tok_xsd_optional’ was not declared in this scope
thriftl.ll:133: error: ‘tok_xsd_nillable’ was not declared in this scope
thriftl.ll:134: error: ‘tok_xsd_namespace’ was not declared in this scope
thriftl.ll:135: error: ‘tok_xsd_attrs’ was not declared in this scope
thriftl.ll:136: error: ‘tok_include’ was not declared in this scope
thriftl.ll:137: error: ‘tok_void’ was not declared in this scope
thriftl.ll:138: error: ‘tok_bool’ was not declared in this scope
thriftl.ll:139: error: ‘tok_byte’ was not declared in this scope
thriftl.ll:140: error: ‘tok_i16’ was not declared in this scope
thriftl.ll:141: error: ‘tok_i32’ was not declared in this scope
thriftl.ll:142: error: ‘tok_i64’ was not declared in this scope
thriftl.ll:143: error: ‘tok_double’ was not declared in this scope
thriftl.ll:144: error: ‘tok_string’ was not declared in this scope
thriftl.ll:145: error: ‘tok_binary’ was not declared in this scope
thriftl.ll:146: error: ‘tok_slist’ was not declared in this scope
thriftl.ll:147: error: ‘tok_senum’ was not declared in this scope
thriftl.ll:148: error: ‘tok_map’ was not declared in this scope
thriftl.ll:149: error: ‘tok_list’ was not declared in this scope
thriftl.ll:150: error: ‘tok_set’ was not declared in this scope
thriftl.ll:151: error: ‘tok_oneway’ was not declared in this scope
thriftl.ll:152: error: ‘tok_typedef’ was not declared in this scope
thriftl.ll:153: error: ‘tok_struct’ was not declared in this scope
thriftl.ll:154: error: ‘tok_union’ was not declared in this scope
thriftl.ll:155: error: ‘tok_xception’ was not declared in this scope
thriftl.ll:156: error: ‘tok_extends’ was not declared in this scope
thriftl.ll:157: error: ‘tok_throws’ was not declared in this scope
thriftl.ll:158: error: ‘tok_service’ was not declared in this scope
thriftl.ll:159: error: ‘tok_enum’ was not declared in this scope
thriftl.ll:160: error: ‘tok_const’ was not declared in this scope
thriftl.ll:161: error: ‘tok_required’ was not declared in this scope
thriftl.ll:162: error: ‘tok_optional’ was not declared in this scope
thriftl.ll:165: error: ‘tok_oneway’ was not declared in this scope
thriftl.ll:275: error: ‘yylval’ was not declared in this scope
thriftl.ll:279: error: ‘tok_int_constant’ was not declared in this scope
thriftl.ll:284: error: ‘yylval’ was not declared in this scope
thriftl.ll:288: error: ‘tok_int_constant’ was not declared in this scope
thriftl.ll:292: error: ‘yylval’ was not declared in this scope
thriftl.ll:293: error: ‘tok_dub_constant’ was not declared in this scope
thriftl.ll:297: error: ‘yylval’ was not declared in this scope
thriftl.ll:298: error: ‘tok_identifier’ was not declared in this scope
thriftl.ll:302: error: ‘yylval’ was not declared in this scope
thriftl.ll:303: error: ‘tok_st_identifier’ was not declared in this scope
thriftl.ll:347: error: ‘yylval’ was not declared in this scope
thriftl.ll:348: error: ‘tok_literal’ was not declared in this scope
make[3]: *** [libparse_a-thriftl.o] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

而且,虽然我怀疑它是否需要,因为我认为错误是在make中,最后一个输出 – sudo make install:

Making install in compiler/cpp
make  install-am
g++ -DHAVE_CONFIG_H -I. -I../..  -I./src  -Wall -Wno-sign-compare -Wno-unused -g -O2 -MT libparse_a-thriftl.o -MD -MP -MF .deps/libparse_a-thriftl.Tpo -c -o libparse_a-thriftl.o `test -f 'thriftl.cc' || echo './'`thriftl.cc
thriftl.ll:51:21: error: thrifty.h: No such file or directory
thriftl.ll: In function ‘int yylex()’:
thriftl.ll:114: error: ‘yylval’ was not declared in this scope
thriftl.ll:114: error: ‘tok_int_constant’ was not declared in this scope
thriftl.ll:115: error: ‘yylval’ was not declared in this scope
thriftl.ll:115: error: ‘tok_int_constant’ was not declared in this scope
thriftl.ll:117: error: ‘tok_namespace’ was not declared in this scope
thriftl.ll:118: error: ‘tok_cpp_namespace’ was not declared in this scope
thriftl.ll:119: error: ‘tok_cpp_include’ was not declared in this scope
thriftl.ll:120: error: ‘tok_cpp_type’ was not declared in this scope
thriftl.ll:121: error: ‘tok_java_package’ was not declared in this scope
thriftl.ll:122: error: ‘tok_cocoa_prefix’ was not declared in this scope
thriftl.ll:123: error: ‘tok_csharp_namespace’ was not declared in this scope
thriftl.ll:124: error: ‘tok_delphi_namespace’ was not declared in this scope
thriftl.ll:125: error: ‘tok_php_namespace’ was not declared in this scope
thriftl.ll:126: error: ‘tok_py_module’ was not declared in this scope
thriftl.ll:127: error: ‘tok_perl_package’ was not declared in this scope
thriftl.ll:128: error: ‘tok_ruby_namespace’ was not declared in this scope
thriftl.ll:129: error: ‘tok_smalltalk_category’ was not declared in this scope
thriftl.ll:130: error: ‘tok_smalltalk_prefix’ was not declared in this scope
thriftl.ll:131: error: ‘tok_xsd_all’ was not declared in this scope
thriftl.ll:132: error: ‘tok_xsd_optional’ was not declared in this scope
thriftl.ll:133: error: ‘tok_xsd_nillable’ was not declared in this scope
thriftl.ll:134: error: ‘tok_xsd_namespace’ was not declared in this scope
thriftl.ll:135: error: ‘tok_xsd_attrs’ was not declared in this scope
thriftl.ll:136: error: ‘tok_include’ was not declared in this scope
thriftl.ll:137: error: ‘tok_void’ was not declared in this scope
thriftl.ll:138: error: ‘tok_bool’ was not declared in this scope
thriftl.ll:139: error: ‘tok_byte’ was not declared in this scope
thriftl.ll:140: error: ‘tok_i16’ was not declared in this scope
thriftl.ll:141: error: ‘tok_i32’ was not declared in this scope
thriftl.ll:142: error: ‘tok_i64’ was not declared in this scope
thriftl.ll:143: error: ‘tok_double’ was not declared in this scope
thriftl.ll:144: error: ‘tok_string’ was not declared in this scope
thriftl.ll:145: error: ‘tok_binary’ was not declared in this scope
thriftl.ll:146: error: ‘tok_slist’ was not declared in this scope
thriftl.ll:147: error: ‘tok_senum’ was not declared in this scope
thriftl.ll:148: error: ‘tok_map’ was not declared in this scope
thriftl.ll:149: error: ‘tok_list’ was not declared in this scope
thriftl.ll:150: error: ‘tok_set’ was not declared in this scope
thriftl.ll:151: error: ‘tok_oneway’ was not declared in this scope
thriftl.ll:152: error: ‘tok_typedef’ was not declared in this scope
thriftl.ll:153: error: ‘tok_struct’ was not declared in this scope
thriftl.ll:154: error: ‘tok_union’ was not declared in this scope
thriftl.ll:155: error: ‘tok_xception’ was not declared in this scope
thriftl.ll:156: error: ‘tok_extends’ was not declared in this scope
thriftl.ll:157: error: ‘tok_throws’ was not declared in this scope
thriftl.ll:158: error: ‘tok_service’ was not declared in this scope
thriftl.ll:159: error: ‘tok_enum’ was not declared in this scope
thriftl.ll:160: error: ‘tok_const’ was not declared in this scope
thriftl.ll:161: error: ‘tok_required’ was not declared in this scope
thriftl.ll:162: error: ‘tok_optional’ was not declared in this scope
thriftl.ll:165: error: ‘tok_oneway’ was not declared in this scope
thriftl.ll:275: error: ‘yylval’ was not declared in this scope
thriftl.ll:279: error: ‘tok_int_constant’ was not declared in this scope
thriftl.ll:284: error: ‘yylval’ was not declared in this scope
thriftl.ll:288: error: ‘tok_int_constant’ was not declared in this scope
thriftl.ll:292: error: ‘yylval’ was not declared in this scope
thriftl.ll:293: error: ‘tok_dub_constant’ was not declared in this scope
thriftl.ll:297: error: ‘yylval’ was not declared in this scope
thriftl.ll:298: error: ‘tok_identifier’ was not declared in this scope
thriftl.ll:302: error: ‘yylval’ was not declared in this scope
thriftl.ll:303: error: ‘tok_st_identifier’ was not declared in this scope
thriftl.ll:347: error: ‘yylval’ was not declared in this scope
thriftl.ll:348: error: ‘tok_literal’ was not declared in this scope
make[2]: *** [libparse_a-thriftl.o] Error 1
make[1]: *** [install] Error 2
make: *** [install-recursive] Error 1

我已经尝试了谷歌搜索这些错误,但我不熟悉C,我找不到任何帮助.

我需要做些什么才能解决这些错误?

解决方法:

我相信你遇到了这里描述的错误:https://issues.apache.org/jira/browse/THRIFT-1614.

你可能有automake-1.12(这是你用brew install automake得到的),它创建了一个thrifty.hh文件而不是包含的thrifty.h.错误报告中给出的解决方法是手动将thriftl.cc中的include更改为thrifty.hh.如果您使用brew this应该有所帮助,您也可以尝试降级automake.

上一篇:使用PHP和Java的thrift


下一篇:c# – Cassandra System.OutOfMemoryException,它是一个Thrift错误吗?