diffsim icon indicating copy to clipboard operation
diffsim copied to clipboard

Undefined symbol in arcsim.cpython-36m-x86_64-linux-gnu.so

Open CWEzio opened this issue 1 year ago • 1 comments

After installing, I got the following error when I try to import arcsim:

ImportError: /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/arcsim-0.0.0-py3.6-linux-x86_64.egg/arcsim.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe26detail37_typeMetaDataInstance_preallocated_14E

By using

echo _ZN6caffe26detail37_typeMetaDataInstance_preallocated_14E | c++filt

I find the undefined symbol is

caffe2::detail::_typeMetaDataInstance_preallocated_14

It seems that the linked pytorch lib has some problem. I installed torch==1.3.0 with pip install torch==1.3.0 as in the instruction. I find this issue persists in both Ubuntu18.04 and 20.04.

CWEzio avatar Aug 08 '23 05:08 CWEzio

I get the following when rerun make in the root directory:

rm -rf ./build
python setup.py install --force
running install
running bdist_egg
running egg_info
writing arcsim.egg-info/PKG-INFO
writing dependency_links to arcsim.egg-info/dependency_links.txt
writing requirements to arcsim.egg-info/requires.txt
writing top-level names to arcsim.egg-info/top_level.txt
reading manifest file 'arcsim.egg-info/SOURCES.txt'
writing manifest file 'arcsim.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
building 'arcsim' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/pybind
gcc -pthread -B /home/chenwang/anaconda3/envs/diffsim/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./arcsim/src/ -I./arcsim/dependencies/include -I/home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include -I/home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/TH -I/home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/THC -I/home/chenwang/anaconda3/envs/diffsim/include/python3.6m -c pybind/bind.cpp -o build/temp.linux-x86_64-3.6/pybind/bind.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=arcsim -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from ./arcsim/src/spline.hpp:30,
                 from ./arcsim/src/transformation.hpp:30,
                 from ./arcsim/src/mesh.hpp:30,
                 from ./arcsim/src/util.hpp:31,
                 from ./arcsim/src/dde.hpp:30,
                 from ./arcsim/src/cloth.hpp:30,
                 from ./arcsim/src/simulation.hpp:30,
                 from ./arcsim/src/collision.hpp:30,
                 from pybind/bind.cpp:4:
./arcsim/src/vectors.hpp:50: warning: "INFINITY" redefined
   50 | #define  INFINITY (std::numeric_limits<double>::infinity()*ONE)
      | 
In file included from /usr/include/c++/9/cmath:45,
                 from /usr/include/c++/9/math.h:36,
                 from /home/chenwang/anaconda3/envs/diffsim/include/python3.6m/pyport.h:194,
                 from /home/chenwang/anaconda3/envs/diffsim/include/python3.6m/Python.h:53,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/pybind11/detail/common.h:112,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/pybind11/pytypes.h:12,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/pybind11/cast.h:13,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/pybind11/attr.h:13,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/pybind11/pybind11.h:44,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/pybind11/stl.h:12,
                 from pybind/bind.cpp:2:
/usr/include/math.h:91: note: this is the location of the previous definition
   91 | #  define INFINITY (__builtin_inff ())
      | 
In file included from ./arcsim/src/util.hpp:31,
                 from ./arcsim/src/dde.hpp:30,
                 from ./arcsim/src/cloth.hpp:30,
                 from ./arcsim/src/simulation.hpp:30,
                 from ./arcsim/src/collision.hpp:30,
                 from pybind/bind.cpp:4:
./arcsim/src/mesh.hpp: In constructor ‘Edge::Edge(Node*, Node*, at::Tensor, int)’:
./arcsim/src/mesh.hpp:109:12: warning: ‘Edge::reference_angle’ will be initialized after [-Wreorder]
  109 |     Tensor reference_angle; // just to get sign of dihedral_angle() right
      |            ^~~~~~~~~~~~~~~
./arcsim/src/mesh.hpp:106:12: warning:   ‘at::Tensor Edge::l’ [-Wreorder]
  106 |     Tensor l, ldaa, bias_angle; // length
      |            ^
