creating packages

S.D.Mechveliani [email protected]
Tue, 29 May 2001 12:44:42 +0400


Who could, please, consult on the package setting in  ghc-5.00.1
?
Let the project  foo  consist of the files   /t/A.hs
                                             /t/t1/B.hs,
B  import  A,
the user work in  /u/  and exploit  foo  in compiling, linking
and interpreting.

Everything seems to work below, except  `ghci -package' 
and                                     `ghc -c -package-name foo'

(ghc-5.00.1 compiled from source for Linux, i386-unknown). 
What I do:

-------------------------------------------------
* apply   ghc --make B;
* move all  *.o  *.hi  files to   /t/export/ ;
* command  cd /t/export/
           ar -q libHSfoo.a *.o    (creating a library)

* create a file  p.txt  containing

  Package {name            = "foo",
           import_dirs     = ["/t/export" ],
           source_dirs     = [],
           library_dirs    = ["/t/export" ],
           hs_libraries    = ["HSfoo"],
           extra_libraries = [],
           include_dirs    = [],    c_includes      = [],
           package_deps    = [],    extra_ghc_opts  = [],
           extra_cc_opts   = [],    extra_ld_opts   = []
          }
  and apply                       ghc-pkg -a < p.txt
  adding a package  foo  to  ghc.
-------------------------------------------------

Then, for the user module   /u/Main.hs
importing  B,
the user commands    cd /u;   ghc -c -package foo Main.hs
                              ghc -o run Main.o -package foo
- and it works.
But              ghci -package foo
yields
  Loading package foo ... can't find .o or .so/.DLL for: HSfoo 
  (libHSfoo.so: cannot open shared object file: No such file or directory)

Then, I added          /t/export/libHSdocon.so,  
but it does not help.

Also             ghc -c -package-name foo C.hs
does not work.
May              ghc -c -package-name 

do automatically all this mess with moving .o, .hi files and 
archivating?

Thank you in advance for the help.

-----------------
Serge Mechveliani
[email protected]