ghc-pkg, recompilation check
Serge D. Mechveliani
mechvel at botik.ru
Mon Jun 6 10:42:24 EDT 2005
Dear GHC developers and users,
Could you, please, help with ghc-pkg ?
(in ghc-6.4)
The contrived testing project is of the two small modules
M1.hs, M2.hs.
(find enclosed the source).
`Makefile' is set so that make dm
should compile the modules and put *.hi, *.o modules and .a, .o
libraries to $(s)/export/.
It also needs to create a package dm-1.0 (in 6.2.2 it was dm ).
A particular command in Makefile is
ghc-pkg -f $(s)/dm-1.0.conf -u -g
, which (as I recall) makes the .o library from .a one.
It worked in 6.2.2
-- with dm instead of dm-1.0, with `=' instead of `:' and
with
package_deps = ["data"]
in the package specification.
And in 6.4, make dm
reports
...
" Reading package info from stdin... done.
ghc-pkg: invalid package identifier:
"
Packages always were difficult. And in 6.4 they are changed again ...
Question 2: recompilation
-------------------------
Why does it recompile both modules when after the first make dm
we remove the .a library and repeat make dm
?
This recompilation bites when there are many modules.
Thank you in advance for explanation.
------------------
Serge Mechveliani
mechvel at botik.ru
------------------------------------------------------------
module M1 -- file M1.hs
where
tuple31 :: (a, b, c) -> a
tuple31 (x, _ ,_) = x
--------------------------------- file M2.hs
module M2
where
import qualified Data.Set as Set (Set(..), singleton)
import M1 (tuple31)
f :: Set.Set Bool
f = Set.singleton $ tuple31 (True, False, False)
-- Makefile ------------------------------------------------------
ghcBinDir = /usr/bin
s = /home/mechvel/ghc/6.4/pkgTest
e = $(s)/export
ghc = $(ghcBinDir)/ghc
ghcpkg = $(ghcBinDir)/ghc-pkg
RANLIB = ar -s
HCFlags = -odir $(e) -hidir $(e) -ddump-hi-diffs
pack = Package {name : ["\"dm-1.0\""], \
import_dirs : ["\"$(e)\""], \
source_dirs : [], \
library_dirs : ["\"$(e)\""], \
hs_libraries : ["\"HSdm\""], \
extra_libraries : [], \
include_dirs : [], \
c_includes : [], \
package_deps : [], \
extra_ghc_opts : [], \
extra_cc_opts : [], \
extra_ld_opts : [] }
# of 6.2.2: name = ["\"dm\""], \
# package_deps = [\"data\"], \
obj:
if [ ! -d $(e) ]; then mkdir $(e); fi
$(ghc) $(HCFlags) --make M2 -package-name dm-1.0
dm: obj
rm -f $(e)/libHSdm* $(e)/HSdm*
ar -qc $(e)/libHSdm.a $(wildcard $(e)/*.o)
$(RANLIB) $(e)/libHSdm.a
$(RANLIB) $(e)/libHSdm.a
echo $(pack) | $(ghcpkg) -f $(s)/dm-1.0.conf -u -g
$(ghcpkg) -f $(s)/dm-1.0.conf -l
------------------------------------------------------------------
make dm
yields
-----------------------------------------------------------
if [ ! -d /home/mechvel/ghc/6.4/pkgTest/export ];
then mkdir /home/mechvel/ghc/6.4/pkgTest/export; fi
/usr/bin/ghc -odir /home/mechvel/ghc/6.4/pkgTest/export
-hidir /home/mechvel/ghc/6.4/pkgTest/export -ddump-hi-diffs
--make M2 -package-name dm-1.0
Chasing modules from: M2
Source file changed or recompilation check turned off
Compiling M1 ( ./M1.hs, /home/mechvel/ghc/6.4/pkgTest/export/M1.o )
No old interface file
Source file changed or recompilation check turned off
Compiling M2 ( M2.hs, /home/mechvel/ghc/6.4/pkgTest/export/M2.o )
No old interface file
rm -f /home/mechvel/ghc/6.4/pkgTest/export/libHSdm*
/home/mechvel/ghc/6.4/pkgTest/export/HSdm*
ar -qc /home/mechvel/ghc/6.4/pkgTest/export/libHSdm.a
/home/mechvel/ghc/6.4/pkgTest/export/M1.o
/home/mechvel/ghc/6.4/pkgTest/export/M2.o
ar -s /home/mechvel/ghc/6.4/pkgTest/export/libHSdm.a
ar -s /home/mechvel/ghc/6.4/pkgTest/export/libHSdm.a
echo Package {name : ["\"dm-1.0\""],
import_dirs : ["\"/home/mechvel/ghc/6.4/pkgTest/export\""],
source_dirs : [],
library_dirs : ["\"/home/mechvel/ghc/6.4/pkgTest/export\""],
hs_libraries : ["\"HSdm\""], extra_libraries : [],
include_dirs : [],
c_includes : [],
package_deps : [],
extra_ghc_opts : [],
extra_cc_opts : [],
extra_ld_opts : [] }
|
/usr/bin/ghc-pkg -f /home/mechvel/ghc/6.4/pkgTest/dm-1.0.conf -u -g
Reading package info from stdin... done.
ghc-pkg: invalid package identifier:
make: *** [dm] Error 1
----------------------------------------------------------
More information about the Glasgow-haskell-users
mailing list