Skip to content

[python3] build failure for iOS #20214

@agnickolov

Description

@agnickolov

Host Environment

  • Host OS: MacOS
  • Target OS: iOS
  • Compiler: AppleClang / Xcode 12..5.1

To Reproduce
Steps to reproduce the behavior:
Define a CMake project on MacOS that cross-compiles to iOS.
Add a dependency to Boost in its vcpkg manifest.
vcpkg fails to build python3 for iOS, which is one of the dependencies for Boost.
./vcpkg install xxxx

Failure logs
-Cut and paste the appropriate build messages from the console output.

Starting package 1/53: python3:arm64-ios
Building package python3[core]:arm64-ios...
-- Using community triplet arm64-ios. This triplet configuration is not guaranteed to succeed.
-- [COMMUNITY] Loading triplet configuration from: /Users/alexander.nickolov/git/vcpkg/triplets/community/arm64-ios.cmake
-- Installing port from location: /Users/alexander.nickolov/git/vcpkg/buildtrees/versioning/versions/python3/b3a545b39c982b7f0a12891765dd9909e364ebc6
-- Downloading https://github.com/python/cpython/archive/v3.9.7.tar.gz -> python-cpython-v3.9.7.tar.gz...
-- Cleaning sources at /Users/alexander.nickolov/git/vcpkg/buildtrees/python3/src/v3.9.7-de99cf1568.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /Users/alexander.nickolov/git/vcpkg/downloads/python-cpython-v3.9.7.tar.gz
-- Applying patch 0001-static-library.patch
-- Applying patch 0002-use-vcpkg-zlib.patch
-- Applying patch 0003-devendor-external-dependencies.patch
-- Applying patch 0004-dont-copy-vcruntime.patch
-- Applying patch 0005-only-build-required-projects.patch
-- Applying patch 0006-fix-duplicate-symbols.patch
-- Using source at /Users/alexander.nickolov/git/vcpkg/buildtrees/python3/src/v3.9.7-de99cf1568.clean
-- Getting CMake variables for arm64-ios-dbg
-- Getting CMake variables for arm64-ios-rel
-- Configuring arm64-ios-dbg
-- Configuring arm64-ios-rel
-- Building arm64-ios-dbg
-- Installing arm64-ios-dbg
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:155 (message):
    Command failed: /usr/bin/make -j 13 -f Makefile altinstall DESTDIR=/Users/alexander.nickolov/git/vcpkg/packages/python3_arm64-ios
    Working Directory: /Users/alexander.nickolov/git/vcpkg/buildtrees/python3/arm64-ios-dbg
    See logs for more information:
      /Users/alexander.nickolov/git/vcpkg/buildtrees/python3/install-arm64-ios-dbg-out.log
      /Users/alexander.nickolov/git/vcpkg/buildtrees/python3/install-arm64-ios-dbg-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_build_make.cmake:210 (vcpkg_execute_build_process)
  scripts/cmake/vcpkg_install_make.cmake:26 (vcpkg_build_make)
  buildtrees/versioning/versions/python3/b3a545b39c982b7f0a12891765dd9909e364ebc6/portfile.cmake:173 (vcpkg_install_make)
  scripts/ports.cmake:140 (include)


