Skip to content

[android] build libxml2 and curl with -fPIC on Windows #76262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

andrurogerz
Copy link
Contributor

Purpose

Defines CMAKE_POSITION_INDEPENDENT_CODE=YES when building libxml2 and curl on Windows with build.ps1. Defining this property makes build.ps consistent with the Python build scripts swift_build_support\products\libxml2.py and swift_build_support\products\curl.py.

Problem Details

Android i686/x86 binaries fail to link against libraries compiled without -fPIC.

Validation

Successfully built swift toolchain locally with the following command on Windows:

S:\SourceCache\swift\utils\build.cmd -AndroidSDKs x86_64,aarch64,i686

This command previously failed linking with i686 libcurl due to not being compiled with -fPIC.

Sets `CMAKE_POSITION_INDEPENDENT_CODE=YES` when building libxml2 and
curl. This causes `-fPIC` to be passed to clang when compiling, which is
required for the i686 Android build to succeed.

This change makes `build.ps1` consistent with the Python build files
swift_build_support\products\libxml2.py and
swift_build_support\products\curl.py, which already define this cmake
property. It is already propertly set for zlib in both locations.
@compnerd
Copy link
Member

compnerd commented Sep 4, 2024

@swift-ci please smoke test

@compnerd compnerd enabled auto-merge September 4, 2024 18:37
@compnerd compnerd merged commit fa54a4c into swiftlang:main Sep 4, 2024
3 checks passed
@andrurogerz andrurogerz deleted the android-PIC branch November 7, 2024 01:13
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