Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

557
Visualizações
Relocation R_X86_64_32S against '_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC

I'm trying to install the dlib Python library. On some systems (macOS, stock Ubuntu 14.04) pip install dlib works fine, but in the Ubuntu 14.x that's part of our CircleCI environment it fails with the following error.

Linking CXX shared library dlib.so
   /usr/bin/ld: /opt/circleci/python/2.7.11/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32S against '_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
   error: cmake build failed!

What could be wrong?

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

The problem was that Python needs to be compiled with the --enable-shared flag for the dlib install to succeed. While in some cases the system Python is built with this flag (e.g. on Ubuntu), the one we were using in the CI environment was installed via pyenv which doesn't set it by default.

The solution was to reinstall the pyenv-provided Python with the flag set like this:

PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install --force 2.7.11

To ensure this gets used: machine: python: version: 2.7.11 # Has to match the pyenv-installed version

over 4 years ago · Santiago Trujillo Relatório

0

I had similar problem when building matplotlib (a dependency for scikit-image) for aws lambda python 3.6 inside amazon docker container amazon-linux-python-3.6.

In short matplotlib was giving the same error as OP had for /usr/lib/libpython3.6m.a. Turned out there were two such libraries in the amazon docker container:

find / -name "libpython3.6m.a"
/usr/lib/libpython3.6m.a
/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.a

So I just renamed /usr/lib/libpython3.6m.a to something else so that matplotlib does not use it, and chooses the second option:

enter code heremv /usr/lib/libpython3.6m.a /usr/lib/libpython3.6m.a.moved

After this change, scikit-image were successful using pip3 install --no-binary scikit-image scikit-image.

over 4 years ago · Santiago Trujillo Relatório

0

As an FYI, my particular case was resolved by renaming '/usr/local/lib/libpython2.7.a' to '/usr/local/lib/libpython2.7.a.moved'. According to 'yum whatprovides /usr/local/lib/libpython2.7.a' output, this was not installed as a part of any packages installed via yum. Moving this out of the way in this case, solved my issue.

Here was my original error message:

  /usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC

/usr/local/lib/libpython2.7.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status

Given that none of my installed packages accounted for the .a lib, moving it aside was an option for me.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda