You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using dlib with pybind11 to build a python extension and compiler is gcc in c++11. When I try to compile my code it always shows following error message, I think it may be that I didn't add -fPIC flag in zlib compilation.
//usr/local/lib/libdlib.a(zutil.c.o): relocation R_X86_64_PC32 against symbol z_errmsg' can not be used when making a shared object; recompile with -fPIC
I try to compile the same code without pybind11 too. And it works perfectly. Following is my command in my Makefile.
I follow the solution in this issue and solve it already. pybind/pybind11#466
I manually add set_target_properties(dlib PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
before add_subdirectory in CMakeLists.txt.
I am using dlib with pybind11 to build a python extension and compiler is gcc in c++11. When I try to compile my code it always shows following error message, I think it may be that I didn't add -fPIC flag in zlib compilation.
//usr/local/lib/libdlib.a(zutil.c.o): relocation R_X86_64_PC32 against symbol z_errmsg' can not be used when making a shared object; recompile with -fPIC
I try to compile the same code without pybind11 too. And it works perfectly. Following is my command in my Makefile.
pybind11 version:
g++ -O3 -Wall -shared -std=c++11 -fPIC
pkg-config --cflags --libs glib-2.0
python3 -m pybind11 --includes
$^ -lpthread -lX11 -ldlib -lglib-2.0 -lz /usr/local/lib/libz.a -ljpeg -o wsi_reader
python3-config --extension-suffix
without pybind11 version:
g++ -O3 -std=c++11
pkg-config --cflags --libs glib-2.0
-I/usr/include/boost $^ -ldlib -ljpeg -lglib-2.0 -lpthread -o outThe text was updated successfully, but these errors were encountered: