[PR #1781] [CLOSED] ## Fix: CMake build on Windows (zlib) and macOS (Leptonica/ARM) #2507

Closed
opened 2026-01-29 17:22:31 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1781
Author: @Yashbhu
Created: 12/7/2025
Status: Closed

Base: masterHead: fix/windows-cmake-zlib


📝 Commits (5)

  • ed7cacc done
  • aa8df4c Remove build_and_test.sh helper script
  • 3dad4b8 docs: Add CMake build fixes to CHANGES.TXT
  • aa0ef7f Fix code review issues: remove duplicate pkg_check_modules and handle multiple Leptonica paths
  • ecf201d Address code review feedback

📊 Changes

4 files changed (+93 additions, -2 deletions)

View changed files

📝 .github/workflows/build_windows.yml (+43 -0)
📝 docs/CHANGES.TXT (+1 -0)
📝 src/CMakeLists.txt (+36 -2)
📝 src/lib_ccx/CMakeLists.txt (+13 -0)

📄 Description

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • 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.

{pull request content here}
this pull request fixes #1352

Problem

  • Windows: CMake build fails with LNK1104: cannot open file 'zlib.lib' when zlib is not installed externally
  • macOS: Build fails with fatal error: 'leptonica/allheaders.h' file not found due to pkg-config returning .../include/leptonica instead of parent directory
  • macOS ARM: Missing NEON symbols when building for Apple Silicon because ARM-specific libpng sources weren't included

Solution

Windows (zlib)

  • Build bundled zlib as static library instead of requiring external dependency
  • Link zlib_static into the executable

macOS (Leptonica)

  • Extract parent directory from pkg-config include paths
  • Add both .../include/leptonica and .../include to compiler search paths

macOS (Apple Silicon)

  • Detect ARM architecture using multiple CMake variables for broader compatibility
  • Include ARM-optimized libpng sources when building for arm64/aarch64

CI

  • Add Windows CMake build job to catch regressions

Files Changed

  • CMakeLists.txt - zlib static lib, Leptonica includes, ARM detection
  • CMakeLists.txt - Leptonica includes for libccx
  • build_windows.yml - Windows CMake CI job
  • CHANGES.TXT - Changelog entry

Notes

Legacy Visual Studio project (ccextractor.vcxproj) still uses external zlib.lib - not changed in this PR.


proof
Screenshot 2025-12-07 at 11 27 46 PM


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/1781 **Author:** [@Yashbhu](https://github.com/Yashbhu) **Created:** 12/7/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fix/windows-cmake-zlib` --- ### 📝 Commits (5) - [`ed7cacc`](https://github.com/CCExtractor/ccextractor/commit/ed7cacc8df50a0606c8e5a4f093846d2cdd7fa6d) done - [`aa8df4c`](https://github.com/CCExtractor/ccextractor/commit/aa8df4c86ae03227a863e8218f7a1ecef50197dc) Remove build_and_test.sh helper script - [`3dad4b8`](https://github.com/CCExtractor/ccextractor/commit/3dad4b8ec9a3777fa4d56f4614cff9680f543bed) docs: Add CMake build fixes to CHANGES.TXT - [`aa0ef7f`](https://github.com/CCExtractor/ccextractor/commit/aa0ef7f59db502041f7b85fb7dad12a5cdd19693) Fix code review issues: remove duplicate pkg_check_modules and handle multiple Leptonica paths - [`ecf201d`](https://github.com/CCExtractor/ccextractor/commit/ecf201d632c815fc7004115aed731946fe0cd10d) Address code review feedback ### 📊 Changes **4 files changed** (+93 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/build_windows.yml` (+43 -0) 📝 `docs/CHANGES.TXT` (+1 -0) 📝 `src/CMakeLists.txt` (+36 -2) 📝 `src/lib_ccx/CMakeLists.txt` (+13 -0) </details> ### 📄 Description <!-- Please prefix your pull request with one of the following: **[FEATURE]** **[FIX]** **[IMPROVEMENT]**. --> **In raising this pull request, I confirm the following (please check boxes):** - [x] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md). - [x] I have checked that another pull request for this purpose does not exist. - [x] I have considered, and confirmed that this submission will be valuable to others. - [x] I accept that this submission may not be used, and the pull request closed at the will of the maintainer. - [x] I give this submission freely, and claim no ownership to its content. - [x] **I have mentioned this change in the [changelog](https://github.com/CCExtractor/ccextractor/blob/master/docs/CHANGES.TXT).** **My familiarity with the project is as follows (check one):** - [ ] 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. --- {pull request content here} this pull request fixes #1352 ### Problem - **Windows**: CMake build fails with `LNK1104: cannot open file 'zlib.lib'` when zlib is not installed externally - **macOS**: Build fails with `fatal error: 'leptonica/allheaders.h' file not found` due to pkg-config returning `.../include/leptonica` instead of parent directory - **macOS ARM**: Missing NEON symbols when building for Apple Silicon because ARM-specific libpng sources weren't included ### Solution **Windows (zlib)** - Build bundled zlib as static library instead of requiring external dependency - Link `zlib_static` into the executable **macOS (Leptonica)** - Extract parent directory from pkg-config include paths - Add both `.../include/leptonica` and `.../include` to compiler search paths **macOS (Apple Silicon)** - Detect ARM architecture using multiple CMake variables for broader compatibility - Include ARM-optimized libpng sources when building for arm64/aarch64 **CI** - Add Windows CMake build job to catch regressions ### Files Changed - CMakeLists.txt - zlib static lib, Leptonica includes, ARM detection - CMakeLists.txt - Leptonica includes for libccx - build_windows.yml - Windows CMake CI job - CHANGES.TXT - Changelog entry ### Notes Legacy Visual Studio project (ccextractor.vcxproj) still uses external `zlib.lib` - not changed in this PR. --- proof <img width="758" height="169" alt="Screenshot 2025-12-07 at 11 27 46 PM" src="https://github.com/user-attachments/assets/43eaec45-00fd-4dc3-baf8-eedd7d2107f9" /> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:22:31 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2507