我正在尝试安装fblualib并面对这个问题我无法找到解决方法。
我发出以下命令:
git clone https://github.com/facebook/fblualib.git
cd fblualib/fblualib/python
luarocks make rockspec/*
并有以下输出:非常感谢任何帮助,因为我真的陷入了这个错误。
cmake -E make_directory build &&
cd build &&
cmake -DROCKS_PREFIX=/home/ubuntu/usr/local/torch/install/lib/luarocks/rocks/fbpython/0.1-1 \
-DROCKS_LUADIR=/home/ubuntu/usr/local/torch/install/lib/luarocks/rocks/fbpython/0.1-1/lua \
-DROCKS_LIBDIR=/home/ubuntu/usr/local/torch/install/lib/luarocks/rocks/fbpython/0.1-1/lib \
.. &&
make
-- Found Torch7 in /home/ubuntu/usr/local/torch/install
-- Boost version: 1.58.0
-- Found the following Boost libraries:
-- thread
-- chrono
-- system
-- date_time
-- atomic
-- Found PythonInterp: /usr/local/bin/python2.7 (found suitable version "2.7.14", minimum required is "2.7")
-- Found PythonInterp: /usr/local/bin/python2.7 (found version "2.7.14")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/usr/src/fblualib/fblualib/python/build
[ 11%] Linking CXX shared module lib.so
/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
CMakeFiles/lua_module.dir/build.make:283: recipe for target 'lib.so' failed
make[2]: *** [lib.so] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/lua_module.dir/all' failed
make[1]: *** [CMakeFiles/lua_module.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
所以基本上我发现了这个问题,它是通过在python编译期间添加--enable-shared
来解决的。所以我再次重新编译了python并且它工作了。希望它能帮助他人并防止他们同时花钱。