Reputation: 262
My makefile (Windows 10, MSYS2) fails at the last step with:
Finished prerequisites of target file 'lib/espeak_mini.lib'.
Must remake target 'lib/espeak_mini.lib'.
Unhandled exception filter called from program make
ExceptionCode = c0000005
ExceptionFlags = 0
ExceptionAddress = 0x00007FFF80E6F398
Access violation: write operation at address 0x0000000102ADDB4F
The first time you run make all
it compiles all the objects just fine, then crashes before beginning the linking step (ar
never gets called afaik).
For some reason if you then run make all
a 2nd time, it then finishes just fine? If it needs to compile the deps before starting the library make crashes.
Running make clean
and trying again is the same - crash before linking, run again, finishes
Makefile:
CC = clang
WARNINGS = -Wno-attributes -Wno-deprecated-declarations -Wno-pointer-sign -Wno-int-conversion
CFLAGS = -Iinclude -fvisibility=hidden -fno-exceptions -fwrapv $(WARNINGS)
# Set platform specific flags
ifdef OS
RM = del /Q
LIB_EXT = .lib
EXEC_EXT = .exe
FixPath = $(subst /,\,$1)
else
RM = rm -f
LIB_EXT = .a
EXEC_EXT =
FixPath = $1
endif
# Define targets
LIB_OUT = espeak_mini$(LIB_EXT)
OBJ_DIR = obj
LIB_DIR = lib
# UCD sources
_UCD = ucd/case.o ucd/categories.o ucd/ctype.o ucd/proplist.o ucd/scripts.o ucd/tostring.o
UCD = $(patsubst %,$(OBJ_DIR)/%,$(_UCD))
# Espeak sources
_OBJ = common.o mnemonics.o error.o ieee80.o compiledata.o compiledict.o dictionary.o encoding.o intonation.o langopts.o numbers.o phoneme.o phonemelist.o readclause.o setlengths.o soundicon.o spect.o ssml.o synthdata.o synthesize.o tr_languages.o translate.o translateword.o voices.o wavegen.o speech.o espeak_api.o
OBJ = $(patsubst %,$(OBJ_DIR)/%,$(_OBJ))
# Obj compilation rule
$(OBJ_DIR)/%.o: src/%.c
$(CC) -c -o $@ $< $(CFLAGS)
# Clean up rule
clean:
$(RM) $(call FixPath, $(OBJ_DIR)/*.o $(OBJ_DIR)/ucd/*.o $(OBJ_DIR)/*.d $(OBJ_DIR)/ucd/*.d $(LIB_DIR)/espeak_mini.* example/example$(EXEC_EXT))
# Compiles the static library
all: $(LIB_DIR)/$(LIB_OUT) example/example$(EXEC_EXT)
$(LIB_DIR)/$(LIB_OUT): $(OBJ) $(UCD)
ar rcs -o $@ $^
# Build the example project
example/example$(EXEC_EXT): example/example.c $(LIB_DIR)/$(LIB_OUT)
$(CC) -o $@ $< -Iinclude -L$(LIB_DIR) -lespeak_mini
Upvotes: 0
Views: 31