From 54387db6e7953815d79444eb6ffd0f7694327657 Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Sat, 14 Apr 2012 14:51:41 +0200 Subject: [PATCH] Makefile: GHCi still broken although http://stackoverflow.com/questions/10123040/ghci-doesnt-work-with-ffi-export-declarations-shared-libaries fixed an issue, there is now a different one: > $ make ghci > [...] > Ok, modules loaded: Main, Mate.X86CodeGen, Mate.MethodPool, Mate.BasicBlocks, Mate.Utilities. > Prelude Main> main > > > GHCi runtime linker: fatal error: I found a duplicate definition for symbol > MateziUtilities_lookupMethod_srt > whilst processing object file > ./Mate/Utilities.o > This could be caused by: > * Loading two different object files which export the same symbol > * Specifying the same object file twice on the GHCi command line > * An incorrect `package.conf' entry, causing some object to be > loaded twice. > GHCi cannot safely continue in this situation. Exiting now. Sorry. > > make: *** [ghci] Error 1 so, `make ghci' and `make tags' still doesn't work due to FFI stuff. we have to use `make test' until we fix it :-( --- Makefile | 22 ++++++++++++++++------ trap.c => ffi/trap.c | 0 2 files changed, 16 insertions(+), 6 deletions(-) rename trap.c => ffi/trap.c (100%) diff --git a/Makefile b/Makefile index 3501621..c171267 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,15 @@ JAVAC := javac JAVA_FILES := $(wildcard tests/*.java) CLASS_FILES := $(JAVA_FILES:.java=.class) HS_FILES := $(wildcard Mate/*.hs) +O_FILES = $(shell ls Mate/*.o) $(wildcard ffi/*.o) +PACKAGES_ := bytestring harpy hs-java +PACKAGES := $(addprefix -package ,$(PACKAGES_)) -GHC_OPT := -Wall -O2 -fno-warn-unused-do-bind +GHC_OPT := -Wall -O0 -fno-warn-unused-do-bind +GHC_LD := -optl-Xlinker -optl-x + + +.PHONY: all test clean ghci all: mate $(CLASS_FILES) @@ -15,13 +22,16 @@ test: mate $(CLASS_FILES) %.class: %.java $(JAVAC) $< -trap.o mate: Mate.hs trap.c $(HS_FILES) - ghc --make $(GHC_OPT) Mate.hs trap.c -o mate +mate: Mate.hs ffi/trap.c $(HS_FILES) + ghc --make $(GHC_OPT) Mate.hs ffi/trap.c -o $@ $(GHC_LD) clean: - rm -f {Mate/,}*.hi {Mate/,}*.o mate tests/*.class + rm -f {Mate/,}*.hi {Mate/,ffi,}*.o mate tests/*.class + +ghci: mate + ghci $(PACKAGES) $(O_FILES) Mate.hs $(GHC_LD) -tags: Mate.hs $(HS_FILES) trap.o +tags: mate @# @-fforce-recomp, see @# http://stackoverflow.com/questions/7137414/how-do-i-force-interpretation-in-hint - ghc -fforce-recomp -e :ctags $^ + ghc -fforce-recomp -e :ctags $(PACKAGES) $(HS_FILES) $(O_FILES) Mate.hs diff --git a/trap.c b/ffi/trap.c similarity index 100% rename from trap.c rename to ffi/trap.c -- 2.25.1