ccextractor icon indicating copy to clipboard operation
ccextractor copied to clipboard

[BUG] Error in ./configure enabling hardsubx on Mac

Open vr8hub opened this issue 4 years ago • 17 comments

CCExtractor version (using the --version parameter preferably) : 0.88 (I cloned the repository immediately before attempting this)

In raising this issue, I confirm the following (please check boxes, eg [X] - and delete unchecked ones):

  • [X] I have read and understood the contributors guide.
  • [X] I have checked that the bug-fix I am reporting can be replicated, or that the feature I am suggesting isn't already present.
  • [X] I have checked that the issue I'm posting isn't already reported.
  • [X] I have checked that the issue I'm porting isn't already solved and no duplicates exist in closed issues and in opened issues
  • [X] I have checked the pull requests tab for existing solutions/implementations to my issue/suggestion.
  • [X] I have used the latest available version of CCExtractor to verify this issue exists.

My familiarity with the project is as follows (check one, eg [X] - and delete unchecked ones):

  • [ ] I have never used CCExtractor.
  • [X] I have used CCExtractor just a couple of times.
  • [ ] I absolutely love CCExtractor, but have not contributed previously.
  • [ ] I am an active contributor to CCExtractor.

Necessary information

  • Is this a regression (did it work before)? [ ] NO | [ ] YES | [X] UNKNOWN - please specify the last known working version
  • What platform did you use? [ ] Windows - [ ] Linux - [X] Mac
  • What were the used arguments? None

Video links (replace text below with your links) None.

Additional information

