3

I'm wanting to do some developing with the C++ program, Apache Thrift, where I will be changing some of the source code and trying to contribute some code to the open source community. To do this, I need to be able to build and install Apache Thrift from source, but I'm getting some errors when I'm trying to build it.

I've searched on Google, but I can't find any answers that fix the problem I've been having. I'm running OSX Mountain Lion 10.8.2 and I think I've installed all of the requirements listed at http://thrift.apache.org/docs/install/.

I think the real problem is when I run make (scroll down if you want to see that info now), but just in case, I'm going to mention everything.

When I run ./bootstrap.sh in the thrift folder as instructed at http://thrift.apache.org/docs/BuildingFromSource/, I get a few warnings at the top of the output, but I don't think if they are a problem as I've seen them in "successful builds." Here are the warnings:

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 

If it's needed, here is the entire output of the ./bootstrap.sh command:

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)

Next, I run ./configure which seems to work successfully. When I tried to put the output in my post, I ran out of characters, so in case it's needed, I put the entire output into a Google Doc.

Next I try running make which logs a bunch of errors. I think the culprit is probably this first error:

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

I don't know how to fix that error though. Just in case, here is the entire output of the make command:

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

And, although I doubt it's needed since I think the error is in make, one last output -- 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

I've tried Googling many of these errors, but I'm not skilled in C++, and I can't find any help.

What do I need to do to fix these errors?

Joshua Dwire
  • 5,272
  • 4
  • 28
  • 49

2 Answers2

10

I believe your'e experiencing the bug described here: https://issues.apache.org/jira/browse/THRIFT-1614.

You probably have automake-1.12 (which is what you'd get with brew install automake), which creates a thrifty.hh file rather than the included thrifty.h. The workaround given in the bug-report is to manually change the include in thriftl.cc to be thrifty.hh. You can also try downgrading automake, if you're using brew this should help.

Community
  • 1
  • 1
yonilevy
  • 5,002
  • 2
  • 25
  • 26
  • This works perfectly! I had installed automake from source. I ran `sudo make uninstall` on the source of the automake I had installed before. Then, I downloaded the source for version 1.11.6 and built and installed that. Then, thrift compiled and installed! Thanks so much for your help! – Joshua Dwire Nov 10 '12 at 02:05
0

This problem occurs because automake generates the file "thrifty.hh" rather than "thrifty.h". So there are 2 ways to resolve this problem.

1) Downgrade automake to 1.11.5, then it's fixed; 2) Edit the file "thriftl.cc", search and replace "thrifty.h" with "thrifty.hh", then compile it again.

sudoz
  • 2,241
  • 1
  • 17
  • 16