Skip to content

Fix Windows build: MSVC CRT and GPAC linking#2143

Open
cheron2000 wants to merge 1 commit intoCCExtractor:masterfrom
cheron2000:fix-windows-build
Open

Fix Windows build: MSVC CRT and GPAC linking#2143
cheron2000 wants to merge 1 commit intoCCExtractor:masterfrom
cheron2000:fix-windows-build

Conversation

@cheron2000
Copy link

@cheron2000 cheron2000 commented Feb 25, 2026

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}

[FIX] Fix Windows build: CRT linkage and GPAC integration

TL;DR

Fixes Windows build failures by enforcing dynamic MSVC CRT (/MD) across all targets (C, C++, Rust) and correcting GPAC linking. No impact on Linux/macOS.

Changes included:

1. CRT Configuration

  • Added a global MSVC runtime policy (/MD) in src/CMakeLists.txt to enforce dynamic CRT across all targets.
  • Explicitly set the ccx library target to use dynamic CRT in src/lib_ccx/CMakeLists.txt.
  • Overrode Rust library's default static CRT in src/rust/CMakeLists.txt.

2. GPAC Integration

  • Added GPAC library directories for linking in src/CMakeLists.txt and src/lib_ccx/CMakeLists.txt.
  • Updated include and library paths to ensure GPAC is properly found on Windows.

3. Platform-specific Fixes

  • Wrapped Unix-style linker flags (-lm -lpthread -ldl) in if(NOT WIN32) to prevent Windows warnings.

4. Cleanup

  • Removed redundant/incorrect CRT settings from src/CMakeLists.txt and src/lib_ccx/CMakeLists.txt.

Verification

  • ✅ Windows build completed successfully (Visual Studio 2022, CMake 3.31+)
  • ✅ Executable runs and reports version correctly
  • ✅ No CRT linker errors observed
  • ✅ Linux/macOS builds remain unaffected

Notes

  • GPAC path is currently hardcoded to C:/Program Files/GPAC/sdk/lib; users with different installations may need to update it.
  • Rust CRT override uses /NODEFAULTLIB:libcmt to force dynamic CRT.

This PR improves cross-platform build reliability and cleans up CMake configurations without affecting functionality.

@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 85aa833...:
Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 6/7
DVD 3/3
DVR-MS 2/2
General 25/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 80/86
Teletext 21/21
WTV 13/13
XDS 34/34

Your PR breaks these cases:

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

  • ccextractor --autoprogram --out=srt --latin1 --quant 0 85271be4d2..., Last passed:

    Test 8458

  • ccextractor --autoprogram --out=ttxt --latin1 --ucla dab1c1bd65..., Last passed:

    Test 8458

  • ccextractor --out=srt --latin1 --autoprogram 29e5ffd34b..., Last passed:

    Test 8458

  • ccextractor --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed:

    Test 8458

  • ccextractor --startcreditsnotbefore 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed:

    Test 8458

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

    Test 8458

  • ccextractor --startcreditsforatleast 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed:

    Test 8458

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

    Test 8458


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 85aa833...:
Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 6/7
DVD 3/3
DVR-MS 2/2
General 25/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 81/86
Teletext 21/21
WTV 13/13
XDS 34/34

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

  • ccextractor --autoprogram --out=srt --latin1 --quant 0 85271be4d2..., Last passed:

    Test 8459

  • ccextractor --autoprogram --out=ttxt --latin1 --ucla dab1c1bd65..., Last passed:

    Test 8459

  • ccextractor --out=srt --latin1 --autoprogram 29e5ffd34b..., Last passed:

    Test 8459

  • ccextractor --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed:

    Test 8459

  • ccextractor --startcreditsnotbefore 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed:

    Test 8459

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

    Test 8459

  • ccextractor --startcreditsforatleast 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed:

    Test 8459

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

    Test 8459


This PR does not introduce any new test failures. However, some tests are failing on both master and this PR (see above).

Check the result page for more info.

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.

2 participants