libtool error building thrift 0.9.1 on Ubuntu 13.0

2020-06-08 06:50发布

Building thrift 0.9.1 (support C, C++, java, C#, perl, python) on Ubuntu 13.04 I am getting this error.

./configure run without any options, make run without any options...

Making all in test
make[2]: Entering directory `/home/dvb/sw/thrift-0.9.1/test'
Making all in nodejs
make[3]: Entering directory `/home/dvb/sw/thrift-0.9.1/test/nodejs'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/dvb/sw/thrift-0.9.1/test/nodejs'
Making all in cpp
make[3]: Entering directory `/home/dvb/sw/thrift-0.9.1/test/cpp'
Makefile:832: warning: overriding commands for target `gen-cpp/ThriftTest.cpp'
Makefile:829: warning: ignoring old commands for target `gen-cpp/ThriftTest.cpp'
/bin/bash ../../libtool --tag=CXX   --mode=link g++ -Wall -g -O2 -L/usr/lib   -o libtestgencpp.la  ThriftTest_constants.lo ThriftTest_types.lo ../../lib/cpp/libthrift.la -lssl -lcrypto -lrt -lpthread 
libtool: link: ar cru .libs/libtestgencpp.a .libs/ThriftTest_constants.o .libs/ThriftTest_types.o 
ar: .libs/ThriftTest_constants.o: No such file or directory
make[3]: *** [libtestgencpp.la] Error 1
make[3]: Leaving directory `/home/dvb/sw/thrift-0.9.1/test/cpp'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/dvb/sw/thrift-0.9.1/test'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/dvb/sw/thrift-0.9.1'
make: *** [all] Error 2
dvb@dvb-u13:~/sw/thrift-0.9.1$ 

6条回答
霸刀☆藐视天下
2楼-- · 2020-06-08 07:08

While this seems to be a defect in the 0.9.1 release tarball, it is not a problem in the top of tree pulled via git as of this afternoon.

The solution if one encounters this problem is to use a newer version of thrift by getting the source tree directly via git instead of downloading the tarball. The only difference in build is you will need to run bootstrap.sh before configure. This is well documented.

Note two additional helpful bits of data: 1. Configure to build --without-tests (Mike Johnson below - thanks) 2. This issue is fixed in 0.9.2 release (Luke below- thanks!)

查看更多
祖国的老花朵
3楼-- · 2020-06-08 07:10

I ran into this problem tonight and "fixed" it. The problem is that ar(1) can't find the .o files in the directory test/cpp/.libs. I'm sure that there's some missing magic in the Makefile.am in test/cpp, but I've neither the patience or automake-fu to fix that.

Instead, I just symlinked the .o files from test/cpp to test/cpp/.libs/. That fixes the build of the C++ tests.

cd thrift-0.9.1/test/cpp/.libs
for i in ../*.o; do echo $i; ln -s $i .; done
查看更多
叛逆
4楼-- · 2020-06-08 07:16

David V is right that 0.9.1 is broken but 0.9.2 works. The build instructions seem to be a broken link as well. So here are the commands that worked for me, from a fresh Ubuntu install:

# Install java if you don't have it
sudo apt-get install default-jre
# install build dependencies
sudo apt-get install libboost-dev libboost-test-dev libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev 
cd /tmp 
curl http://archive.apache.org/dist/thrift/0.9.2/thrift-0.9.2.tar.gz | tar zx 
cd thrift-0.9.2/ 
./configure 
make 
sudo make install 
#test that it can run
thrift --help 

(credit goes to these helpful instructions; I just replaced 0.9.1 with 0.9.2)

查看更多
够拽才男人
5楼-- · 2020-06-08 07:18

I happened to face this problem. You can try cp all test/cpp/*.o to .libs folder.

Or you can skip compiling tests.

cp test/cpp/*.o test/cpp/.libs/
查看更多
Rolldiameter
6楼-- · 2020-06-08 07:29

You can also try this:

./configure 
(cd test/cpp; ln -s . .libs)
make install

This will simply link .libs back to test/cpp. "ar" will find the files there.

查看更多
姐就是有狂的资本
7楼-- · 2020-06-08 07:33

Thrift was since released with this compile problem. You can choose to skip compiling tests, instead:

./configure --without-tests
查看更多
登录 后发表回答