Error: Building package python3:arm64-ios failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `./vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: python3:arm64-ios
  Vcpkg version: 2021-08-12-unknownhash

Additionally, attach any relevant sections from the log files above.
-- Running vcpkg install - failed

-Please attach any additional failure logs mentioned in the console output.
[This is the content of install-arm64-ios-dbg-err.log]

ld: warning: ignoring file /Users/alexander.nickolov/GitHub/tdh-in-session-member-manager/build_ios_arm64/vcpkg_installed/arm64-ios/debug/lib/libssl.a, building for macOS-x86_64 but attempting to link with file built for iOS-arm64
ld: warning: ignoring file /Users/alexander.nickolov/GitHub/tdh-in-session-member-manager/build_ios_arm64/vcpkg_installed/arm64-ios/debug/lib/libcrypto.a, building for macOS-x86_64 but attempting to link with file built for iOS-arm64
ld: warning: ignoring file /Users/alexander.nickolov/GitHub/tdh-in-session-member-manager/build_ios_arm64/vcpkg_installed/arm64-ios/debug/lib/libexpat.a, building for macOS-x86_64 but attempting to link with file built for iOS-arm64
ld: warning: ignoring file /Users/alexander.nickolov/GitHub/tdh-in-session-member-manager/build_ios_arm64/vcpkg_installed/arm64-ios/debug/lib/libexpat.a, building for macOS-x86_64 but attempting to link with file built for iOS-arm64
ld: warning: ignoring file /Users/alexander.nickolov/GitHub/tdh-in-session-member-manager/build_ios_arm64/vcpkg_installed/arm64-ios/debug/lib/libffi.a, building for macOS-x86_64 but attempting to link with file built for iOS-arm64
ld: warning: ignoring file /Users/alexander.nickolov/GitHub/tdh-in-session-member-manager/build_ios_arm64/vcpkg_installed/arm64-ios/debug/lib/libsqlite3.a, building for macOS-x86_64 but attempting to link with file built for iOS-arm64
*** WARNING: renaming "_hashlib" since importing it failed: dlopen(build/lib.macosx-11.5-x86_64-3.9-pydebug/_hashlib.cpython-39d-darwin.so, 2): Symbol not found: _CRYPTO_memcmp
  Referenced from: build/lib.macosx-11.5-x86_64-3.9-pydebug/_hashlib.cpython-39d-darwin.so
  Expected in: flat namespace
 in build/lib.macosx-11.5-x86_64-3.9-pydebug/_hashlib.cpython-39d-darwin.so
*** WARNING: renaming "_sqlite3" since importing it failed: dlopen(build/lib.macosx-11.5-x86_64-3.9-pydebug/_sqlite3.cpython-39d-darwin.so, 2): Symbol not found: _sqlite3_aggregate_context
  Referenced from: build/lib.macosx-11.5-x86_64-3.9-pydebug/_sqlite3.cpython-39d-darwin.so
  Expected in: flat namespace
 in build/lib.macosx-11.5-x86_64-3.9-pydebug/_sqlite3.cpython-39d-darwin.so
*** WARNING: renaming "pyexpat" since importing it failed: dlopen(build/lib.macosx-11.5-x86_64-3.9-pydebug/pyexpat.cpython-39d-darwin.so, 2): Symbol not found: _XML_ErrorString
  Referenced from: build/lib.macosx-11.5-x86_64-3.9-pydebug/pyexpat.cpython-39d-darwin.so
  Expected in: flat namespace
 in build/lib.macosx-11.5-x86_64-3.9-pydebug/pyexpat.cpython-39d-darwin.so
*** WARNING: renaming "_elementtree" since importing it failed: PyCapsule_Import could not import module "pyexpat"
*** WARNING: renaming "_ctypes" since importing it failed: dlopen(build/lib.macosx-11.5-x86_64-3.9-pydebug/_ctypes.cpython-39d-darwin.so, 2): Symbol not found: _ffi_call
  Referenced from: build/lib.macosx-11.5-x86_64-3.9-pydebug/_ctypes.cpython-39d-darwin.so
  Expected in: flat namespace
 in build/lib.macosx-11.5-x86_64-3.9-pydebug/_ctypes.cpython-39d-darwin.so
ld: warning: ignoring file /Users/alexander.nickolov/GitHub/tdh-in-session-member-manager/build_ios_arm64/vcpkg_installed/arm64-ios/debug/lib/libssl.a, building for macOS-x86_64 but attempting to link with file built for iOS-arm64
ld: warning: ignoring file /Users/alexander.nickolov/GitHub/tdh-in-session-member-manager/build_ios_arm64/vcpkg_installed/arm64-ios/debug/lib/libcrypto.a, building for macOS-x86_64 but attempting to link with file built for iOS-arm64
ld: warning: ignoring file /Users/alexander.nickolov/GitHub/tdh-in-session-member-manager/build_ios_arm64/vcpkg_installed/arm64-ios/debug/lib/libexpat.a, building for macOS-x86_64 but attempting to link with file built for iOS-arm64
ld: warning: ignoring file /Users/alexander.nickolov/GitHub/tdh-in-session-member-manager/build_ios_arm64/vcpkg_installed/arm64-ios/debug/lib/libexpat.a, building for macOS-x86_64 but attempting to link with file built for iOS-arm64
/Users/alexander.nickolov/git/vcpkg/buildtrees/python3/src/v3.9.7-de99cf1568.clean/Modules/_ctypes/cfield.c:2:10: fatal error: 'pycore_byteswap.h' file not found
#include "pycore_byteswap.h"      // _Py_bswap32()
         ^~~~~~~~~~~~~~~~~~~
1 error generated.
ld: warning: ignoring file /Users/alexander.nickolov/GitHub/tdh-in-session-member-manager/build_ios_arm64/vcpkg_installed/arm64-ios/debug/lib/libsqlite3.a, building for macOS-x86_64 but attempting to link with file built for iOS-arm64
*** WARNING: renaming "_hashlib" since importing it failed: dlopen(build/lib.macosx-11.5-x86_64-3.9-pydebug/_hashlib.cpython-39d-darwin.so, 2): Symbol not found: _CRYPTO_memcmp
  Referenced from: build/lib.macosx-11.5-x86_64-3.9-pydebug/_hashlib.cpython-39d-darwin.so
  Expected in: flat namespace
 in build/lib.macosx-11.5-x86_64-3.9-pydebug/_hashlib.cpython-39d-darwin.so
*** WARNING: renaming "_sqlite3" since importing it failed: dlopen(build/lib.macosx-11.5-x86_64-3.9-pydebug/_sqlite3.cpython-39d-darwin.so, 2): Symbol not found: _sqlite3_aggregate_context
  Referenced from: build/lib.macosx-11.5-x86_64-3.9-pydebug/_sqlite3.cpython-39d-darwin.so
  Expected in: flat namespace
 in build/lib.macosx-11.5-x86_64-3.9-pydebug/_sqlite3.cpython-39d-darwin.so
*** WARNING: renaming "pyexpat" since importing it failed: dlopen(build/lib.macosx-11.5-x86_64-3.9-pydebug/pyexpat.cpython-39d-darwin.so, 2): Symbol not found: _XML_ErrorString
  Referenced from: build/lib.macosx-11.5-x86_64-3.9-pydebug/pyexpat.cpython-39d-darwin.so
  Expected in: flat namespace
 in build/lib.macosx-11.5-x86_64-3.9-pydebug/pyexpat.cpython-39d-darwin.so
*** WARNING: renaming "_elementtree" since importing it failed: PyCapsule_Import could not import module "pyexpat"
/Users/alexander.nickolov/git/vcpkg/buildtrees/python3/src/v3.9.7-de99cf1568.clean/Lib/runpy.py:111: PendingDeprecationWarning: lib2to3 package is deprecated and may not be able to parse Python 3.10+
  __import__(pkg_name)
/Users/alexander.nickolov/git/vcpkg/buildtrees/python3/src/v3.9.7-de99cf1568.clean/Lib/runpy.py:111: PendingDeprecationWarning: lib2to3 package is deprecated and may not be able to parse Python 3.10+
  __import__(pkg_name)
Traceback (most recent call last):
  File "/Users/alexander.nickolov/git/vcpkg/buildtrees/python3/src/v3.9.7-de99cf1568.clean/Lib/runpy.py", line 188, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/Users/alexander.nickolov/git/vcpkg/buildtrees/python3/src/v3.9.7-de99cf1568.clean/Lib/runpy.py", line 147, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/Users/alexander.nickolov/git/vcpkg/buildtrees/python3/src/v3.9.7-de99cf1568.clean/Lib/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "/Users/alexander.nickolov/git/vcpkg/buildtrees/python3/src/v3.9.7-de99cf1568.clean/Lib/ensurepip/__init__.py", line 7, in <module>
    from importlib import resources
  File "/Users/alexander.nickolov/git/vcpkg/buildtrees/python3/src/v3.9.7-de99cf1568.clean/Lib/importlib/resources.py", line 4, in <module>
    from . import _common
  File "/Users/alexander.nickolov/git/vcpkg/buildtrees/python3/src/v3.9.7-de99cf1568.clean/Lib/importlib/_common.py", line 3, in <module>
    import zipfile
  File "/Users/alexander.nickolov/git/vcpkg/buildtrees/python3/src/v3.9.7-de99cf1568.clean/Lib/zipfile.py", line 6, in <module>
    import binascii
ImportError: dlopen(/Users/alexander.nickolov/git/vcpkg/buildtrees/python3/arm64-ios-dbg/build/lib.macosx-11.5-x86_64-3.9-pydebug/binascii.cpython-39d-darwin.so, 2): Symbol not found: _crc32
  Referenced from: /Users/alexander.nickolov/git/vcpkg/buildtrees/python3/arm64-ios-dbg/build/lib.macosx-11.5-x86_64-3.9-pydebug/binascii.cpython-39d-darwin.so
  Expected in: flat namespace
 in /Users/alexander.nickolov/git/vcpkg/buildtrees/python3/arm64-ios-dbg/build/lib.macosx-11.5-x86_64-3.9-pydebug/binascii.cpython-39d-darwin.so
make: *** [altinstall] Error 1

Additional context
Add any other context about the problem here, such as what you have already tried to resolve the issue.

I'm not sure what to think of this to be honest. It looks like part of the build is performed for iOS and another part is performed for MacOS. Is Python even expected to be able to be built for iOS? It's a dependency for Boost, but perhaps it should be conditional and not built for iOS?

I did update builtin-baseline in my manifest to a commit from today. This issue is with essentially the current state of vcpkg.

Metadata

Metadata

Assignees

Labels

category:community-tripletA PR or issue related to community triplets not officially validated by the vcpkg team.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions