Opened 4 years ago

Closed 4 years ago

Last modified 3 weeks ago

#8443 closed bug (invalid)

cannot find normal object file when compiling TH code

Reported by: snoyberg Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.7
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: GHC rejects valid program Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Unfortunately, I haven't been able to whittle this down to a smaller test case. In order to reproduce, just run cabal install yesod-core- --enable-tests. The result is:

    cannot find normal object file ‛dist/build/tests/tests-tmp/YesodCoreTest/NoOverloadedStringsSub.dyn_o’
    while linking an interpreted expression

Tested using:

The Glorious Glasgow Haskell Compilation System, version 7.7.20131012 cabal-install version using version 1.18.0 of the Cabal library

I'm on Ubuntu 12.04 64-bit. Compiling with GHC 7.6.3 and 7.4.2 works correctly.

Let me know if there's any other information I can provide.

Change History (5)

comment:1 Changed 4 years ago by igloo

Resolution: invalid
Status: newclosed

test/YesodCoreTest/NoOverloadedStrings.hs uses TemplateHaskell, but the .cabal file doesn't declare that it uses TH. Cabal should DTRT if it knows that TH is used.

comment:2 Changed 4 years ago by snoyberg

Can you clarify what the recommended fix is? I'm not certain if you're saying this is a bug in Cabal, or if there is a new requirement to somehow state that code will be using TemplateHaskell and, if such a requirement exists, how a user is supposed to do so.

comment:3 Changed 4 years ago by igloo

It's a bug in yesod-core.

You need something like extensions: TemplateHaskell somewhere.

comment:4 Changed 3 years ago by nh2

For readers who pass by:

other-extensions: TemplateHaskell in your cabal file is the recommended way to deal with this.

comment:5 Changed 3 weeks ago by nh2

2 years later, some insight on *why* other-extensions: TemplateHaskell helps here:

thoughtpolice: -dynamic-too is sort of designed to not have too much overhead but it's a giant shitshow how it works

In short, it will only re-run the assembler, mostly, since it 'just' has to change some stuff like relocations, etc in the backend for a shared object. It used to not be so easy on windows; the way it's implemented is a hack.

And yeah, Cabal does use the knowledge of TemplateHaskell to know when to turn on -dynamic-too automatically for GHC, so it will build shared object files, which it can link in the background and load in GHCi

Note: See TracTickets for help on using tickets.