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 erro when compiling #128

Open
dignakov opened this issue Mar 12, 2022 · 0 comments
Open

Python interface erro when compiling #128

dignakov opened this issue Mar 12, 2022 · 0 comments

Comments

@dignakov
Copy link

dignakov commented Mar 12, 2022

Hi,

I'm trying to test the Python interface, but I'm running into a couple of issues (Ubuntu 20.04)

(1) when building with CMake 'libqpOASES' is placed in the libs directory, but the python installation process is looking for it in the bin directory:

$ python3 setup.py build_ext --inplace
.
.
.
x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.8/qpoases.o -L/home/dmitri/code/qpOASES_orig/bin -Wl,--enable-new-dtags,-R/home/dmitri/code/qpOASES_orig/bin -lqpOASES -o /home/dmitri/code/qpOASES_orig/interfaces/python/qpoases.cpython-38-x86_64-linux-gnu.so -Wl,-O1 -Wl,--as-needed
/usr/bin/ld: cannot find -lqpOASES
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-g++' failed with exit status 1

(2) If I manually move the lib, I still get an error about relocation R_X86_64_PC32 against symbol '_ZTTN7qpOASES11SymDenseMatE' can not be used when making a shared object; recompile with -fPIC

$ python3 setup.py build_ext --inplace
.
.
.
x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.8/qpoases.o -L/home/dmitri/code/qpOASES_orig/bin -Wl,--enable-new-dtags,-R/home/dmitri/code/qpOASES_orig/bin -lqpOASES -o /home/dmitri/code/qpOASES_orig/interfaces/python/qpoases.cpython-38-x86_64-linux-gnu.so -Wl,-O1 -Wl,--as-needed
/usr/bin/ld: /home/dmitri/code/qpOASES_orig/bin/libqpOASES.a(QProblemB.cpp.o): relocation R_X86_64_PC32 against symbol `_ZTTN7qpOASES11SymDenseMatE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-g++' failed with exit status 1

One more update . . . (I installed everything into a virtualenv, so the library is in the right place, and ld is able to find the .so)

I also tried building the library with -DBUILD_SHARED_LIBS=ON, then installing it system wide.

At this point the python interface compiles, but I get this:

/tmp/ipykernel_3558/584781938.py in <module>
      1 import numpy as np
----> 2 from qpoases import PyQProblem as QProblem
      3 from qpoases import PyOptions as Options
      4 from qpoases import PyPrintLevel as PrintLevel

ImportError: /home/dmitri/.virtualenvs/env_vscode/lib/python3.8/site-packages/qpoases.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN7qpOASES8QProblem4initEPKdS2_S2_S2_S2_S2_S2_RlPdS2_S2_PKNS_6BoundsEPKNS_11ConstraintsES2_
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

1 participant