./arcsim/src/mesh.hpp:112:14: warning:   when initialized here [-Wreorder]
  112 |     explicit Edge (Node *node0, Node *node1, Tensor theta_ideal, int label=0):
      |              ^~~~
./arcsim/src/mesh.hpp: In constructor ‘Edge::Edge(Node*, Node*, int)’:
./arcsim/src/mesh.hpp:109:12: warning: ‘Edge::reference_angle’ will be initialized after [-Wreorder]
  109 |     Tensor reference_angle; // just to get sign of dihedral_angle() right
      |            ^~~~~~~~~~~~~~~
./arcsim/src/mesh.hpp:106:12: warning:   ‘at::Tensor Edge::l’ [-Wreorder]
  106 |     Tensor l, ldaa, bias_angle; // length
      |            ^
./arcsim/src/mesh.hpp:119:14: warning:   when initialized here [-Wreorder]
  119 |     explicit Edge (Node *node0, Node *node1, int label=0):
      |              ^~~~
./arcsim/src/mesh.hpp: In constructor ‘Face::Face(Vert*, Vert*, Vert*, int)’:
./arcsim/src/mesh.hpp:140:12: warning: ‘Face::damage’ will be initialized after [-Wreorder]
  140 |     Tensor damage; // accumulated norm of S_plastic/S_yield
      |            ^~~~~~
./arcsim/src/mesh.hpp:136:12: warning:   ‘at::Tensor Face::a’ [-Wreorder]
  136 |     Tensor a, m; // area, mass
      |            ^
./arcsim/src/mesh.hpp:143:14: warning:   when initialized here [-Wreorder]
  143 |     explicit Face (Vert *vert0, Vert *vert1, Vert *vert2, int label=0):
      |              ^~~~
In file included from ./arcsim/src/dde.hpp:30,
                 from ./arcsim/src/cloth.hpp:30,
                 from ./arcsim/src/simulation.hpp:30,
                 from ./arcsim/src/collision.hpp:30,
                 from pybind/bind.cpp:4:
./arcsim/src/util.hpp: In function ‘int find(const T*, T* const*, int)’:
./arcsim/src/util.hpp:74:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
   74 |     for (int i = 0; i < n; i++) if (xs[i] == x) return i; return -1;}
      |     ^~~
./arcsim/src/util.hpp:74:59: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
   74 |     for (int i = 0; i < n; i++) if (xs[i] == x) return i; return -1;}
      |                                                           ^~~~~~
./arcsim/src/util.hpp: In function ‘int find(const T&, const T*, int)’:
./arcsim/src/util.hpp:77:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
   77 |     for (int i = 0; i < n; i++) if (xs[i] == x) return i; return -1;}
      |     ^~~
./arcsim/src/util.hpp:77:59: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
   77 |     for (int i = 0; i < n; i++) if (xs[i] == x) return i; return -1;}
      |                                                           ^~~~~~
./arcsim/src/util.hpp: In function ‘int find(const T&, const std::vector<T>&)’:
./arcsim/src/util.hpp:80:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
   80 |     for (int i = 0; i < xs.size(); i++) if (xs[i] == x) return i; return -1;}
      |     ^~~
./arcsim/src/util.hpp:80:67: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
   80 |     for (int i = 0; i < xs.size(); i++) if (xs[i] == x) return i; return -1;}
      |                                                                   ^~~~~~
In file included from pybind/bind.cpp:6:
./arcsim/src/separateobs.hpp: In constructor ‘SO::Ixn::Ixn(const Face*, const at::Tensor&, const Face*, const at::Tensor&, const at::Tensor&)’:
./arcsim/src/separateobs.hpp:39:12: warning: ‘SO::Ixn::b0’ will be initialized after [-Wreorder]
   39 |     Tensor b0, b1;
      |            ^~
./arcsim/src/separateobs.hpp:38:16: warning:   ‘Face* SO::Ixn::f1’ [-Wreorder]
   38 |     Face *f0, *f1;
      |                ^~
