To my two `bug' reports

>> 1:
>> You cannot load my project of 2 small modules, using package:
>>
>>   ghci -package docon B
>>     ...
>>   Loading package docon ... linking ... done.
>>    Compiling B                ( B.hs, interpreted )
>>    ghc-5.02: panic! (the `impossible' happened, GHC version 5.02):
>>            ByteCodeLink.lookupCE A.a{-r41-}

and

>> 2:
>>                                    ghci -package pk Foo
>> loads the interpreted code  Foo.hs,
>> if  Foo.hs  resides in the current directory 
>> and *.o modules are gathered in a library in other directory 
>> referred by  pk.


Simon Marlow <[EMAIL PROTECTED]> responds

1:
> [..] your library files don't contain any objects!
> [..]
> ar -qc [..]  $(wildcard $(e)/\*.o))
> [..]                    $(e)/*.o

2:
> Are you saying that the package 'pk' also contains a module called
> 'Foo'?  If that's the case, then it is really an error for there to also
> be a Foo.hs on the path, and it is likely to lead to trouble as GHC will
> get confused about which one you mean.
> [..]


A small archive is enclosed here that shows both remaining strange 
effects:
  uudecode, unzip --> several files,   read  readme.txt  to install.


1.
Makefile changes to
  ...
  obj:
        ghc  -odir $(e) -hidir $(e)  -package-name docon  --make A

  docon: obj
          rm -f $(e)/libHSdocon.a $(e)/HSdocon.o
          ar -qc $(e)/libHSdocon.a $(wildcard $(e)/*.o)
          $(RANLIB)  $(e)/libHSdocon.a
          ld -r -x --whole-archive $(e)/libHSdocon.a -o $(e)/HSdocon.o

And it works this way:  make init; make obj; make docon

`obj' looks unnecessary here.
But if we bring the command   ghc -odir ... --make A

inside the  docon  target, then `make docon' does not notice the 
appearing file  $(e)/A.o  and expands  $(wildcard $(e)/*.o)  to 
emptyness. I do not understand, why.


2. 
All right, let us, so far, `make' a thing with   make init
                                                 make obj
                                                 make docon
Then, we have   $root/A.hs Makefile readme.txt
                     /d/B.hs
                     /export/A.o A.hi HSDocon.o libHSDocon.a,

  module A exports  a = True,  
  module B imports A and exports  b = a,
  A.o is in package, B is not.

  cd $root
  ghci -package docon
  ...
  Loading package docon ... linking ... done.
  Prelude> A.a
  True                            -- hence, A is visible
  Prelude> :m A
  `A' is not currently loaded     -- BUG ?
  Prelude> :l A
    Source file changed or recompilation check turned off
  Compiling A                ( A.hs, interpreted )         -- BUG ?
  ...
  A>

And in  $root/d,  it works:

  cd $root/d
  ghci -package docon
  ...
  Prelude> :l A
  module `A' is a package module
  Prelude> :m A          
  A> a
  True
  A> :l B
  ...       ( B.hs, interpreted )
  ...
  B> b      -- B contains  b = A.a
  True
  B>

     
-----------------
Serge Mechveliani
[EMAIL PROTECTED]







_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to