[GHC] #843: Dependency information for the linking step
Simon Marlow
simonmarhaskell at gmail.com
Wed Aug 9 05:36:45 EDT 2006
Volker Wysk wrote:
> On Tuesday 08 August 2006 14:08, GHC wrote:
>
>>#843: Dependency information for the linking step
>>------------------------------------+--------------------------------------
>>- Reporter: pf1 at volker-wysk.de | Owner:
>> Type: feature request | Status: new
>> Priority: normal | Milestone:
>> Component: Compiler | Version: 6.4.1
>> Severity: normal | Resolution:
>> Keywords: dependency generation | Os: Linux
>>Difficulty: Easy (1 hr) | Architecture: Unknown
>>------------------------------------+--------------------------------------
>>- Comment (by simonmar):
>>
>> Then I have another trick for you:
>>
>> {{{
>> ghc --make -pgml echo Main.hs -v0 | ghc -e 'interact (unwords . filter
>> (".o" `Data.List.isSuffixOf`) . words)'
>> }}}
>>
>> Does this solve the problem?
>
>
> Yes! I have no idea what's going on, though.
"-pgml echo" uses "echo" as the linker program, so the linker command line is
sent to stdout, then we pipe it through something that extracts the object
filenames - I used ghc -e, but you could use sed or perl or something else. The
version I gave above doesn't work properly if the filenames contain spaces.
> However, it triggers another problem, which I haven't reported. When
> calling "ghc -M src/prog.hs", where "prog.hs" is the main module, then the
> name of the object file is reported as "src/prog.o". When calling it in
> conjunction with "-odir", such as "ghc -M -odir build src/prog.hs", then you
> get "build/Main.o". Of course this can't be used, because all of the
> programs' main modules become "build/Main.o".
This isn't a bug, it's the defined behaviour of -odir. See the documentation:
http://www.haskell.org/ghc/docs/latest/html/users_guide/separate-compilation.html#output-files
Cheers,
Simon
More information about the Glasgow-haskell-bugs
mailing list