Why does building Apache Thrift fail with "error: cannot find the library"?

Why does building Apache Thrift fail with "error: cannot find the library"?

尝试构建 Apache Thrift on Fedora 23 from the source in the official git repository 失败并显示 "cannot find the library... or unhandled argument" 错误消息:

...
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
...

但是文件 libthrift.la 已构建并存在于文件系统中。使用 --without-tests 选项重新 运行 configure 没有帮助。如何正确构建 Thrift?

这是由于libtool的限制:它不能正确处理路径名中的白色space。此处您已将源代码放在 "Apache Thrift" 的子文件夹中,通过仔细阅读上面粘贴的输出,您可以看到文件夹名称在它包含的 space 处被错误地破坏了。

最简单的解决方案是重命名此文件夹以删除space。之后,您需要 运行

make distclean
./bootstrap.sh

确保在重新 运行 之前更新所有必要的文件 make