[FIX]: Fix libpng ARM source inclusion for non-Darwin AArch64 CMake builds - #2302
Open
x15sr71 wants to merge 1 commit into
Open
[FIX]: Fix libpng ARM source inclusion for non-Darwin AArch64 CMake builds#2302x15sr71 wants to merge 1 commit into
x15sr71 wants to merge 1 commit into
Conversation
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 2feb09a...:
Your PR breaks these cases:
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:
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. |
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 9f78685...:
Your PR breaks these cases:
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:
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In raising this pull request, I confirm the following (please check boxes):
Reason for this PR:
Sanity check:
Repro instructions:
CMakeLists.txt.Issue
Building CCExtractor from source with CMake on Linux AArch64 (Ubuntu 24.04, GCC 13.3, CMake 3.28) fails at link time:
The identical commit builds cleanly on Apple Silicon macOS.
Root Cause
Bundled libpng (
thirdparty/libpng/pngpriv.h) auto-enables ARM NEON code paths (PNG_ARM_NEON_OPT=2) whenever the compiler defines__ARM_NEON/__ARM_NEON__— which GCC/clang do unconditionally on any aarch64 target, since NEON is mandatory in the AArch64 ISA. This causespngrtran.candpngrutil.cto reference NEON symbols regardless of OS.However,
src/CMakeLists.txtonly compiled the NEON implementation sources (thirdparty/libpng/arm/*.c) underDarwin+arm64:On Linux AArch64 the symbols are referenced but never defined, producing the undefined-reference errors above.
Fix
Split the OS-specific include-path logic from the architecture-specific source-selection logic, and gate the latter on the target processor (
CMAKE_SYSTEM_PROCESSOR) rather than host + OS:CMAKE_SYSTEM_PROCESSOR(target arch) is used instead ofCMAKE_HOST_SYSTEM_PROCESSOR(build-machine arch), which is also the technically correct variable for this decision and fixes a latent cross-compilation bug in the original code (host arch and target arch only happened to match for native builds).Behavior on macOS Intel, Apple Silicon, and Linux x86_64 is unchanged.
Testing
filter_neon_intrinsics.c.oandpalette_neon_intrinsics.c.o), which were absent before the change.