Closed Vitiated-dev closed 10 months ago
Had a similar issue. The error message I got is:
Makefile:231: *** Invalid file operation: <data/foo-ground-truth/menzel_literatur01_1828_0238_006.gt.txt. Stop.
I can find that file from the path:
ls data/foo-ground-truth/menzel_literatur01_1828_0238_006.gt.txt
data/foo-ground-truth/menzel_literatur01_1828_0238_006.gt.txt
The file content looks good.
So Debian releases starting from Debian Buster and later are not affected because they provide a sufficiently new version of make. Version 4.2 was released in 2016. But macOS comes with GNU Make 3.81 and won't work.
Makefile should check MAKE_VERSION
and show a hint if the version is too old. And ideally it should work on macOS with the old version of make, too.
So Debian releases starting from Debian Buster and later are not affected because they provide a sufficiently new version of make. Version 4.2 was released in 2016. But macOS comes with GNU Make 3.81 and won't work.
Makefile should check
MAKE_VERSION
and show a hint if the version is too old. And ideally it should work on macOS with the old version of make, too.
Very true.
Something like this?
diff --git a/Makefile b/Makefile
index cff6d2b..5fa7f88 100644
--- a/Makefile
+++ b/Makefile
@@ -121,7 +121,7 @@ endif
# BEGIN-EVAL makefile-parser --make-help Makefile
-help:
+help: default
@echo ""
@echo " Targets"
@echo ""
@@ -171,9 +171,17 @@ help:
# END-EVAL
+default:
+ifeq (4.2, $(firstword $(sort $(MAKE_VERSION) 4.2)))
+ @echo " You are using make version: $(MAKE_VERSION)"
+else
+ $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 4.2 or newer.)
+endif
+
.PRECIOUS: $(LAST_CHECKPOINT)
-.PHONY: clean help leptonica lists proto-model tesseract tesseract-langs tesseract-langdata training unicharset charfreq
+.PHONY: default clean help leptonica lists proto-model tesseract tesseract-langs tesseract-langdata training unicharset charfreq
ALL_FILES = $(and $(wildcard $(GROUND_TRUTH_DIR)),$(shell find -L $(GROUND_TRUTH_DIR) -name '*.gt.txt'))
unexport ALL_FILES # prevent adding this to envp in recipes (which can cause E2BIG if too long; cf. make #44853)
@@ -225,7 +233,7 @@ $(OUTPUT_DIR)/unicharset: $(ALL_GT) | $(OUTPUT_DIR)
endif
# Start training
-training: $(OUTPUT_DIR).traineddata
+training: default $(OUTPUT_DIR).traineddata
$(ALL_GT): $(ALL_FILES) | $(OUTPUT_DIR)
$(if $^,,$(error found no $(GROUND_TRUTH_DIR)/*.gt.txt for $@))
@@ -422,4 +430,4 @@ clean-output:
rm -rf $(OUTPUT_DIR)
# Clean all generated files
-clean: clean-box clean-lstmf clean-output
+clean: default clean-box clean-lstmf clean-output
Looks like it was the make version - upgrading to 4.2 solved the issue and training completes as expected. Thanks @liketheflower!
make version check implemented 25b8508f06365de0fe004fa09871e9bda1b56694
Hello,
I've recently built Tesseract from source for training, and I've run into an issue I have yet to be able to solve.
Any help is greatly appreciated!
The error below is the entire contents of the
nohup.out
file produced by runningnohup make training
.Error
I received this error with the provided sample ground-truth files and my generated ones. This issue occurs with every file in the ground truth directory.
System Information
Python Information
Tesseract Information