我正在尝试在 Debian 8 系统上安装 numba,如下所述:http://llvmlite.pydata.org/en/latest/install/index.html(第 2.2.3 节).
Im trying to install numba on a Debian 8 system as described here: http://llvmlite.pydata.org/en/latest/install/index.html (secion 2.2.3).
我已经安装了 LLVM 3.5,它似乎找到了它,但是在使用 setup.py 构建 llvmlite 时我不断收到错误:
I have installed LLVM 3.5 and it seems to find it but i keep getting errors when building llvmlite with setup.py:
# python setup.py build
这是完整的输出:
running build
got version from VCS {'version': '0.9.0.dev+7.gf5a7007.dirty', 'full': 'f5a70072ce0e7f5e432d6645056a60b00f957c66.dirty'}
running build_ext
/usr/bin/python ffi/build.py
LLVM version... 3.5.0
# static-libstdc++ avoids runtime dependencies on a
# particular libstdc++ version.
g++ -static-libstdc++ -shared -flto `llvm-config-3.5 --cxxflags` -fno-rtti -g assembly.cpp bitcode.cpp core.cpp initfini.cpp module.cpp value.cpp executionengine.cpp transforms.cpp passmanagers.cpp targets.cpp dylib.cpp linker.cpp -o libllvmlite.so -flto `llvm-config-3.5 --ldflags` -Wl,--exclude-libs=ALL `llvm-config-3.5 --system-libs --libs all`
assembly.cpp: In function ‘LLVMOpaqueModule* LLVMPY_ParseAssembly(LLVMContextRef, const char*, const char**)’:
assembly.cpp:25:64: error: ‘parseAssemblyString’ was not declared in this scope
Module *m = parseAssemblyString(ir, error, *unwrap(context)).release();
^
bitcode.cpp: In function ‘void LLVMPY_WriteBitcodeToString(LLVMModuleRef, const char**, size_t*)’:
bitcode.cpp:13:62: error: ‘LLVMWriteBitcodeToMemoryBuffer’ was not declared in this scope
LLVMMemoryBufferRef MB = LLVMWriteBitcodeToMemoryBuffer(M);
^
core.cpp: In function ‘void LLVMPY_SetCommandLine(const char*, const char*)’:
core.cpp:36:46: error: ‘LLVMParseCommandLineOptions’ was not declared in this scope
LLVMParseCommandLineOptions(2, argv, NULL);
^
module.cpp: In function ‘LLVMOpaqueModule* LLVMPY_CloneModule(LLVMModuleRef)’:
module.cpp:223:29: error: ‘LLVMCloneModule’ was not declared in this scope
return LLVMCloneModule(M);
^
executionengine.cpp: In function ‘LLVMOpaqueExecutionEngine* create_execution_engine(LLVMModuleRef, LLVMTargetMachineRef, char**)’:
executionengine.cpp:72:74: error: no matching function for call to ‘llvm::EngineBuilder::EngineBuilder(std::unique_ptr<llvm::Module>)’
llvm::EngineBuilder eb(std::unique_ptr<llvm::Module>(llvm::unwrap(M)));
^
executionengine.cpp:72:74: note: candidates are:
In file included from executionengine.cpp:6:0:
/usr/lib/llvm-3.5/include/llvm/ExecutionEngine/ExecutionEngine.h:594:3: note: llvm::EngineBuilder::EngineBuilder(llvm::Module*)
EngineBuilder(Module *m) : M(m) {
^
/usr/lib/llvm-3.5/include/llvm/ExecutionEngine/ExecutionEngine.h:594:3: note: no known conversion for argument 1 from ‘std::unique_ptr<llvm::Module>’ to ‘llvm::Module*’
/usr/lib/llvm-3.5/include/llvm/ExecutionEngine/ExecutionEngine.h:570:7: note: llvm::EngineBuilder::EngineBuilder(const llvm::EngineBuilder&)
class EngineBuilder {
^
/usr/lib/llvm-3.5/include/llvm/ExecutionEngine/ExecutionEngine.h:570:7: note: no known conversion for argument 1 from ‘std::unique_ptr<llvm::Module>’ to ‘const llvm::EngineBuilder&’
/usr/lib/llvm-3.5/include/llvm/ExecutionEngine/ExecutionEngine.h:570:7: note: llvm::EngineBuilder::EngineBuilder(llvm::EngineBuilder&&)
/usr/lib/llvm-3.5/include/llvm/ExecutionEngine/ExecutionEngine.h:570:7: note: no known conversion for argument 1 from ‘std::unique_ptr<llvm::Module>’ to ‘llvm::EngineBuilder&&’
executionengine.cpp: In function ‘uint64_t LLVMPY_GetGlobalValueAddress(LLVMExecutionEngineRef, const char*)’:
executionengine.cpp:107:46: error: ‘LLVMGetGlobalValueAddress’ was not declared in this scope
return LLVMGetGlobalValueAddress(EE, Name);
^
executionengine.cpp: In function ‘uint64_t LLVMPY_GetFunctionAddress(LLVMExecutionEngineRef, const char*)’:
executionengine.cpp:114:43: error: ‘LLVMGetFunctionAddress’ was not declared in this scope
return LLVMGetFunctionAddress(EE, Name);
^
executionengine.cpp: At global scope:
executionengine.cpp:187:45: error: ‘llvm::MemoryBufferRef’ has not been declared
llvm::MemoryBufferRef MBR)
^
executionengine.cpp:200:49: error: conflicting return type specified for ‘virtual std::unique_ptr<llvm::MemoryBuffer> LLVMPYObjectCache::getObject(const llvm::Module*)’
virtual std::unique_ptr<llvm::MemoryBuffer> getObject(const llvm::Module* M)
^
In file included from executionengine.cpp:8:0:
/usr/lib/llvm-3.5/include/llvm/ExecutionEngine/ObjectCache.h:36:25: error: overriding ‘virtual llvm::MemoryBuffer* llvm::ObjectCache::getObject(const llvm::Module*)’
virtual MemoryBuffer* getObject(const Module* M) = 0;
^
/usr/lib/llvm-3.5/include/llvm/ExecutionEngine/ObjectCache.h:30:16: warning: ‘virtual void llvm::ObjectCache::notifyObjectCompiled(const llvm::Module*, const llvm::MemoryBuffer*)’ was hidden [-Woverloaded-virtual]
virtual void notifyObjectCompiled(const Module *M, const MemoryBuffer *Obj) = 0;
^
executionengine.cpp:186:18: warning: by ‘virtual void LLVMPYObjectCache::notifyObjectCompiled(const llvm::Module*, int)’ [-Woverloaded-virtual]
virtual void notifyObjectCompiled(const llvm::Module *M,
^
executionengine.cpp: In member function ‘virtual void LLVMPYObjectCache::notifyObjectCompiled(const llvm::Module*, int)’:
executionengine.cpp:191:42: error: request for member ‘getBufferStart’ in ‘MBR’, which is of non-class type ‘int’
MBR.getBufferStart(),
^
executionengine.cpp:192:42: error: request for member ‘getBufferSize’ in ‘MBR’, which is of non-class type ‘int’
MBR.getBufferSize() };
^
executionengine.cpp: In member function ‘virtual std::unique_ptr<llvm::MemoryBuffer> LLVMPYObjectCache::getObject(const llvm::Module*)’:
executionengine.cpp:211:21: error: no match for ‘operator=’ (operand types are ‘std::unique_ptr<llvm::MemoryBuffer>’ and ‘llvm::MemoryBuffer*’)
res = llvm::MemoryBuffer::getMemBufferCopy(
^
executionengine.cpp:211:21: note: candidates are:
In file included from /usr/include/c++/4.9/memory:81:0,
from /usr/lib/llvm-3.5/include/llvm/ADT/SmallVector.h:28,
from /usr/lib/llvm-3.5/include/llvm/IR/DataLayout.h:24,
from /usr/lib/llvm-3.5/include/llvm/IR/Module.h:20,
from executionengine.cpp:5:
/usr/include/c++/4.9/bits/unique_ptr.h:249:7: note: std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Tp, _Dp>&&) [with _Tp = llvm::MemoryBuffer; _Dp = std::default_delete<llvm::MemoryBuffer>]
operator=(unique_ptr&& __u) noexcept
^
/usr/include/c++/4.9/bits/unique_ptr.h:249:7: note: no known conversion for argument 1 from ‘llvm::MemoryBuffer*’ to ‘std::unique_ptr<llvm::MemoryBuffer>&&’
/usr/include/c++/4.9/bits/unique_ptr.h:269:2: note: template<class _Up, class _Ep> typename std::enable_if<std::__and_<std::is_convertible<typename std::unique_ptr<_Up, _Ep>::pointer, typename std::unique_ptr<_Tp, _Dp>::_Pointer::type>, std::__not_<std::is_array<_Up> > >::value, std::unique_ptr<_Tp, _Dp>&>::type std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Up, _Ep>&&) [with _Up = _Up; _Ep = _Ep; _Tp = llvm::MemoryBuffer; _Dp = std::default_delete<llvm::MemoryBuffer>]
operator=(unique_ptr<_Up, _Ep>&& __u) noexcept
^
/usr/include/c++/4.9/bits/unique_ptr.h:269:2: note: template argument deduction/substitution failed:
executionengine.cpp:211:21: note: mismatched types ‘std::unique_ptr<_Tp, _Dp>’ and ‘llvm::MemoryBuffer*’
res = llvm::MemoryBuffer::getMemBufferCopy(
^
In file included from /usr/include/c++/4.9/memory:81:0,
from /usr/lib/llvm-3.5/include/llvm/ADT/SmallVector.h:28,
from /usr/lib/llvm-3.5/include/llvm/IR/DataLayout.h:24,
from /usr/lib/llvm-3.5/include/llvm/IR/Module.h:20,
from executionengine.cpp:5:
/usr/include/c++/4.9/bits/unique_ptr.h:278:7: note: std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::nullptr_t) [with _Tp = llvm::MemoryBuffer; _Dp = std::default_delete<llvm::MemoryBuffer>; std::nullptr_t = std::nullptr_t]
operator=(nullptr_t) noexcept
^
/usr/include/c++/4.9/bits/unique_ptr.h:278:7: note: no known conversion for argument 1 from ‘llvm::MemoryBuffer*’ to ‘std::nullptr_t’
executionengine.cpp: In function ‘LLVMPYObjectCache* LLVMPY_CreateObjectCache(ObjectCacheNotifyFunc, ObjectCacheGetObjectFunc, void*)’:
executionengine.cpp:233:72: error: invalid new-expression of abstract class type ‘LLVMPYObjectCache’
return new LLVMPYObjectCache(notify_func, getobject_func, user_data);
^
executionengine.cpp:176:7: note: because the following virtual functions are pure within ‘LLVMPYObjectCache’:
class LLVMPYObjectCache : public llvm::ObjectCache {
^
In file included from executionengine.cpp:8:0:
/usr/lib/llvm-3.5/include/llvm/ExecutionEngine/ObjectCache.h:30:16: note: virtual void llvm::ObjectCache::notifyObjectCompiled(const llvm::Module*, const llvm::MemoryBuffer*)
virtual void notifyObjectCompiled(const Module *M, const MemoryBuffer *Obj) = 0;
^
linker.cpp: In function ‘int LLVMPY_LinkModules(LLVMModuleRef, LLVMModuleRef, int, const char**)’:
linker.cpp:19:32: error: ‘DiagnosticInfo’ does not name a type
auto diagnose = [&] (const DiagnosticInfo &DI) {
^
linker.cpp:30:6: error: expected ‘)’ before ‘;’ token
};
^
linker.cpp: In lambda function:
linker.cpp:30:6: error: expected ‘{’ before ‘;’ token
linker.cpp: In function ‘int LLVMPY_LinkModules(LLVMModuleRef, LLVMModuleRef, int, const char**)’:
linker.cpp:32:34: error: ‘LLVMCloneModule’ was not declared in this scope
Src = LLVMCloneModule(Src);
^
linker.cpp:33:74: error: no matching function for call to ‘llvm::Linker::LinkModules(llvm::Module*, llvm::Module*, LLVMPY_LinkModules(LLVMModuleRef, LLVMModuleRef, int, const char**)::<lambda(int)>&)’
bool failed = Linker::LinkModules(unwrap(Dest), unwrap(Src), diagnose);
^
linker.cpp:33:74: note: candidate is:
In file included from linker.cpp:4:0:
/usr/lib/llvm-3.5/include/llvm/Linker/Linker.h:51:17: note: static bool llvm::Linker::LinkModules(llvm::Module*, llvm::Module*, unsigned int, std::string*)
static bool LinkModules(Module *Dest, Module *Src, unsigned Mode,
^
/usr/lib/llvm-3.5/include/llvm/Linker/Linker.h:51:17: note: candidate expects 4 arguments, 3 provided
Makefile.linux:17: recipe for target 'libllvmlite.so' failed
make: *** [libllvmlite.so] Error 1
Traceback (most recent call last):
File "ffi/build.py", line 114, in <module>
main()
File "ffi/build.py", line 104, in main
main_posix('linux', '.so')
File "ffi/build.py", line 96, in main_posix
subprocess.check_call(['make', '-f', makefile])
File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make', '-f', 'Makefile.linux']' returned non-zero exit status 2
error: command '/usr/bin/python' failed with exit status 1
谁能帮我弄清楚我错过了什么?
Can anybody help me figure out what i have missed?
[更新]
我通过使用 llvm 3.6 来修复它,方法是安装包 'llmv-3.6-dev' 并将 'ffi/Makefile.linux' 中的 'LLVM_CONFIG' 变量更改为 'llvm-config-3.6'.
I fixed it by using llvm 3.6 by installing the package llmv-3.6-dev and changing the LLVM_CONFIG variable in ffi/Makefile.linux to llvm-config-3.6.
但现在我收到以下错误:
But now i get the following error:
running build
got version from VCS {'version': '0.9.0.dev+7.gf5a7007.dirty', 'full': 'f5a70072ce0e7f5e432d6645056a60b00f957c66.dirty'}
running build_ext
/usr/bin/python ffi/build.py
LLVM version... 3.6.2
# static-libstdc++ avoids runtime dependencies on a
# particular libstdc++ version.
g++ -static-libstdc++ -shared -flto `llvm-config-3.6 --cxxflags` -fno-rtti -g assembly.cpp bitcode.cpp core.cpp initfini.cpp module.cpp value.cpp executionengine.cpp transforms.cpp passmanagers.cpp targets.cpp dylib.cpp linker.cpp -o libllvmlite.so -flto `llvm-config-3.6 --ldflags` -Wl,--exclude-libs=ALL `llvm-config-3.6 --system-libs --libs all`
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
Makefile.linux:17: recipe for target 'libllvmlite.so' failed
make: *** [libllvmlite.so] Error 1
Traceback (most recent call last):
File "ffi/build.py", line 114, in <module>
main()
File "ffi/build.py", line 104, in main
main_posix('linux', '.so')
File "ffi/build.py", line 96, in main_posix
subprocess.check_call(['make', '-f', makefile])
File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make', '-f', 'Makefile.linux']' returned non-zero exit status 2
error: command '/usr/bin/python' failed with exit status 1
我不确定该错误是什么意思,而且我的 google foo 不够强大,无法找到任何解决方案.有什么帮助吗?
I'm unsure what the error means and my google foo is not strong enough to find any kind of a solution. Any help?
要获得 llvm 3.6,您可以添加一个 /etc/apt/sources.list.d/llvm.list 文件:
To get llvm 3.6 you can add a /etc/apt/sources.list.d/llvm.list file with::
# cat /etc/apt/sources.list.d/llvm.list
deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie main
deb-src http://llvm.org/apt/jessie/ llvm-toolchain-jessie main
# 3.6
deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.6 main
deb-src http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.6 main
您也需要添加密钥::
# gpg --keyserver pgpkeys.mit.edu --recv-key 15CF4D18AF4F7421
# gpg -a --export 15CF4D18AF4F7421 | apt-key add -
apt-get 更新和安装 llvm-3.6::
apt-get update and install llvm-3.6::
apt-get update
apt-get install cython python-llvm build-essential libedit-dev
apt-get install llvm-3.6 llvm-3.6-dev llvm-dev
然后在你的 virtualenv::
Then on your virtualenv::
pip install enum34
LLVM_CONFIG=/usr/lib/llvm-3.6/bin/llvm-config pip install llvmlite
LLVM_CONFIG=/usr/lib/llvm-3.6/bin/llvm-config pip install numba
这篇关于Debian 8 上的 Python numba/llvmlite - 我无法构建 llvmlite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!