Skip to content

Duplicate symbol errors when running GHCi/TH tests (libffi pains) #99

@hasufell

Description

@hasufell

Problem

GHC runtime linker: fatal error: I found a duplicate definition for symbol
   ffi_prep_cif
whilst processing object file
   /usr/home/github/.cache/act/aa026268a9c70a03/hostexecutor/_build/bindist/lib/x86_64-portbld-freebsd/libffi-3.5.2/HSlibffi-3.5.2.o
The symbol was previously defined in
   (GHCi built-in symbols)
This could be caused by:
   * Loading two different object files which export the same symbol
   * Specifying the same object file twice on the GHCi command line
   * An incorrect `package.conf' entry, causing some object to be
     loaded twice.
<no location info>: error:
    loadObj "/usr/home/github/.cache/act/aa026268a9c70a03/hostexecutor/_build/bindist/lib/x86_64-portbld-freebsd/libffi-3.5.2/HSlibffi-3.5.2.o": failed

Full log: https://github.com/stable-haskell/ghc/actions/runs/18005814665/job/51230757936#step:10:2023

Explanation

This bug was originally introduced by using a libffi Haskell package, which was added here: 898758a

The reason for this was that we don't ship a bundled libffi anymore like the vanilla bindists. This causes problems when linking on mac and FreeBSD: now the user has to manually tell cabal/ghc where libffi lies.

The duplicate symbol error was fixed by this hack in rts/Linker.c: https://github.com/stable-haskell/ghc/compare/8f643e5d60376266cbaa27c7fba23eca1f2c2522%5E..ce3e1603ccb748062400c21d33780e6e7142d502#diff-6d91534f6d8d658a4dbb8ab58c56b755c2f115f7abb7952c4f85377e6aabc966

Then later we tried to fix it more cleanly with @angerman: 4ba4451

But it turned out this doesn't work. CI is still failing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions