Skip to content

fix: add link_directories for tesseract/leptonica on macOS#2186

Merged
cfsmp3 merged 1 commit intoCCExtractor:masterfrom
DhanushVarma-2:fix/macos-ocr-link-dirs
Mar 15, 2026
Merged

fix: add link_directories for tesseract/leptonica on macOS#2186
cfsmp3 merged 1 commit intoCCExtractor:masterfrom
DhanushVarma-2:fix/macos-ocr-link-dirs

Conversation

@DhanushVarma-2
Copy link
Contributor

Fixes linker failure when building with -DWITH_OCR=ON -DWITH_HARDSUBX=ON on macOS arm64 (Homebrew).

pkg_check_modules populates TESSERACT_LIBRARY_DIRS and LEPTONICA_LIBRARY_DIRS but these were never passed to the linker. Added link_directories() calls in both the OCR and HARDSUBX sections of CMakeLists.txt.

Tested on macOS arm64 with Homebrew tesseract 5.5.1 and leptonica 1.86.0.

Copy link
Contributor

@cfsmp3 cfsmp3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CMake link_directories fix is correct and we'd like to merge it — but the PR also includes unrelated mp4.c changes (ENABLE_FFMPEG_MP4 track counting) that belong in #2170.

Please remove the mp4.c changes from this PR so we can merge the tesseract/leptonica fix cleanly.

pkg_check_modules provides library names without paths.
Without link_directories, the linker cannot find tesseract
and leptonica on systems where they are not in default
search paths (e.g. Homebrew on macOS arm64).
@DhanushVarma-2 DhanushVarma-2 force-pushed the fix/macos-ocr-link-dirs branch from bb87e7f to bfa714b Compare March 15, 2026 16:53
@DhanushVarma-2 DhanushVarma-2 requested a review from cfsmp3 March 15, 2026 17:00
@DhanushVarma-2
Copy link
Contributor Author

The CMake link_directories fix is correct and we'd like to merge it — but the PR also includes unrelated mp4.c changes (ENABLE_FFMPEG_MP4 track counting) that belong in #2170.

Please remove the mp4.c changes from this PR so we can merge the tesseract/leptonica fix cleanly.

Done 👍

@ccextractor-bot
Copy link
Collaborator

CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit ed7f544...:
Report Name Tests Passed
Broken 10/13
CEA-708 2/14
DVB 3/7
DVD 3/3
DVR-MS 2/2
General 25/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 75/86
Teletext 20/21
WTV 13/13
XDS 34/34

Your PR breaks these cases:

  • ccextractor --autoprogram --out=srt --latin1 --quant 0 85271be4d2...
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla dab1c1bd65...
  • ccextractor --out=srt --latin1 --autoprogram 29e5ffd34b...
  • ccextractor --out=spupng c83f765c66...
  • ccextractor --cbraw --out=srt c83f765c66...
  • ccextractor --no-sync --out=srt c83f765c66...
  • ccextractor --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...
  • ccextractor --startcreditsnotbefore 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...
  • ccextractor --startcreditsforatleast 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...

NOTE: The following tests have been failing on the master branch as well as the PR:

Congratulations: Merging this PR would fix the following tests:

  • ccextractor --startcreditsnotafter 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsforatmost 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never

It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you).

Check the result page for more info.

@ccextractor-bot
Copy link
Collaborator

CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit ed7f544...:
Report Name Tests Passed
Broken 10/13
CEA-708 2/14
DVB 3/7
DVD 3/3
DVR-MS 2/2
General 25/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 75/86
Teletext 20/21
WTV 13/13
XDS 34/34

Your PR breaks these cases:

  • ccextractor --autoprogram --out=srt --latin1 --quant 0 85271be4d2...
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla dab1c1bd65...
  • ccextractor --out=srt --latin1 --autoprogram 29e5ffd34b...
  • ccextractor --out=spupng c83f765c66...
  • ccextractor --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...
  • ccextractor --startcreditsnotbefore 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...
  • ccextractor --startcreditsnotafter 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...
  • ccextractor --startcreditsforatleast 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...
  • ccextractor --startcreditsforatmost 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...

NOTE: The following tests have been failing on the master branch as well as the PR:


It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you).

Check the result page for more info.

Copy link
Contributor

@cfsmp3 cfsmp3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean fix — adds link_directories() for tesseract/leptonica so macOS Homebrew builds can find the libraries. No-op on Linux. Builds clean, tested.

@cfsmp3 cfsmp3 merged commit 5c87a33 into CCExtractor:master Mar 15, 2026
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants