pyuni10v3 import failure
Summary
pyuni10v3 module builds and installs successfully. When import, however, missing symbol error terminates the import.
Steps to reproduce
At commit fd581c4f, v3_cytnx
branch; under the uni10
directory, issue the following command.
python setup.py sdist
pip install --upgrade dist/pyuni10-3.0.0.tar.gz
cd
python -c'import pyuni10'
What is the current bug behavior?
On Mac OS X Mojave, Apple clang version 11.0.0 (clang-1100.0.33.8), anaconda python 3.7:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/yjkao/anaconda3/lib/python3.7/site-packages/pyuni10/__init__.py", line 1, in <module>
from .pyuni10 import *
ImportError: dlopen(/Users/yjkao/anaconda3/lib/python3.7/site-packages/pyuni10/pyuni10.cpython-37m-darwin.so, 2): Symbol not found: __ZN5cytnx10vec_erase_IN5uni104BondEEEvRNSt3__16vectorIT_NS3_9allocatorIS5_EEEERKNS4_IyNS6_IyEEEE
Referenced from: /Users/yjkao/anaconda3/lib/python3.7/site-packages/pyuni10/pyuni10.cpython-37m-darwin.so
Expected in: flat namespace
in /Users/yjkao/anaconda3/lib/python3.7/site-packages/pyuni10/pyuni10.cpython-37m-darwin.so
What is the expected correct behavior?
No import error
Possible fixes
Inspection of pyuni10.cpython-37m-darwin.so
, I found several unresolved symbols related to cytnx::vec_*
function templates
$ nm -u /Users/yjkao/anaconda3/lib/python3.7/site-packages/pyuni10/pyuni10.cpython-37m-darwin.so | grep vec_
__ZN5cytnx10vec_erase_IN5uni104BondEEEvRNSt3__16vectorIT_NS3_9allocatorIS5_EEEERKNS4_IyNS6_IyEEEE
__ZN5cytnx7vec_mapIN5uni104BondEEENSt3__16vectorIT_NS3_9allocatorIS5_EEEERKS8_RKNS4_IyNS6_IyEEEE
__ZN5cytnx9vec_cloneIN5uni104BondEEENSt3__16vectorIT_NS3_9allocatorIS5_EEEERKS8_
__ZN5cytnx9vec_cloneIN5uni104BondEEENSt3__16vectorIT_NS3_9allocatorIS5_EEEERKS8_RKy
__ZN5cytnx9vec_cloneIN5uni104BondEEENSt3__16vectorIT_NS3_9allocatorIS5_EEEERKS8_RKySC_
__ZN5cytnx9vec_cloneIN5uni108SymmetryEEENSt3__16vectorIT_NS3_9allocatorIS5_EEEERKS8_
c++filt
dismantles these to the following calling signatures
$ nm -u /Users/yjkao/anaconda3/lib/python3.7/site-packages/pyuni10/pyuni10.cpython-37m-darwin.so | grep vec_ |c++filt
void cytnx::vec_erase_<uni10::Bond>(std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> >&, std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> > const&)
std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > cytnx::vec_map<uni10::Bond>(std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > const&, std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> > const&)
std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > cytnx::vec_clone<uni10::Bond>(std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > const&)
std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > cytnx::vec_clone<uni10::Bond>(std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > const&, unsigned long long const&)
std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > cytnx::vec_clone<uni10::Bond>(std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > const&, unsigned long long const&, unsigned long long const&)
std::__1::vector<uni10::Symmetry, std::__1::allocator<uni10::Symmetry> > cytnx::vec_clone<uni10::Symmetry>(std::__1::vector<uni10::Symmetry, std::__1::allocator<uni10::Symmetry> > const&)
Incidentally, these symbols are also not resolved in libuni10.a
$ nm -u libuni10.a | grep "vec_" | c++filt
std::__1::vector<uni10::Symmetry, std::__1::allocator<uni10::Symmetry> > cytnx::vec_clone<uni10::Symmetry>(std::__1::vector<uni10::Symmetry, std::__1::allocator<uni10::Symmetry> > const&)
void cytnx::vec_erase_<uni10::Bond>(std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> >&, std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> > const&)
void cytnx::vec_erase_<long long>(std::__1::vector<long long, std::__1::allocator<long long> >&, std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> > const&)
void cytnx::vec_erase_<unsigned long long>(std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> >&, std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> > const&)
std::__1::vector<long long, std::__1::allocator<long long> > cytnx::vec_unique<long long>(std::__1::vector<long long, std::__1::allocator<long long> > const&)
void cytnx::vec_intersect_<long long>(std::__1::vector<long long, std::__1::allocator<long long> >&, std::__1::vector<long long, std::__1::allocator<long long> > const&, std::__1::vector<long long, std::__1::allocator<long long> > const&, std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> >&, std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> >&)
void cytnx::vec_concatenate_<long long>(std::__1::vector<long long, std::__1::allocator<long long> >&, std::__1::vector<long long, std::__1::allocator<long long> > const&, std::__1::vector<long long, std::__1::allocator<long long> > const&)
void cytnx::vec_concatenate_<unsigned long long>(std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> >&, std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> > const&, std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> > const&)
std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > cytnx::vec_map<uni10::Bond>(std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > const&, std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> > const&)
std::__1::vector<long long, std::__1::allocator<long long> > cytnx::vec_map<long long>(std::__1::vector<long long, std::__1::allocator<long long> > const&, std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> > const&)
std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > cytnx::vec_clone<uni10::Bond>(std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > const&)
std::__1::vector<uni10::Symmetry, std::__1::allocator<uni10::Symmetry> > cytnx::vec_clone<uni10::Symmetry>(std::__1::vector<uni10::Symmetry, std::__1::allocator<uni10::Symmetry> > const&)
std::__1::vector<long long, std::__1::allocator<long long> > cytnx::vec_clone<long long>(std::__1::vector<long long, std::__1::allocator<long long> > const&, std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> > const&)
std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> > cytnx::vec_erase<unsigned long long>(std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> > const&, std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> > const&)
cytnx::vec_range(unsigned long long const&)
cytnx::vec_range(unsigned long long const&, unsigned long long const&)
std::__1::vector<long long, std::__1::allocator<long long> > cytnx::vec_range<long long>(long long const&)
unsigned long long cytnx::vec_where<long long>(std::__1::vector<long long, std::__1::allocator<long long> > const&, long long const&)
std::__1::vector<long long, std::__1::allocator<long long> > cytnx::vec_unique<long long>(std::__1::vector<long long, std::__1::allocator<long long> > const&)
std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > cytnx::vec_map<uni10::Bond>(std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > const&, std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> > const&)
std::__1::vector<long long, std::__1::allocator<long long> > cytnx::vec_map<long long>(std::__1::vector<long long, std::__1::allocator<long long> > const&, std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> > const&)
std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > cytnx::vec_clone<uni10::Bond>(std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > const&)
std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > cytnx::vec_clone<uni10::Bond>(std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > const&, unsigned long long const&)
std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > cytnx::vec_clone<uni10::Bond>(std::__1::vector<uni10::Bond, std::__1::allocator<uni10::Bond> > const&, unsigned long long const&, unsigned long long const&)
std::__1::vector<cytnx::Tensor, std::__1::allocator<cytnx::Tensor> > cytnx::vec_clone<cytnx::Tensor>(std::__1::vector<cytnx::Tensor, std::__1::allocator<cytnx::Tensor> > const&)
cytnx::vec_range(unsigned long long const&)
std::__1::vector<long long, std::__1::allocator<long long> > cytnx::vec_unique<long long>(std::__1::vector<long long, std::__1::allocator<long long> > const&)
Since cytnx::vec_*
are instantiated in cytnx
module, these function templates are instantiated with uni10 types Bond
, Symmetry
but somehow no objects are produced. This might be the source of the bug.