./arcsim/src/separateobs.hpp:42:5: warning:   when initialized here [-Wreorder]
   42 |     Ixn (const Face *f0, const Tensor &b0, const Face *f1, const Tensor &b1,
      |     ^~~
pybind/bind.cpp: In function ‘std::vector<double> tovec(at::Tensor)’:
pybind/bind.cpp:18:65: warning: ‘T* at::Tensor::data() const [with T = double]’ is deprecated [-Wdeprecated-declarations]
   18 | std::vector<double> tovec(Tensor a) {double *p = a.data<double>();return vector<double>(p,p+3);}
      |                                                                 ^
In file included from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/ATen/Tensor.h:11,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/ATen/Context.h:4,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/ATen/ATen.h:5,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/extension.h:4,
                 from pybind/bind.cpp:3:
/home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/ATen/core/TensorBody.h:303:7: note: declared here
  303 |   T * data() const {
      |       ^~~~
pybind/bind.cpp: In function ‘void test()’:
pybind/bind.cpp:56:35: warning: ‘T* at::Tensor::data() const [with T = double]’ is deprecated [-Wdeprecated-declarations]
   56 |  double *d = a.cpu().data<double>();
      |                                   ^
In file included from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/ATen/Tensor.h:11,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/ATen/Context.h:4,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/ATen/ATen.h:5,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/torch/extension.h:4,
                 from pybind/bind.cpp:3:
/home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/torch/include/ATen/core/TensorBody.h:303:7: note: declared here
  303 |   T * data() const {
      |       ^~~~
creating build/lib.linux-x86_64-3.6
g++ -pthread -shared -B /home/chenwang/anaconda3/envs/diffsim/compiler_compat -L/home/chenwang/anaconda3/envs/diffsim/lib -Wl,-rpath=/home/chenwang/anaconda3/envs/diffsim/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/pybind/bind.o -Lobjs -L./arcsim/dependencies/lib -lmake_pytorch -ljson -ltaucs -lalglib -lpng -lz -llapack -lblas -lboost_system -lboost_filesystem -lboost_thread -lgomp -lglut -lGLU -lGL -o build/lib.linux-x86_64-3.6/arcsim.cpython-36m-x86_64-linux-gnu.so
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-3.6/arcsim.cpython-36m-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/egg
creating stub loader for arcsim.cpython-36m-x86_64-linux-gnu.so
byte-compiling build/bdist.linux-x86_64/egg/arcsim.py to arcsim.cpython-36.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying arcsim.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying arcsim.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying arcsim.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying arcsim.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
copying arcsim.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying arcsim.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
creating 'dist/arcsim-0.0.0-py3.6-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing arcsim-0.0.0-py3.6-linux-x86_64.egg
creating /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/arcsim-0.0.0-py3.6-linux-x86_64.egg
Extracting arcsim-0.0.0-py3.6-linux-x86_64.egg to /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages
Adding arcsim 0.0.0 to easy-install.pth file

Installed /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages/arcsim-0.0.0-py3.6-linux-x86_64.egg
Processing dependencies for arcsim==0.0.0
Searching for torch==1.3.1
Best match: torch 1.3.1
Adding torch 1.3.1 to easy-install.pth file
Installing convert-caffe2-to-onnx script to /home/chenwang/anaconda3/envs/diffsim/bin
Installing convert-onnx-to-caffe2 script to /home/chenwang/anaconda3/envs/diffsim/bin

Using /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages
Searching for numpy==1.19.5
Best match: numpy 1.19.5
Adding numpy 1.19.5 to easy-install.pth file
Installing f2py script to /home/chenwang/anaconda3/envs/diffsim/bin
Installing f2py3 script to /home/chenwang/anaconda3/envs/diffsim/bin
Installing f2py3.6 script to /home/chenwang/anaconda3/envs/diffsim/bin

Using /home/chenwang/anaconda3/envs/diffsim/lib/python3.6/site-packages
Finished processing dependencies for arcsim==0.0.0              

Everything seems to work fine. Any idea about how to deal with this problem? Thank you for your help!

CWEzio avatar Aug 08 '23 05:08 CWEzio