rust-cross / cargo-zigbuild

Compile Cargo project with zig as linker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

glibc 2.27 or older: fcntl@GLIBC_2.2.5 not found when build for armv7

Dirreke opened this issue · comments

I created an Issue on zig, ziglang/zig#16002
I get it when I build for armv7-unknown-linux-gnueabihf

  = note: ld.lld: error: undefined symbol: fcntl@GLIBC_2.2.5
          >>> referenced by fs_posix.cc:157 (rocksdb/env/fs_posix.cc:157)
          >>>               fs_posix.o:(rocksdb::(anonymous namespace)::PosixFileSystem::NewSequentialFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, rocksdb::FileOptions const&, std::__1::unique_ptr<rocksdb::FSSequentialFile, std::__1::default_delete<rocksdb::FSSequentialFile> >*, rocksdb::IODebugContext*)) in archive .../armv7-unknown-linux-gnueabihf/debug/deps/liblibrocksdb_sys-6aa47adaadf43187.rlib
          >>> referenced by fs_posix.cc:157 (rocksdb/env/fs_posix.cc:157)
          >>>               fs_posix.o:(rocksdb::(anonymous namespace)::PosixFileSystem::NewSequentialFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, rocksdb::FileOptions const&, std::__1::unique_ptr<rocksdb::FSSequentialFile, std::__1::default_delete<rocksdb::FSSequentialFile> >*, rocksdb::IODebugContext*)) in archive .../armv7-unknown-linux-gnueabihf/debug/deps/liblibrocksdb_sys-6aa47adaadf43187.rlib
          >>> referenced by fs_posix.cc:157 (rocksdb/env/fs_posix.cc:157)
          >>>               fs_posix.o:(rocksdb::(anonymous namespace)::PosixFileSystem::NewRandomAccessFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, rocksdb::FileOptions const&, std::__1::unique_ptr<rocksdb::FSRandomAccessFile, std::__1::default_delete<rocksdb::FSRandomAccessFile> >*, rocksdb::IODebugContext*)) in archive .../armv7-unknown-linux-gnueabihf/debug/deps/liblibrocksdb_sys-6aa47adaadf43187.rlib
          >>> referenced 12 more times
          >>> did you mean: fcntl
          >>> defined in: ~/.cache/zig/o/f9d9fcf846b561cef901d9b46b123fcc/libpthread.so.0

And I found that ~/.cache/zig/o/.../c.o has fcntl@GLIBC_2.4 but not fcntl@GLIBC_2.2.5. I don't know why

I noticed that cargo-zigbuild create fcntl.h and fcntl.map to help finish the compile. Therefore, I want to know if cargo-zigbuild know why and if cargo-zigbuild can solve this by adding some code to fcntl.h and fcntl.map