Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8253895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:02:00+00:00 2026-06-08T01:02:00+00:00

when compiling shared library which links boost and python libraries I receive error: /usr/bin/ld:

  • 0

when compiling shared library which links boost and python libraries I receive error:

/usr/bin/ld: libboost_python.a(from_python.o): relocation R_X86_64_32
against `.rodata.str1.8′ can not be used when making a shared object;
recompile with -fPIC libboost_python.a: could not read symbols: Bad
value

I’ve used verbose mode to look at compiler definitions:

/usr/bin/c++ -fPIC -g -shared -Wl,-soname,libCore.so -o
…/libCore.so Core.cpp.o -lpython2.7 -Wl,-Bstatic -lboost_python
-Wl,-Bdynamic

That’s it! I have to remove -Wl, -Bstatic from definitions but how to do that? I’m using cmake build system and here is a part of code which generates that shared library:

set(Core_SRC
    Core.cpp
)
add_definitions(-g -fPIC)
add_library(Core SHARED ${Core_SRC})

target_link_libraries(Core
    ${PYTHON_LIBRARIES}
    ${Boost_LIBRARIES}
)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:02:02+00:00Added an answer on June 8, 2026 at 1:02 am

    The problem is you’re trying to build a shared library with libboost_python which appears to have been built in such a way that it can’t be linked into a shared library.

    There’s 3 ways round that.

    1. Don’t make your library shared
    2. Build a shared version of the boost_python library
    3. eave the references to boost_python unresolved
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am compiling my code to create a shared library and finally linking them
When compiling shared libraries in gcc the -fPIC option compiles the code as position
Is there a reason you would not set -static-link-runtime-shared-libraries to true when compiling an
I want to create a shared library which can be loaded in two different
I'm compiling a shared library, with a -lGL on the ld command. But it
I'm compiling a Shared library using Android NDK r6b. All classes are C++. I
I am using the ctypes module in python to load a shared c-library ,
I have started to play around with boost python a bit and ran into
I built a (very simple) library, which I can call just fine from another
I am new to linux, while compiling with dynamic library I am getting the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.