I'm trying to compile on Mac (OSX Mojave 10.14.6) with hardsubx support. It took me a while to determine that it's not automatically enabled (the compile guide makes no mention of it but it's in the standard help). I searched the git log and found an issue from 2017 that said that hardsubx was enabled for the Mac, so I'm operating under the assumption that it is available for the Mac. The docs/HARDSUBX.txt don't make mention of the Mac specifically one way or the other, so that may be a bad assumption.

I confirmed that all of the required libraries (tesseract, leptonica, ffmpeg) were available, then did an ./autogen.sh and ./configure --enable-hardsubx --enable-ocr. I'm getting an error on the configure (showing a couple of lines of context):

configure: tesseract library found... tesseract 4.1.1
configure: leptonica library found...  leptonica-1.79.0
./configure: line 6768: test: -ltesseract: binary operator expected
checking that generated files are newer than configure... done

Line 6768 is:

if  test ! -z  `pkg-config --libs-only-l --silence-errors tesseract`; then

I ran pkg-config --libs-only-l --silence-errors tesseract manually and receive

-ltesseract -lcurl

I'm not conversant enough in autotools to know what the problem is, but it appears that the configure test is not anticipating that type of return.

Is this a problem in the configure or with the return of the pkg-config? The indicated pre-configure tests to confirm that tesseract and leptonica were installed all worked, and the configure found the tesseract library.

vr8hub avatar Jan 08 '20 15:01 vr8hub

@vr8hub Seems fixed in current master, feel free to reopen if you still have problems.

cfsmp3 avatar Jan 25 '20 22:01 cfsmp3

Sorry, I've just now been able to get back to this.

I did a git pull and tried it again and received the exact same error. I then completely deleted the local repository, did a git clone to start over, and tried it again, with the same result.

configure: leptonica library found...  leptonica-1.79.0
./configure: line 6768: test: -ltesseract: binary operator expected
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile

The error is on the same line as before, and that line is the same in the configure script as before. So not sure what changed in master, but it doesn't seem to have made its way to the Mac folder.

vr8hub avatar Feb 15 '20 20:02 vr8hub

I don't have a Linux VM handy, so I don't know what the above pkg-config command returns there. But in playing with this on the Mac, it appears that the leading dash on the return (-ltesseract -lcurl, see above) is the problem, and that's a problem because it isn't quoted and so looks like an option.

So it looks like just quoting the output will work:

if  test ! -z  "`pkg-config --libs-only-l --silence-errors tesseract`"; then

I tried this manually, and it returned a 1. I then changed "tesseract" to "abc" to test for a non-existent library, and it returned a 0. So I think it's working, if I understand what the test is trying to do.

I don't know if quoting will work on Linux, but it appears that configure.ac is already different for Linux and Mac, so maybe it's OK even if it doesn't work there.

vr8hub avatar Feb 16 '20 00:02 vr8hub

As near as I can tell, this works from a compile perspective. I ran

./configure --enable-hardsubx --enable-ocr

The Makefile includes the references to the hardsubx modules. Then a subsequent

make ENABLE_HARDSUBX=yes ENABLE_OCR=yes

generates several hardsubx .o files in src/lib_ccx, so it looked like the make worked as well. So I thought the ccextractor would work.

But, a subsequent invocation still says that -hardsubx is not understood.

I first tried something very simple, e.g. ./ccextractor -hardsubx <filename>, then I tried the sample composite command on the Google Summer of Code page for hardsubx.

Both just return this:

Error: Error: Parameter -hardsubx not understood.

CCExtractor 0.88, Carlos Fernandez Sanz, Volker Quetschke.
Teletext portions taken from Petr Kutalek's telxcc
--------------------------------------------------------------------------
Issues? Open a ticket here
https://github.com/CCExtractor/ccextractor/issues

I looked at the Makefile, and the hardsubx files (ccextractor-hardsubx.o, -hardsubx-classifier.o, -hardsubx_decoder.o, -hardsubx_imgops.o, -hardsubx_utility.o) are all mentioned in the final gcc command that produces the executable.

There are no other ccextractor executables on my system. I am invoking it with ./ccextractor to ensure I'm getting the one just built in the Mac directory.

I'm at a loss as to what else to check.

vr8hub avatar Feb 16 '20 00:02 vr8hub

Just edit src/lib_ccx/parms.c and add

#define ENABLE_HARDSUBX near the top of the file (before the first #ifdef ENABLE_HARDSUBX )

That will force ccextractor to accept the parameter and/or give us an idea about what's going on there.

cfsmp3 avatar Feb 16 '20 01:02 cfsmp3

That worked. So I went looking at Makefile and discovered that am__append_4 had a # in front of the enable. I then ran another configure, which got rid of the comment. Ergo, I ran make clean, but apparently did not precede it with another ./configure. My apologies for the noise. ([Edit] But I had to have, otherwise I wouldn't have known the quoting worked. Hmmm. I don't know what happened. Bottom line, the problem was a commented out am__append_4, and another configure fixed that. But I don't know why it was commented out in the first place.)

That leaves us with the above quoting works, at least for the Mac. Since I don't know what the return from the command on Linux is, I don't know if that's a good overall solution or not, but it at least gets me working for now. Thank you for your help, and I again apologize for the noise on the executable.

vr8hub avatar Feb 16 '20 02:02 vr8hub

I'm also having this problem on mac. So I first run ./autogen.sh and then quote the part in line 6768 of configure.

Then run

./configure --enable-hardsubx --enable-ocr
make ENABLE_HARDSUBX=yes ENABLE_OCR=yes

This runs with no error.

But ./ccextractor --hardsubx still doesn't recognize --hardsubx.

Error: Error: Parameter --hardsubx not understood.

CCExtractor 0.88, Carlos Fernandez Sanz, Volker Quetschke.
Teletext portions taken from Petr Kutalek's telxcc

What can I do now?

johan456789 avatar Jul 20 '20 18:07 johan456789

After running configure did you actually run make && make install ?

cfsmp3 avatar Jul 20 '20 21:07 cfsmp3

No I only ran make ENABLE_HARDSUBX=yes ENABLE_OCR=yes.

So if I run

./configure --enable-hardsubx --enable-ocr
make && make install

I would get this error in the end:

 /usr/local/bin/gmkdir -p '/usr/local/bin'
  /usr/local/bin/ginstall -c ccextractor '/usr/local/bin'
make[1]: Nothing to be done for `install-data-am'.

johan456789 avatar Jul 21 '20 04:07 johan456789

configure by itself is not enough. Anyway it seems like make itself was successful, so probably you have a working binary in the build directory, even if install failed for some reason.

cfsmp3 avatar Jul 21 '20 15:07 cfsmp3

Thanks for the help, but no, the output binary still doesn't recognize --hardsubx.

The same error

Error: Error: Parameter --hardsubx not understood.

johan456789 avatar Jul 21 '20 16:07 johan456789

No idea what the install problem is—that’s a separate issue.

But you have to run both configure and make with the ENABLEs. You’ve only done one or the other.

vr8hub avatar Jul 21 '20 16:07 vr8hub

What are the commands you run?

I tried this and it still doesn't work. I suppose I'm running both here?

./configure --enable-hardsubx --enable-ocr
make ENABLE_HARDSUBX=yes ENABLE_OCR=yes && make install

johan456789 avatar Jul 21 '20 16:07 johan456789

Yes, you are in that instance, your earlier one didn’t. Did you look at the config log to confirm it really was enabled? Did you look at the make log and ensure everything was linked in correctly? Did you ensure you’re running the right executable? (Sorry to ask obvious questions, but the obvious ones are usually my problem.)

I’m not at the computer where I got this working, and it’s been several months, but I originally created the issue and can confirm it does work.

On Jul 21, 2020, at 11:35 AM, johan456789 [email protected] wrote: What are the commands you run?

I tried this and it still doesn't work. I suppose I'm running both here?

./configure --enable-hardsubx --enable-ocr make ENABLE_HARDSUBX=yes ENABLE_OCR=yes && make install

vr8hub avatar Jul 21 '20 16:07 vr8hub

Did you look at the config log to confirm it really was enabled?

Looks like they are not enabled as in configure.log:

HARDSUBX_IS_ENABLED_FALSE='#'
HARDSUBX_IS_ENABLED_TRUE=''
OCR_IS_ENABLED_FALSE='#'
OCR_IS_ENABLED_TRUE=''

Did you look at the make log and ensure everything was linked in correctly?

make outputs no error, some warnings though.

Did you ensure you’re running the right executable?

Yes, I gave the full path.

(Sorry to ask obvious questions, but the obvious ones are usually my problem.)

No worries. It'd be great to pinpoint the problem.

johan456789 avatar Jul 21 '20 17:07 johan456789

Unfortunately, you're the only one with your files, so you're going to have to follow the chain all the way through. I had to do the same thing; it's how I found the issue to start with.

Does your config.log show the right flags passed to it at the top? Does your config.out show the two libraries that are required? (One of them is tesseract something, which I only remember because Marvel; I don't remember the other one) Did your Makefile get the correct flags, i.e. if everything worked, then the makefile should have gotten the -DENABLE_HARDSUB (and corresponding OCR) in it. See the Makefile.am for what to look for. Capture the make output; does that output have the right link flags in it?

And so on.

I don't need answers to the questions. :) I'm just giving you questions to help you with your debugging process.

vr8hub avatar Jul 21 '20 17:07 vr8hub

Thanks for the help, but no, the output binary still doesn't recognize --hardsubx.

The same error

Error: Error: Parameter --hardsubx not understood.

@johan456789 the parameter you need to use is -hardsubx not --hardsubx.

cottuli avatar Mar 21 '21 05:03 cottuli