importing "in place" and packages

Simon Peyton-Jones simonpj at
Fri Dec 22 09:15:33 EST 2006

The main program must be in package 'main', which is why compiling ShowClasses with "-package-name javavm" doesn't work.  I'll modify the documentation to say this more clearly

When you say "import JVMBoot", and your javavm package is not installed, GHC thinks you mean "JVMBoot from package main".  The only way at the moment you can make GHC realise you mean "JVMBoot from package javavm" is to install it.

You may say that's a bit silly -- after all, GHC can simply look at the interface file, and that is what you want here. I'll talk to Simon about whether that could be possible, but I'm guessing there's a good reason why not.

Anyway, the solution for you is to install it.  Cabal?  There must be a well-understood process but I'm not the one to ask.


| -----Original Message-----
| From: glasgow-haskell-users-bounces at [mailto:glasgow-
| haskell-users-bounces at] On Behalf Of Ashley Yakeley
| Sent: 22 December 2006 10:44
| To: glasgow-haskell-users at
| Subject: importing "in place" and packages
| I'm compiling the files for package "javavm" with GHC 6.6 (using
| "-package-name javavm"). As part of the compilation process, I need a
| runnable program that uses the modules I've compiled "in place":
|    import JVMBoot
| But I get this error when compiling my "Main" module (ShowClasses.hs):
| ShowClasses.hs:23:1:
|      Bad interface file: JVMBoot.hi
|          Something is amiss; requested module  main:JVMBoot differs
| from
| name found in the interface file javavm:JVMBoot
| Really I want to import javavm:JVMBoot, not main:JVMBoot. I tried this,
| but GHC doesn't like it (because it's not Haskell):
|   import javavm:JVMBoot
| I tried compiling ShowClasses.hs with "-package-name javavm". This let
| me compile, but then I get this on link:
| /usr/bin/ld: Undefined symbols:
| _ZCMain_main_closure
| ___stginit_ZCMain
| collect2: ld returned 1 exit status
| I tried adding a -main-is in the compile step, but this didn't help.
| Is there any way to create a main function that calls files imported
| "in
| place" that are in some package? I have the same issue when writing
| tests for my "time" package.
| --
| Ashley Yakeley
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at

More information about the Glasgow-haskell-users mailing list