linux - makefile recompile with -fPIC -


so, i'm trying build in make. produced files via cmake, went appropriate folder build file, and:

make scanning dependencies of target spenvis [ 33%] building cxx object source/cmakefiles/spenvis.dir/pyspenviscsv.cc.o [ 66%] building cxx object source/cmakefiles/spenvis.dir/spenviscsv.cc.o [100%] building cxx object source/cmakefiles/spenvis.dir/spenviscsvcollection.cc.o linking cxx shared library libspenvis.so /usr/bin/ld: /usr/local/lib64/libpython2.7.a(abstract.o): relocation r_x86_64_32 against `.rodata.str1.8' can not used when making shared  object; recompile -fpic /usr/local/lib64/libpython2.7.a: not read symbols: bad value collect2: ld returned 1 exit status make[2]: *** [source/libspenvis.so] error 1 make[1]: *** [source/cmakefiles/spenvis.dir/all] error 2 make: *** [all] error 2 

i'm bit of novice far make/cmake goes. i'm uncertain go here. i've looked @ several suggestions, i'm uncertain relevant particular problem , how implement suggested fixes in first place.

halp!

there 2 cmakelists.txt files within python_utilities directory. i'll include both. 1 spenvis_csv/source:

# make sure compiler can find include files include_directories (${pyspenvis_source_dir})  # boost set(boost_use_static_libs   off) #set(boost_use_multieaded on) find_package(boost components             python          required) include_directories(${boost_include_dirs}) link_directories(${boost_library_dirs})  # python include(findpythonlibs)  set(pythonlibs_use_static_libs   off) find_package(pythonlibs required) include_directories(${python_include_dirs}) link_directories(${python_libraries})   # add_library(spenvis  shared pyspenviscsv.cc spenviscsv.cc spenviscsvcollection.cc) target_link_libraries(spenvis ${boost_libraries} ${python_libraries}) 

and second shorter one:

cmake_minimum_required (version 2.6) set (boost_no_boost_cmake=on) project (pyspenvis) add_subdirectory ("source")  

you linking against static python library which, believe, typically not going built -fpic it's code won't relocatable. spenvis target, on other hand, shared library , built -fpic, linking in non-pic code isn't going work this. linker saying you.

if possible, can link against shared version of python library (i.e. libpython.so.2.7 or similar, depending on how system names it)? have expected cmake prefer linking shared library default, i'm wondering if either:

  • you missing shared libpython library on system (unlikely, possible).
  • you've included cmake options tell prefer linking in static libraries.
  • you've explicitly given cmake static python library link in somehow.

if using findpythonlibs cmake module, have expected giving shared python library in python_libraries variable, if available on system. if update question include cmakelists.txt file, may identify problem.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -