Skip to content

Compiled python modules are linking to ubuntu's python library instead of pyenv's python version #82

Closed

Description

@ckhoo

I am trying to "pyenv install 2.7.6" in ubuntu 12.04 (note this is a fresh ubuntu 12.04 install) and I am getting the following error.

ImportError: /opt/pyenv/versions/2.7.6/lib/python2.7/lib-dynload/_sqlite3.so: undefined symbol: _PyInt_AsInt

By doing "ldd _sqlite3.so" found in tmp build directory, I noticed the compiled sqlite3 module is linking to Ubuntu's default python2.7, which does not have _PyInt_AsInt symbol, since it is not python 2.7.6.

ldd /tmp/python-build.20131120202950.5916/Python-2.7.6/build/lib.linux-x86_64-2.7/_sqlite3.so
    linux-vdso.so.1 =>  (0x00007fff00dff000)
    libsqlite3.so.0 => /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007f2da67bb000)
    libpython2.7.so.1.0 => /usr/lib/libpython2.7.so.1.0 (0x00007f2da62b8000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f2da609a000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2da5cda000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f2da5ad6000)
    libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f2da5877000)
    libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f2da549c000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f2da5285000)
    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f2da5081000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f2da4d85000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f2da4b6f000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f2da6c74000)

Is there some compilation flag I should set such that pyenv will compile sqlite3 module using the correct python library?

I am installing python 2.7.6 using the following:

export CONFIGURE_OPTS="--enable-shared --enable-unicode=ucs4";pyenv install 2.7.6

Thanks.

Activity

  1. yyuu commented on Nov 21, 2013

    @yyuu
    Contributor

    You might need to set LD_LIBRARY_PATH on GNU/Linux if you give --enable-shared as CONFIGURE_OPTS. See also #66.

  2. ckhoo commented on Nov 25, 2013

    @ckhoo
    Author

    Thanks Yuu. Your reference (#66) works for me.

  3. ckhoo commented on Nov 26, 2013

    @ckhoo
    Author

    Adding a note for anyone who wants to --enable-shared like myself,

    1. I had pyenv inside /opt/pyenv. Therefore, I setup my shared library path like this: export LD_LIBRARY_PATH=/opt/pyenv/versions/2.7.6/lib:$LD_LIBRARY_PATH

    2. be sure that LD_LIBRARY_PATH is a permanent entry in ~/.bashrc and not just during pyenv install 2.7.6.

  4. yyuu commented on Dec 20, 2013

    @yyuu
    Contributor

    I pushed 43212f6 which will set rpath if --enable-shared was given in PYTHON_CONFIGURE_OPTS. With this fix, just passing --enable-shared will resolve the issue.

    $ env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 2.7.5
    
  5. lambdalisue commented on Dec 24, 2013

    @lambdalisue

    👍
    this commit saved me a lot. thanks

  6. added a commit that references this issue on Jan 24, 2014
  7. added a commit that references this issue on Apr 4, 2014
  8. added a commit that references this issue on May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions