/usr/bin/ld: 找不到 -l-L/usr/lib
/usr/bin/ld: cannot find -l-L/usr/lib
我在 ubuntu 16.04
上尝试编译 fbthrift (https://github.com/facebook/fbthrift) 时遇到了一个奇怪的错误
make[4]: Entering directory '/home/abhishek/fblualib/fbthrift/thrift/compiler/py'
/bin/bash ../../libtool --tag=CXX --mode=link g++ -std=gnu++1y -module -avoid-version -no-undefined -l -L/usr/lib -lpython2.7 -lfolly -L/usr/local/lib -o frontend.la -rpath /usr/local/lib frontend_la-compiler.lo ../libparse.la ../libthriftcompilerbase.la -lssl -lcrypto -lrt -lpthread -lsasl2 -lmstch -lwangle -lsnappy -lgflags -lglog
libtool: link: g++ -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbeginS.o .libs/frontend_la-compiler.o -Wl,--whole-archive ../.libs/libparse.a ../.libs/libthriftcompilerbase.a -Wl,--no-whole-archive -l -L/usr/lib -lpython2.7 /usr/local/lib/libfolly.so -L/usr/local/lib -lssl -lcrypto -lrt -lpthread -lsasl2 -lmstch -lwangle -lsnappy -lgflags -lglog -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/5/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o -Wl,-soname -Wl,frontend.so -o .libs/frontend.so
/usr/bin/ld: cannot find -l-L/usr/lib
collect2: error: ld returned 1 exit status
Makefile:500: recipe for target 'frontend.la' failed
make[4]: *** [frontend.la] Error 1
make[4]: Leaving directory '/home/abhishek/fblualib/fbthrift/thrift/compiler/py'
Makefile:882: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/abhishek/fblualib/fbthrift/thrift/compiler'
Makefile:591: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/home/abhishek/fblualib/fbthrift/thrift/compiler'
Makefile:498: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/abhishek/fblualib/fbthrift/thrift'
Makefile:430: recipe for target 'all' failed
make: *** [all] Error 2
为什么找不到 /usr/lib?
makefile 正在生成一个 link 命令,内容如下:
... -l -L/usr/lib ...
makefile 中的 link 命令很可能在此处指定为 -l$(SOMEVARIABLE)
,并且由于某种原因未设置变量,因此它被扩展为空字符串。
因此,这被解释为 link 的指令,共享库的名称是“-L/usr/lib”,当然,这完全是伪造的。
遗憾的是,没有可以按下的通用魔术按钮,并修复此错误。有必要调查在这个包的配置 and/or 构建过程中发生了什么问题,并修复它。
我在 ubuntu 16.04
上尝试编译 fbthrift (https://github.com/facebook/fbthrift) 时遇到了一个奇怪的错误make[4]: Entering directory '/home/abhishek/fblualib/fbthrift/thrift/compiler/py'
/bin/bash ../../libtool --tag=CXX --mode=link g++ -std=gnu++1y -module -avoid-version -no-undefined -l -L/usr/lib -lpython2.7 -lfolly -L/usr/local/lib -o frontend.la -rpath /usr/local/lib frontend_la-compiler.lo ../libparse.la ../libthriftcompilerbase.la -lssl -lcrypto -lrt -lpthread -lsasl2 -lmstch -lwangle -lsnappy -lgflags -lglog
libtool: link: g++ -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbeginS.o .libs/frontend_la-compiler.o -Wl,--whole-archive ../.libs/libparse.a ../.libs/libthriftcompilerbase.a -Wl,--no-whole-archive -l -L/usr/lib -lpython2.7 /usr/local/lib/libfolly.so -L/usr/local/lib -lssl -lcrypto -lrt -lpthread -lsasl2 -lmstch -lwangle -lsnappy -lgflags -lglog -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/5/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o -Wl,-soname -Wl,frontend.so -o .libs/frontend.so
/usr/bin/ld: cannot find -l-L/usr/lib
collect2: error: ld returned 1 exit status
Makefile:500: recipe for target 'frontend.la' failed
make[4]: *** [frontend.la] Error 1
make[4]: Leaving directory '/home/abhishek/fblualib/fbthrift/thrift/compiler/py'
Makefile:882: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/abhishek/fblualib/fbthrift/thrift/compiler'
Makefile:591: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/home/abhishek/fblualib/fbthrift/thrift/compiler'
Makefile:498: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/abhishek/fblualib/fbthrift/thrift'
Makefile:430: recipe for target 'all' failed
make: *** [all] Error 2
为什么找不到 /usr/lib?
makefile 正在生成一个 link 命令,内容如下:
... -l -L/usr/lib ...
makefile 中的 link 命令很可能在此处指定为 -l$(SOMEVARIABLE)
,并且由于某种原因未设置变量,因此它被扩展为空字符串。
因此,这被解释为 link 的指令,共享库的名称是“-L/usr/lib”,当然,这完全是伪造的。
遗憾的是,没有可以按下的通用魔术按钮,并修复此错误。有必要调查在这个包的配置 and/or 构建过程中发生了什么问题,并修复它。