Building `--with-experimental-kernel-lib` fails on OpenBSD 7.2 #27242

issue theStack opened this issue on March 11, 2023
  1. theStack commented at 12:17 PM on March 11, 2023: contributor

    Current behaviour

    Building with the --with-experimental-kernel-lib configuration option currently leads to linker failures on OpenBSD 7.2. The following compiler/linker/build-tool versions are used:

    • clang 13.0.0
    • lld 13.0.0
    • ccache 4.6.3
    • GNU make 4.3
    • autoconf 2.71
    • automake 1.16.5

    Expected behaviour

    • Building should succeed

    Steps to reproduce

    $ ./configure --enable-suppress-external-warnings --with-experimental-kernel-lib MAKE=gmake
    [ ... ]
    $ gmake clean
    $ gmake -j8
    [ ... ]
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for leveldb_comparator_t; recompile with -fPIC                  
    >>> defined in leveldb/.libs/libleveldb.a(libleveldb_la-c.o)
    >>> referenced by c.cc:87 (leveldb/db/c.cc:87)                                                                                           
    >>>               libleveldb_la-c.o:(leveldb_comparator_create) in archive leveldb/.libs/libleveldb.a                                    
                                                                                                                                             
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for leveldb_filterpolicy_t; recompile with -fPIC                
    >>> defined in leveldb/.libs/libleveldb.a(libleveldb_la-c.o)        
    >>> referenced by c.cc:107 (leveldb/db/c.cc:107) 
    >>>               libleveldb_la-c.o:(leveldb_filterpolicy_create) in archive leveldb/.libs/libleveldb.a                                  
                                                                        
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for leveldb_filterpolicy_t; recompile with -fPIC                
    >>> defined in leveldb/.libs/libleveldb.a(libleveldb_la-c.o)                                                                             
    >>> referenced by c.cc:108 (leveldb/db/c.cc:108)                                                                                         
    >>>               libleveldb_la-c.o:(leveldb_filterpolicy_create_bloom::Wrapper::~Wrapper()) in archive leveldb/.libs/libleveldb.a       
                                                                                                                                             
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for leveldb_filterpolicy_t; recompile with -fPIC                
    >>> defined in leveldb/.libs/libleveldb.a(libleveldb_la-c.o)                                                                             
    >>> referenced by c.cc:108 (leveldb/db/c.cc:108)                                                                                         
    >>>               libleveldb_la-c.o:(leveldb_filterpolicy_create_bloom::Wrapper::~Wrapper()) in archive leveldb/.libs/libleveldb.a
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for leveldb_comparator_t; recompile with -fPIC
    >>> defined in leveldb/.libs/libleveldb.a(libleveldb_la-c.o)
    >>> referenced by c.cc:88 (leveldb/db/c.cc:88)
    >>>               libleveldb_la-c.o:(leveldb_comparator_t::~leveldb_comparator_t()) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for leveldb_comparator_t; recompile with -fPIC
    >>> defined in leveldb/.libs/libleveldb.a(libleveldb_la-c.o)
    >>> referenced by c.cc:88 (leveldb/db/c.cc:88)
    >>>               libleveldb_la-c.o:(leveldb_comparator_t::~leveldb_comparator_t()) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for leveldb_filterpolicy_t; recompile with -fPIC
    >>> defined in leveldb/.libs/libleveldb.a(libleveldb_la-c.o)
    >>> referenced by c.cc:108 (leveldb/db/c.cc:108)
    >>>               libleveldb_la-c.o:(leveldb_filterpolicy_t::~leveldb_filterpolicy_t()) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for leveldb_filterpolicy_t; recompile with -fPIC
    >>> defined in leveldb/.libs/libleveldb.a(libleveldb_la-c.o)
    >>> referenced by c.cc:108 (leveldb/db/c.cc:108)
    >>>               libleveldb_la-c.o:(leveldb_filterpolicy_t::~leveldb_filterpolicy_t()) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >; recompile with -fPIC
    >>> defined in .libs/libbitcoinkernel_la-chain.o
    >>> referenced by ostream:165 (/usr/include/c++/v1/ostream:165)
    >>>               libleveldb_la-dbformat.o:(leveldb::ParsedInternalKey::DebugString() const) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >; recompile with -fPIC
    >>> defined in .libs/libbitcoinkernel_la-chain.o
    >>> referenced by ostream:165 (/usr/include/c++/v1/ostream:165)
    >>>               libleveldb_la-dbformat.o:(leveldb::ParsedInternalKey::DebugString() const) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >; recompile with -fPIC
    ar>, std::__1::allocator<char> >; recompile with -fPIC
    >>> defined in .libs/libbitcoinkernel_la-chain.o
    >>> referenced by iosfwd:139 (/usr/include/c++/v1/iosfwd:139)
    >>>               libleveldb_la-dbformat.o:(leveldb::ParsedInternalKey::DebugString() const) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>,
     std::__1::allocator<char> >; recompile with -fPIC
    >>> defined in .libs/libbitcoinkernel_la-chain.o
    >>> referenced by iosfwd:133 (/usr/include/c++/v1/iosfwd:133)
    >>>               libleveldb_la-dbformat.o:(leveldb::ParsedInternalKey::DebugString() const) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol VTT for std::__1::basic_ostringstream<char, std::__1::char_traits<char>
    , std::__1::allocator<char> >; recompile with -fPIC
    >>> defined in .libs/libbitcoinkernel_la-chain.o
    >>> referenced by iosfwd:139 (/usr/include/c++/v1/iosfwd:139)
    >>>               libleveldb_la-dbformat.o:(leveldb::ParsedInternalKey::DebugString() const) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for std::__1::basic_ostringstream<char, std::__1::char_traits<ch
    ar>, std::__1::allocator<char> >; recompile with -fPIC
    >>> defined in .libs/libbitcoinkernel_la-chain.o
    >>> referenced by iosfwd:139 (/usr/include/c++/v1/iosfwd:139)
    >>>               libleveldb_la-dbformat.o:(leveldb::ParsedInternalKey::DebugString() const) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for std::__1::basic_ostringstream<char, std::__1::char_traits<ch
    ar>, std::__1::allocator<char> >; recompile with -fPIC
    >>> defined in .libs/libbitcoinkernel_la-chain.o
    >>> referenced by iosfwd:139 (/usr/include/c++/v1/iosfwd:139)
    >>>               libleveldb_la-dbformat.o:(leveldb::ParsedInternalKey::DebugString() const) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >; recompile with -fPIC
    >>> defined in .libs/libbitcoinkernel_la-chain.o
    >>> referenced by iosfwd:133 (/usr/include/c++/v1/iosfwd:133)
    >>>               libleveldb_la-dbformat.o:(leveldb::ParsedInternalKey::DebugString() const) in archive leveldb/.libs/libleveldb.a
    
    ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
    c++: error: linker command failed with exit code 1 (use -v to see invocation)
    gmake[2]: *** [Makefile:7030: libbitcoinkernel.la] Error 1
    gmake[1]: *** [Makefile:19397: all-recursive] Error 1
    gmake: *** [Makefile:814: all-recursive] Error 1
    

    Relevant log output

    The ./configure output can be found here: https://pastebin.com/XzrZKe7D

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    master branch (commit 40d0b0a524dfe8cc70cc116a6c76a3f834824fe5)

    Operating system and version

    OpenBSD 7.2 (amd64)

    Machine specifications

    No response

  2. clintonimaroo commented at 7:29 PM on March 11, 2023: none

    This should help you resolve this issue, I had the same problem

    1. Add the -fPIC option to the CXXFLAGS and LDFLAGS variables in the Makefile generated by the configure script.

    2. Run "make clean" followed by "make" to rebuild the LevelDB library.

    3. Rebuild your application with the newly constructed LevelDB library.

  3. clintonimaroo commented at 7:30 PM on March 11, 2023: none

    Current behaviour

    Building with the --with-experimental-kernel-lib configuration option currently leads to linker failures on OpenBSD 7.2. The following compiler/linker/build-tool versions are used:

    • clang 13.0.0
    • lld 13.0.0
    • ccache 4.6.3
    • GNU make 4.3
    • autoconf 2.71
    • automake 1.16.5

    Expected behaviour

    • Building should succeed

    Steps to reproduce

    $ ./configure --enable-suppress-external-warnings --with-experimental-kernel-lib MAKE=gmake
    [ ... ]
    $ gmake clean
    $ gmake -j8
    [ ... ]
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for leveldb_comparator_t; recompile with -fPIC                  
    >>> defined in leveldb/.libs/libleveldb.a(libleveldb_la-c.o)
    >>> referenced by c.cc:87 (leveldb/db/c.cc:87)                                                                                           
    >>>               libleveldb_la-c.o:(leveldb_comparator_create) in archive leveldb/.libs/libleveldb.a                                    
                                                                                                                                             
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for leveldb_filterpolicy_t; recompile with -fPIC                
    >>> defined in leveldb/.libs/libleveldb.a(libleveldb_la-c.o)        
    >>> referenced by c.cc:107 (leveldb/db/c.cc:107) 
    >>>               libleveldb_la-c.o:(leveldb_filterpolicy_create) in archive leveldb/.libs/libleveldb.a                                  
                                                                        
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for leveldb_filterpolicy_t; recompile with -fPIC                
    >>> defined in leveldb/.libs/libleveldb.a(libleveldb_la-c.o)                                                                             
    >>> referenced by c.cc:108 (leveldb/db/c.cc:108)                                                                                         
    >>>               libleveldb_la-c.o:(leveldb_filterpolicy_create_bloom::Wrapper::~Wrapper()) in archive leveldb/.libs/libleveldb.a       
                                                                                                                                             
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for leveldb_filterpolicy_t; recompile with -fPIC                
    >>> defined in leveldb/.libs/libleveldb.a(libleveldb_la-c.o)                                                                             
    >>> referenced by c.cc:108 (leveldb/db/c.cc:108)                                                                                         
    >>>               libleveldb_la-c.o:(leveldb_filterpolicy_create_bloom::Wrapper::~Wrapper()) in archive leveldb/.libs/libleveldb.a
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for leveldb_comparator_t; recompile with -fPIC
    >>> defined in leveldb/.libs/libleveldb.a(libleveldb_la-c.o)
    >>> referenced by c.cc:88 (leveldb/db/c.cc:88)
    >>>               libleveldb_la-c.o:(leveldb_comparator_t::~leveldb_comparator_t()) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for leveldb_comparator_t; recompile with -fPIC
    >>> defined in leveldb/.libs/libleveldb.a(libleveldb_la-c.o)
    >>> referenced by c.cc:88 (leveldb/db/c.cc:88)
    >>>               libleveldb_la-c.o:(leveldb_comparator_t::~leveldb_comparator_t()) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for leveldb_filterpolicy_t; recompile with -fPIC
    >>> defined in leveldb/.libs/libleveldb.a(libleveldb_la-c.o)
    >>> referenced by c.cc:108 (leveldb/db/c.cc:108)
    >>>               libleveldb_la-c.o:(leveldb_filterpolicy_t::~leveldb_filterpolicy_t()) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for leveldb_filterpolicy_t; recompile with -fPIC
    >>> defined in leveldb/.libs/libleveldb.a(libleveldb_la-c.o)
    >>> referenced by c.cc:108 (leveldb/db/c.cc:108)
    >>>               libleveldb_la-c.o:(leveldb_filterpolicy_t::~leveldb_filterpolicy_t()) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >; recompile with -fPIC
    >>> defined in .libs/libbitcoinkernel_la-chain.o
    >>> referenced by ostream:165 (/usr/include/c++/v1/ostream:165)
    >>>               libleveldb_la-dbformat.o:(leveldb::ParsedInternalKey::DebugString() const) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >; recompile with -fPIC
    >>> defined in .libs/libbitcoinkernel_la-chain.o
    >>> referenced by ostream:165 (/usr/include/c++/v1/ostream:165)
    >>>               libleveldb_la-dbformat.o:(leveldb::ParsedInternalKey::DebugString() const) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >; recompile with -fPIC
    ar>, std::__1::allocator<char> >; recompile with -fPIC
    >>> defined in .libs/libbitcoinkernel_la-chain.o
    >>> referenced by iosfwd:139 (/usr/include/c++/v1/iosfwd:139)
    >>>               libleveldb_la-dbformat.o:(leveldb::ParsedInternalKey::DebugString() const) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>,
     std::__1::allocator<char> >; recompile with -fPIC
    >>> defined in .libs/libbitcoinkernel_la-chain.o
    >>> referenced by iosfwd:133 (/usr/include/c++/v1/iosfwd:133)
    >>>               libleveldb_la-dbformat.o:(leveldb::ParsedInternalKey::DebugString() const) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol VTT for std::__1::basic_ostringstream<char, std::__1::char_traits<char>
    , std::__1::allocator<char> >; recompile with -fPIC
    >>> defined in .libs/libbitcoinkernel_la-chain.o
    >>> referenced by iosfwd:139 (/usr/include/c++/v1/iosfwd:139)
    >>>               libleveldb_la-dbformat.o:(leveldb::ParsedInternalKey::DebugString() const) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for std::__1::basic_ostringstream<char, std::__1::char_traits<ch
    ar>, std::__1::allocator<char> >; recompile with -fPIC
    >>> defined in .libs/libbitcoinkernel_la-chain.o
    >>> referenced by iosfwd:139 (/usr/include/c++/v1/iosfwd:139)
    >>>               libleveldb_la-dbformat.o:(leveldb::ParsedInternalKey::DebugString() const) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for std::__1::basic_ostringstream<char, std::__1::char_traits<ch
    ar>, std::__1::allocator<char> >; recompile with -fPIC
    >>> defined in .libs/libbitcoinkernel_la-chain.o
    >>> referenced by iosfwd:139 (/usr/include/c++/v1/iosfwd:139)
    >>>               libleveldb_la-dbformat.o:(leveldb::ParsedInternalKey::DebugString() const) in archive leveldb/.libs/libleveldb.a
    
    ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >; recompile with -fPIC
    >>> defined in .libs/libbitcoinkernel_la-chain.o
    >>> referenced by iosfwd:133 (/usr/include/c++/v1/iosfwd:133)
    >>>               libleveldb_la-dbformat.o:(leveldb::ParsedInternalKey::DebugString() const) in archive leveldb/.libs/libleveldb.a
    
    ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
    c++: error: linker command failed with exit code 1 (use -v to see invocation)
    gmake[2]: *** [Makefile:7030: libbitcoinkernel.la] Error 1
    gmake[1]: *** [Makefile:19397: all-recursive] Error 1
    gmake: *** [Makefile:814: all-recursive] Error 1
    

    Relevant log output

    The ./configure output can be found here: https://pastebin.com/XzrZKe7D

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    master branch (commit 40d0b0a)

    Operating system and version

    OpenBSD 7.2 (amd64)

    Machine specifications

    No response

    or you can run the configure script with the —with-pic option to enable position-independent code generation for the LevelDB library.

  4. maflcko added the label Build system on Mar 13, 2023
  5. maflcko commented at 3:13 PM on April 4, 2023: member

    Did you try with a different compiler?

  6. hebasto commented at 4:16 PM on January 6, 2025: member

    I believe this issue is no longer relevant after migrating to CMake.

    On OpenBSD 7.6, the build completes without any issues:

    $ cmake -B build -DBUILD_KERNEL_LIB=ON
    $ cmake --build build
    $ file build/src/kernel/libbitcoinkernel.so 
    build/src/kernel/libbitcoinkernel.so: ELF 64-bit LSB shared object, x86-64, version 1
    
  7. maflcko commented at 8:30 AM on January 7, 2025: member

    Closing for now. A new issue can be opened, if this still happens on current master.

  8. maflcko closed this on Jan 7, 2025

  9. bitcoin locked this on Jan 7, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 21:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me