Re: importing "in place" and packages
Simon Peyton-Jones wrote: 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. It would be a bit strange to allow this. The compiler knows nothing about the javavm package at this stage: it isn't installed. So if we came across a module that we were expecting to be part of the main package and it turns out to belong to another, non-existant, package, we'd probably have to invent a package. I just don't have a clear idea for how this would work; my gut feeling is that we shouldn't pursue it, since the right way is to register the package with GHC first (temporarily, to a local database, perhaps). Cheers, Simon 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. Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:glasgow- | [EMAIL PROTECTED] On Behalf Of Ashley Yakeley | Sent: 22 December 2006 10:44 | To: glasgow-haskell-users@haskell.org | 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@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: importing "in place" and packages
Ashley Yakeley wrote: Simon Peyton-Jones wrote: Anyway, the solution for you is to install it. I can't install it, the package isn't finished being built at that point. Or perhaps I could find a way of installing the partial package to the user database. I build part of package javavm. Then I use that to build ShowClasses. Then I run ShowClasses to generate more source files. Then I use those to build the rest of javavm. Cabal provides 'setup register --inplace' for exactly this purpose. We don't currently allow the use of completely local package databases - you must use the global or user database - but the package can be used without the files actually being installed. Cheers, Simon ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: importing "in place" and packages
Hello Ashley, Friday, December 22, 2006, 1:44:01 PM, you wrote: > 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": i don't sure what you mean here but may be "dynamic loading" provided by hsplugins package is good for it? -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: importing "in place" and packages
Hmm. Ghc doesn't really give you a way to *run* a package which is so partly-built that you can't install it. That's perhaps not clever, but I think it's the current story. | point. Or perhaps I could find a way of installing the partial package | to the user database. That sounds plausible to me. | I build part of package javavm. Then I use that to build ShowClasses. | Then I run ShowClasses to generate more source files. Then I use those | to build the rest of javavm. Two packages, perhaps? S ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: importing "in place" and packages
Simon Peyton-Jones wrote: Anyway, the solution for you is to install it. I can't install it, the package isn't finished being built at that point. Or perhaps I could find a way of installing the partial package to the user database. I build part of package javavm. Then I use that to build ShowClasses. Then I run ShowClasses to generate more source files. Then I use those to build the rest of javavm. -- Ashley Yakeley ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: importing "in place" and packages
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. Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:glasgow- | [EMAIL PROTECTED] On Behalf Of Ashley Yakeley | Sent: 22 December 2006 10:44 | To: glasgow-haskell-users@haskell.org | 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@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
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@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users