> 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;

That should be 
                
        ghc -package-name foo --make B.

because you're building modules for package 'foo'.

> * 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)

GHCi can't load .a files (at the moment).  You can build a .o file from
a .a file like so (with GNU ld):

        ld --whole-archive libHSfoo.a -o libHSfoo.o

Cheers,
        Simon

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

Reply via email to