Skip to content

FFI fails to build on FreeBSD against llvm20 #1380

@oaken-source

Description

@oaken-source

building ffi fails on FreeBSD 15 with the following error message:

      >>> referenced by Program.cpp
      >>>               Program.cpp.o:(Execute(llvm::sys::ProcessInfo&, llvm::StringRef,
      llvm::ArrayRef<llvm::StringRef>, std::__1::optional<llvm::ArrayRef<llvm::StringRef>>,
      llvm::ArrayRef<std::__1::optional<llvm::StringRef>>, unsigned int, std::__1::basic_string<char,
      std::__1::char_traits<char>, std::__1::allocator<char>>*, llvm::BitVector*, bool)) in archive
      /usr/local/llvm20/lib/libLLVMSupport.a
      c++: error: linker command failed with exit code 1 (use -v to see invocation)

which breaks installation when attempting to build the wheel.

the root cause for this seems to be that the environ symbol is not available from libc when building a library, and instead is resolved when linking the application. there seem to have been a number of similar build issues reported for other projects over the years, where the typical fix seems to have been to add -Wl,--warn-unresolved-symbols to the linker flags.

in the case of ffi, the appropriate spot seems to be FORCED_LINK_FLAGS for non-apple UNIXes in CMakeLists.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions