Skip to content

Python language bindings not building. #29

@calumroy

Description

@calumroy

Python language bindings not building

When compiling the python language bindings on Ubuntu 18.04 with python 2.7 or python 3.6 I get the following error after running.

 cmake -DTESTS=ON -DPYTHON=ON ../
make

relocation R_X86_64_PC32 against symbol `PyFunction_Type' can not be used when making a shared object; recompile with -fPIC

I tried adding -fPIC to the compiler options by editing the cmakelists.txt but the same error always occurred. The project builds fine without the python laugauge bindings option.

The entire output of make is shown below.

Scanning dependencies of target _cdr
[ 80%] Building CXX object src/bindings/python/CMakeFiles/_cdr.dir/cdrPYTHON_wrap.cxx.o
/home/calum/Documents/ros2_ade/rosbag2_logs/analyse_logs/codec/build/src/CDR_PROJECT-build/src/bindings/python/cdrPYTHON_wrap.cxx: In function ‘void neueda_cdr___setitem__(neueda::cdr*, const cdrKey_t&, PyObject*)’:
/home/calum/Documents/ros2_ade/rosbag2_logs/analyse_logs/codec/build/src/CDR_PROJECT-build/src/bindings/python/cdrPYTHON_wrap.cxx:5732:38: warning: format not a string literal and no format arguments [-Wformat-security]
             self->setString (key, val);
                                      ^
[100%] Linking CXX shared module _cdr.so
/home/calum/.pyenv/versions/2.7.13/lib/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_tmpnam':
/tmp/python-build.20190816152236.19304/Python-2.7.13/./Modules/posixmodule.c:7614: warning: the use of `tmpnam_r' is dangerous, better use `mkstemp'
/home/calum/.pyenv/versions/2.7.13/lib/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_tempnam':
/tmp/python-build.20190816152236.19304/Python-2.7.13/./Modules/posixmodule.c:7561: warning: the use of `tempnam' is dangerous, better use `mkstemp'
/usr/bin/ld: /home/calum/.pyenv/versions/2.7.13/lib/python2.7/config/libpython2.7.a(ceval.o): relocation R_X86_64_PC32 against symbol `PyFunction_Type' 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
src/bindings/python/CMakeFiles/_cdr.dir/build.make:104: recipe for target 'src/bindings/python/_cdr.so' failed
make[5]: *** [src/bindings/python/_cdr.so] Error 1
CMakeFiles/Makefile2:160: recipe for target 'src/bindings/python/CMakeFiles/_cdr.dir/all' failed
make[4]: *** [src/bindings/python/CMakeFiles/_cdr.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make[3]: *** [all] Error 2
CMakeFiles/CDR_PROJECT.dir/build.make:110: recipe for target 'src/CDR_PROJECT-stamp/CDR_PROJECT-build' failed
make[2]: *** [src/CDR_PROJECT-stamp/CDR_PROJECT-build] Error 2
CMakeFiles/Makefile2:259: recipe for target 'CMakeFiles/CDR_PROJECT.dir/all' failed
make[1]: *** [CMakeFiles/CDR_PROJECT.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions