wbolster / plyvel

Plyvel, a fast and feature-rich Python interface to LevelDB
https://plyvel.readthedocs.io/
Other
518 stars 75 forks source link

Illumos/SmartOS build failure, "text relocation remains against symbol" #125

Open kayront opened 3 years ago

kayront commented 3 years ago

Hello, I'm trying to run python software that depends on plyvel on SmartOS, but unfortunately it is failing to compile.

$ pipenv^H^[[K^H^[[K^H^[[K install plyvel^M
Collecting plyvel^M
  Using cached plyvel-1.3.0.tar.gz (149 kB)^M
Building wheels for collected packages: plyvel^M
  Building wheel for plyvel (setup.py) ... ^[[?25l-^H ^H\^H ^H|^H ^H/^H ^H-^H ^H\^H ^H|^H ^H/^H ^H-^H ^Herror^M
^[[31m  ERROR: Command errored out with exit status 1:^M
   command: /home/electrum/electrum-server-personal/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-dzl_c68f/plyvel_a71bd8af38e447a0be42bde7edc61a0a/setup.py'"'"'; __file__='"'"'/tmp/pip-install-dzl_c68f/plyvel_a71bd8af38e447a0be42bde7edc61a0a/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-o0hhfuog^M
       cwd: /tmp/pip-install-dzl_c68f/plyvel_a71bd8af38e447a0be42bde7edc61a0a/^M
  Complete output (8572 lines):^M
  running bdist_wheel^M
  running build^M
  running build_py^M
  creating build^M
  creating build/lib.solaris-2.11-i86pc.64bit-3.8^M
  creating build/lib.solaris-2.11-i86pc.64bit-3.8/plyvel^M
  copying plyvel/__init__.py -> build/lib.solaris-2.11-i86pc.64bit-3.8/plyvel^M
  copying plyvel/_version.py -> build/lib.solaris-2.11-i86pc.64bit-3.8/plyvel^M
  running build_ext^M
  building 'plyvel._plyvel' extension^M
  creating build/temp.solaris-2.11-i86pc.64bit-3.8^M
  creating build/temp.solaris-2.11-i86pc.64bit-3.8/plyvel^M
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -pipe -O2 -msave-args -fno-aggressive-loop-optimizations -D_FORTIFY_SOURCE=2 -I/usr/include -I/opt/local/include -I/opt/local/include/ncurses -I/opt/local/include/db4 -pipe -O2 -msave-args -fno-aggressive-loop-optimizations -D_FORTIFY_SOURCE=2 -I/usr/include -I/opt/local/include -I/opt/local/include/ncurses -I/opt/local/include/db4 -D_REENTRANT -pipe -O2 -msave-args -fno-aggressive-loop-optimizations -D_FORTIFY_SOURCE=2 -I/usr/include -I/opt/local/include -I/opt/local/include/ncurses -I/opt/local/include/db4 -fPIC -I/opt/local/include/python3.8 -c plyvel/_plyvel.cpp -o build/temp.solaris-2.11-i86pc.64bit-3.8/plyvel/_plyvel.o -Wall -g -x c++ -std=c++11^M
  gcc: warning: '-x c++' after last input file has no effect^M
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -pipe -O2 -msave-args -fno-aggressive-loop-optimizations -D_FORTIFY_SOURCE=2 -I/usr/include -I/opt/local/include -I/opt/local/include/ncurses -I/opt/local/include/db4 -pipe -O2 -msave-args -fno-aggressive-loop-optimizations -D_FORTIFY_SOURCE=2 -I/usr/include -I/opt/local/include -I/opt/local/include/ncurses -I/opt/local/include/db4 -D_REENTRANT -pipe -O2 -msave-args -fno-aggressive-loop-optimizations -D_FORTIFY_SOURCE=2 -I/usr/include -I/opt/local/include -I/opt/local/include/ncurses -I/opt/local/include/db4 -fPIC -I/opt/local/include/python3.8 -c plyvel/comparator.cpp -o build/temp.solaris-2.11-i86pc.64bit-3.8/plyvel/comparator.o -Wall -g -x c++ -std=c++11^M
  gcc: warning: '-x c++' after last input file has no effect^M
  g++ -shared -L. -L/opt/local/gcc9/lib/gcc/x86_64-sun-solaris2.11/9.3.0 -Wl,-R/opt/local/gcc9/lib/gcc/x86_64-sun-solaris2.11/9.3.0 -L/usr/lib/amd64 -Wl,-R/usr/lib/amd64 -L/opt/local/lib -Wl,-R/opt/local/lib -L/opt/local/gcc9/lib/gcc/x86_64-sun-solaris2.11/9.3.0 -Wl,-R/opt/local/gcc9/lib/gcc/x86_64-sun-solaris2.11/9.3.0 -L/usr/lib/amd64 -Wl,-R/usr/lib/amd64 -L/opt/local/lib -Wl,-R/opt/local/lib build/temp.solaris-2.11-i86pc.64bit-3.8/plyvel/_plyvel.o build/temp.solaris-2.11-i86pc.64bit-3.8/plyvel/comparator.o -L/opt/local/lib -lleveldb -o build/lib.solaris-2.11-i86pc.64bit-3.8/plyvel/_plyvel.so^M
  Text relocation remains                       referenced^M
      against symbol                offset      in file^M
  .rodata (section)                   0x8               /opt/local/lib/libleveldb.a(db_impl.cc.o)^M
  .rodata (section)                   0x78              /opt/local/lib/libleveldb.a(db_impl.cc.o)^M
  .text (section)                     0x80              /opt/local/lib/libleveldb.a(db_impl.cc.o)^M
  .text (section)                     0x88              /opt/local/lib/libleveldb.a(db_impl.cc.o)^M
  .text (section)                     0x90              /opt/local/lib/libleveldb.a(db_impl.cc.o)^M
  .rodata (section)                   0x8               /opt/local/lib/libleveldb.a(db_iter.cc.o)^M
  .rodata (section)                   0x50              /opt/local/lib/libleveldb.a(db_iter.cc.o)^M
  .text (section)                     0x58              /opt/local/lib/libleveldb.a(db_iter.cc.o)^M
  .text (section)                     0x60              /opt/local/lib/libleveldb.a(db_iter.cc.o)^M
  .text (section)                     0x68              /opt/local/lib/libleveldb.a(db_iter.cc.o)^M

(... and much, much more)

SmartOS zone template version: base-64-lts 20.4.0.

wbolster commented 3 years ago

unfortunately i have no clue about this.

also it seems you did not post the actual error message?

kayront commented 3 years ago

The error message is

  Text relocation remains                       referenced^
      against symbol                offset      in file

There are hundreds and hundreds of such lines.

If it helps, the final ones before it dies, are:

    munmap                              0x912           /opt/local/lib/libleveldb.a(env_posix.cc.o)
    munmap                              0xdb2           /opt/local/lib/libleveldb.a(env_posix.cc.o)
    lseek                               0x9cc           /opt/local/lib/libleveldb.a(env_posix.cc.o)
    read                                0xa63           /opt/local/lib/libleveldb.a(env_posix.cc.o)
    fwrite                              0xb05           /opt/local/lib/libleveldb.a(env_posix.cc.o)
    fwrite                              0xce5           /opt/local/lib/libleveldb.a(env_posix.cc.o)
    fwrite                              0x387           /opt/local/lib/libleveldb.a(env_posix.cc.o)
    getenv                              0xe1c           /opt/local/lib/libleveldb.a(env_posix.cc.o)
    geteuid                             0xe32           /opt/local/lib/libleveldb.a(env_posix.cc.o)
    write                               0x1464          /opt/local/lib/libleveldb.a(env_posix.cc.o)
    write                               0x1514          /opt/local/lib/libleveldb.a(env_posix.cc.o)
    write                               0x1691          /opt/local/lib/libleveldb.a(env_posix.cc.o)
    write                               0x1849          /opt/local/lib/libleveldb.a(env_posix.cc.o)
    write                               0x1a44          /opt/local/lib/libleveldb.a(env_posix.cc.o)
    write                               0x1a8e          /opt/local/lib/libleveldb.a(env_posix.cc.o)
    write                               0x1bbd          /opt/local/lib/libleveldb.a(env_posix.cc.o)
    localtime_r                         0x60            /opt/local/lib/libleveldb.a(env_posix.cc.o)
    vsnprintf                           0x304           /opt/local/lib/libleveldb.a(env_posix.cc.o)
    fflush                              0x390           /opt/local/lib/libleveldb.a(env_posix.cc.o)
    getrlimit                           0x2012          /opt/local/lib/libleveldb.a(env_posix.cc.o)
    opendir                             0x2318          /opt/local/lib/libleveldb.a(env_posix.cc.o)
    readdir                             0x232c          /opt/local/lib/libleveldb.a(env_posix.cc.o)
    readdir                             0x236a          /opt/local/lib/libleveldb.a(env_posix.cc.o)
    closedir                            0x2377          /opt/local/lib/libleveldb.a(env_posix.cc.o)
    mmap                                0x2a92          /opt/local/lib/libleveldb.a(env_posix.cc.o)
    pthread_self                        0x19d           /opt/local/lib/libleveldb.a(env_posix.cc.o)
    ld: fatal: relocations remain against allocatable but non-writable sections
    collect2: error: ld returned 1 exit status
    error: command 'g++' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/electrum/electrum-server-personal/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-p_y9i0yn/plyvel_5ea0d5776af4442a9e7e3ba80946dfd8/setup.py'"'"'; __file__='"'"'/tmp/pip-install-p_y9i0yn/plyvel_5ea0d5776af4442a9e7e3ba80946dfd8/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-79n8ojxf/install-record.txt --single-version-externally-managed --compile --install-headers /home/electrum/electrum-server-personal/include/site/python3.8/plyvel Check the logs for full command output.
ptribble commented 3 years ago

This indicates leveldb hasn't been compiled with position-independent code.

It'll need to be rebuilt with at least -DCMAKE_POSITION_INDEPENDENT_CODE=on

(See the file scripts/install-leveldb.sh in this repo for recommended build flags; you'll probably want to set the install prefix as well.)