fpco / inline-c

284 stars 51 forks source link

Linking error while using cabal repl #122

Open deliciouslytyped opened 3 years ago

deliciouslytyped commented 3 years ago

As discussed on IRC here is as far as I could currently minimize the repro. To repro, nix-shell and then call cabal repl. I haven't been able to update things yet so it's running with old code and an old pinned version of nixpkgs.

The clang-pure directory contains the slightly modified clang-pure. The significant changes wrt. the issue should (?) be limited to the cabal files. repro.zip

deliciouslytyped commented 3 years ago

I don't have energy left to do a cleaner writeup today; the issue seems to be that an extraneous typeinfo for clang::ast_matchers::MatchFinder::MatchCallback symbol ends up in the clang-pure shared object, which GHCi fails to resolve when it tries to load it, because the symbol doesn't exist. The symbol doesn't exist the original clang shared objects either, because they are compiled with -fno-ffi. (TODO: I should confirm this last point.)

The hypothetical solution would be to do whatever is necessary so that the symbol requirement isn't created.

I couldn't figure out a hacky way to test this with the raw binary, because I couldn't find any linker/tools that could remove the symbol, or at least I couldn't figure out how to do it. (TODO: there was a mailing list item that I believe said it's possible with the ld linker script VERSION feature?)

deliciouslytyped commented 3 years ago

The issue superficially appears to have been fixed by updating to GHC 8.10.