Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python interface doesn't work #15

Open
cslxiao opened this issue Oct 25, 2018 · 9 comments
Open

python interface doesn't work #15

cslxiao opened this issue Oct 25, 2018 · 9 comments

Comments

@cslxiao
Copy link

cslxiao commented Oct 25, 2018

I build python interface and generate libcp.so following the guide, but it cannot be imported in python:

import libcp
malloc(): memory corruption
Aborted (core dumped)

version information:
python: 3.6
boost: 1.65
os: ubuntu 18.04
g++: 6.4

@loicland
Copy link
Owner

Hi,

can you try to run the troubleshooting section in the README of this repo?

@cslxiao
Copy link
Author

cslxiao commented Oct 26, 2018

I didn't use conda to install boost and eigen. Instead, I use the library in the system path and cmake find them well.

cmake .
-- The C compiler identification is GNU 6.4.0
-- The CXX compiler identification is GNU 6.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- graph
-- numpy
-- python
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.6m.so (found version "3.6.6")
PYTHON LIBRARIES ARE /usr/lib/x86_64-linux-gnu/libpython3.6m.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/XXX/superpoint_graph/partition/cut-pursuit/src

@XBingQian
Copy link

XBingQian commented Oct 27, 2018

Hello, I have met a same problem.
The cmake and make progress works well with log as follows:
------------ply_c-------------
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Boost version: 1.67.0
-- Found the following Boost libraries:
-- python
-- numpy
Boost includes ARE /usr/local/include
Boost LIBRARIES ARE /usr/lib
-- Found PythonLibs: /home/xbq/anaconda2/envs/py3/lib/libpython3.6m.so (found version "3.6.6")
PYTHON LIBRARIES ARE /home/xbq/anaconda2/envs/py3/lib/libpython3.6m.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xbq/git/superpoint_graph/partition/ply_c
-------------cut-pursuit--------------
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Boost version: 1.67.0
-- Found the following Boost libraries:
-- graph
-- numpy
-- Found PythonLibs: /home/xbq/anaconda2/envs/py3/lib/libpython3.6m.so (found version "3.6.6")
PYTHON LIBRARIES ARE /home/xbq/anaconda2/envs/py3/lib/libpython3.6m.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xbq/git/superpoint_graph/partition/cut-pursuit/src

The libply_c.so and libcp.so files were successfully generated.
But, when I try to run the partition module in superpoint_graph with partition.py, there are errors in"import libcp"(1) and "import libply_c"(2). And the out message are seperately:
(1) ImportError: ./partition/cut-pursuit/src/libcp.so: undefined symbol: _ZTIN5boost6python7objects21py_function_impl_baseE
(2) ImportError: /usr/lib/libboost_python.so.1.66.0: undefined symbol: PyClass_Type
There are anaconda2 and anaconda3 in my PC environment. And I have change it to python3.6 while compile the module.
Could you help to find where the problem is? Thanks.

@loicland
Copy link
Owner

loicland commented Oct 27, 2018

Hi,

There are many issues on this subject on the superpoint graph repo. Check out thr followings to see if that helps you:
loicland/superpoint_graph#59

loicland/superpoint_graph#56

loicland/superpoint_graph#13

Let me know if you're still stuck after that.

Also im noticing in your build files that you have a mix of anaconda2 and pupython3.6. What value did you give to $CONDAENV?

@cslxiao
Copy link
Author

cslxiao commented Oct 30, 2018

still not work

@loicland
Copy link
Owner

What value did you give to $CONDAENV?

Are you sure you have libboost_python.so in your LD_LIBRARY_PATH?

@bach-zouk
Copy link

Hi Loic,

Could you perhaps post the desired output of test.py file after libcp is built? I was able to compile libcp fine and get this output after running test.py:

L0-CUT PURSUIT WITH L2 FIDELITY
PARAMETERIZATION = FAST
Graph 5 vertices and 14 edges and observation of dimension 1
Iteration 1 - 3 components - Saturation 0.0 % - Quadratic Energy 0.000 % - Timer 0.204649
Iteration 2 - 3 components - Saturation 100.0 % - Quadratic Energy 0.000 % - Timer 0.204701
All components are saturated

@bach-zouk
Copy link

My bad: these results I obtain after with python 2.7 which is not suggested anyways.

@zeroAska
Copy link

@XBingQian Have you figured out? I ran into exactly the same error as you, libcp.so: undefined symbol: _ZTIN5boost6python7objects21py_function_impl_baseE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants