Why does building Apache Thrift fail with “error:

2019-09-21 16:01发布

问题:

Trying to build Apache Thrift on Fedora 23 from the source in the official git repository fails with a "cannot find the library... or unhandled argument" error message:

...
make[5]: Entering directory '/home/ssouth/Source/Apache Thrift/git-wip-us.apache.org/repos/asf/thrift/lib/cpp/test'
/bin/sh ../../../libtool  --tag=CXX   --mode=link g++ -Wall -Wextra -pedantic -g -O2 -std=c++11 -L/usr/lib64  -o Benchmark Benchmark.o libtestgencpp.la -lssl -lcrypto -lrt -lpthread 
libtool:   error: cannot find the library 'Thrift/git-wip-us.apache.org/repos/asf/thrift/lib/cpp/libthrift.la' or unhandled argument 'Thrift/git-wip-us.apache.org/repos/asf/thrift/lib/cpp/libthrift.la'
Makefile:1049: recipe for target 'Benchmark' failed
make[5]: *** [Benchmark] Error 1
make[5]: Leaving directory '/home/ssouth/Source/Apache Thrift/git-wip-us.apache.org/repos/asf/thrift/lib/cpp/test'
Makefile:947: recipe for target 'all' failed
...

But the file libthrift.la is built and present on the filesystem. Re-running configure with the --without-tests option doesn't help. How can I make Thrift build correctly?

回答1:

This is due to a limitation of libtool: It does not correctly handle whitespace in path names. Here you've placed the source code in a subfolder of "Apache Thrift", and by reading carefully the output pasted above you can see the folder name is being incorrectly broken at the space it contains.

The easiest solution is to rename this folder to remove the space. Afterwards, you'll need to run

make distclean
./bootstrap.sh

to make sure all the necessary files are updated before re-running make.