beeware / Python-Apple-support

A meta-package for building a version of Python that can be embedded into a macOS, iOS, tvOS or watchOS project.
MIT License
1.1k stars 159 forks source link

Missing libpython3.11.a when compiling on M1 #150

Closed yehudahs closed 2 years ago

yehudahs commented 2 years ago

Describe the bug getting the next error when compiling iOS on M1

xcrun --sdk iphonesimulator clang -target arm64-apple-ios-simulator --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.5.sdk -mios-version-min=12.0 -fembed-bitcode  -L/opt/homebrew/opt/binutils/lib -L/opt/homebrew/opt/openssl@3/lib    -o python.exe Programs/python.o Modules/getbuildinfo.o Parser/token.o  Parser/pegen.o Parser/pegen_errors.o Parser/action_helpers.o Parser/parser.o Parser/string_parser.o Parser/peg_api.o Parser/myreadline.o Parser/tokenizer.o Objects/abstract.o Objects/accu.o Objects/boolobject.o Objects/bytes_methods.o Objects/bytearrayobject.o Objects/bytesobject.o Objects/call.o Objects/capsule.o Objects/cellobject.o Objects/classobject.o Objects/codeobject.o Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o Objects/exceptions.o Objects/genericaliasobject.o Objects/genobject.o Objects/fileobject.o Objects/floatobject.o Objects/frameobject.o Objects/funcobject.o Objects/interpreteridobject.o Objects/iterobject.o Objects/listobject.o Objects/longobject.o Objects/dictobject.o Objects/odictobject.o Objects/memoryobject.o Objects/methodobject.o Objects/moduleobject.o Objects/namespaceobject.o Objects/object.o Objects/obmalloc.o Objects/picklebufobject.o Objects/rangeobject.o Objects/setobject.o Objects/sliceobject.o Objects/structseq.o Objects/tupleobject.o Objects/typeobject.o Objects/unicodeobject.o Objects/unicodectype.o Objects/unionobject.o Objects/weakrefobject.o Python/_warnings.o Python/Python-ast.o Python/Python-tokenize.o Python/asdl.o Python/ast.o Python/ast_opt.o Python/ast_unparse.o Python/bltinmodule.o Python/ceval.o Python/codecs.o Python/compile.o Python/context.o Python/dynamic_annotations.o Python/errors.o Python/frame.o Python/frozenmain.o Python/future.o Python/getargs.o Python/getcompiler.o Python/getcopyright.o Python/getplatform.o Python/getversion.o Python/hamt.o Python/hashtable.o Python/import.o Python/importdl.o Python/initconfig.o Python/marshal.o Python/modsupport.o Python/mysnprintf.o Python/mystrtoul.o Python/pathconfig.o Python/preconfig.o Python/pyarena.o Python/pyctype.o Python/pyfpe.o Python/pyhash.o Python/pylifecycle.o Python/pymath.o Python/pystate.o Python/pythonrun.o Python/pytime.o Python/bootstrap_hash.o Python/specialize.o Python/structmember.o Python/symtable.o Python/sysmodule.o Python/thread.o Python/traceback.o Python/getopt.o Python/pystrcmp.o Python/pystrtod.o Python/pystrhex.o Python/dtoa.o Python/formatter_unicode.o Python/fileutils.o Python/suggestions.o Python/dynload_stub.o     Modules/config.o Modules/main.o Modules/gcmodule.o Modules/_asynciomodule.o  Modules/_bisectmodule.o  Modules/_blake2/blake2module.o Modules/_blake2/blake2b_impl.o Modules/_blake2/blake2s_impl.o  Modules/_bz2module.o  Modules/cjkcodecs/_codecs_cn.o  Modules/cjkcodecs/_codecs_hk.o  Modules/cjkcodecs/_codecs_iso2022.o  Modules/cjkcodecs/_codecs_jp.o  Modules/cjkcodecs/_codecs_kr.o  Modules/cjkcodecs/_codecs_tw.o  Modules/_contextvarsmodule.o  Modules/_csv.o  Modules/_dbmmodule.o  Modules/_datetimemodule.o  Modules/_elementtree.o   Modules/_hashopenssl.o  Modules/_heapqmodule.o  Modules/_json.o  Modules/_lsprof.o Modules/rotatingtree.o  Modules/_lzmamodule.o  Modules/md5module.o  Modules/cjkcodecs/multibytecodec.o  Modules/_multiprocessing/multiprocessing.o Modules/_multiprocessing/semaphore.o  Modules/_opcode.o  Modules/_pickle.o  Modules/_posixsubprocess.o  Modules/_queuemodule.o  Modules/_randommodule.o  Modules/sha1module.o  Modules/_sha3/sha3module.o  Modules/sha256module.o  Modules/sha512module.o  Modules/socketmodule.o  Modules/_sqlite/blob.o Modules/_sqlite/connection.o Modules/_sqlite/cursor.o Modules/_sqlite/microprotocols.o Modules/_sqlite/module.o Modules/_sqlite/prepare_protocol.o Modules/_sqlite/row.o Modules/_sqlite/statement.o Modules/_sqlite/util.o  Modules/_ssl.o  Modules/_statisticsmodule.o  Modules/_struct.o  Modules/_typingmodule.o  Modules/_uuidmodule.o  Modules/_zoneinfo.o  Modules/arraymodule.o  Modules/binascii.o  Modules/cmathmodule.o  Modules/fcntlmodule.o  Modules/grpmodule.o  Modules/mathmodule.o  Modules/mmapmodule.o  Modules/expat/xmlparse.o Modules/expat/xmlrole.o Modules/expat/xmltok.o Modules/pyexpat.o  Modules/resource.o  Modules/selectmodule.o  Modules/syslogmodule.o  Modules/termios.o  Modules/unicodedata.o  Modules/zlibmodule.o  Modules/_cryptmodule.o  Modules/audioop.o  Modules/_ctypes/_ctypes.o Modules/_ctypes/callbacks.o Modules/_ctypes/callproc.o Modules/_ctypes/stgdict.o Modules/_ctypes/cfield.o Modules/_ctypes/malloc_closure.o  Modules/_decimal/_decimal.o Modules/_decimal/libmpdec/basearith.o Modules/_decimal/libmpdec/constants.o Modules/_decimal/libmpdec/context.o Modules/_decimal/libmpdec/convolute.o Modules/_decimal/libmpdec/crt.o Modules/_decimal/libmpdec/difradix2.o Modules/_decimal/libmpdec/fnt.o Modules/_decimal/libmpdec/fourstep.o Modules/_decimal/libmpdec/io.o Modules/_decimal/libmpdec/mpalloc.o Modules/_decimal/libmpdec/mpdecimal.o Modules/_decimal/libmpdec/numbertheory.o Modules/_decimal/libmpdec/sixstep.o Modules/_decimal/libmpdec/transpose.o  Modules/atexitmodule.o  Modules/faulthandler.o  Modules/posixmodule.o  Modules/signalmodule.o  Modules/_tracemalloc.o  Modules/_codecsmodule.o  Modules/_collectionsmodule.o  Modules/errnomodule.o  Modules/_io/_iomodule.o Modules/_io/iobase.o Modules/_io/fileio.o Modules/_io/bytesio.o Modules/_io/bufferedio.o Modules/_io/textio.o Modules/_io/stringio.o  Modules/itertoolsmodule.o  Modules/_sre/sre.o  Modules/_threadmodule.o  Modules/timemodule.o  Modules/_weakref.o  Modules/_abc.o  Modules/_functoolsmodule.o  Modules/_localemodule.o  Modules/_operator.o  Modules/_stat.o  Modules/symtablemodule.o  Modules/pwdmodule.o  Modules/xxsubtype.o Python/deepfreeze/deepfreeze.o Modules/getpath.o Python/frozen.o -ldl     -L./../Support/BZip2.xcframework/ios-arm64_x86_64-simulator -lbzip2         -lm -L./../Support/OpenSSL.xcframework/ios-arm64_x86_64-simulator -lOpenSSL   -L./../Support/XZ.xcframework/ios-arm64_x86_64-simulator -lxz         -lsqlite3 -L./../Support/OpenSSL.xcframework/ios-arm64_x86_64-simulator -lOpenSSL -lm    -lz -lm   -lm       -lz  -lm -L./../Support/libFFI.xcframework/ios-arm64_x86_64-simulator -lFFI                        -lm
ld: warning: directory not found for option '-L/opt/homebrew/opt/binutils/lib'
ld: warning: directory not found for option '-L./../Support/OpenSSL.xcframework/ios-arm64_x86_64-simulator'
ld: warning: directory not found for option '-L./../Support/OpenSSL.xcframework/ios-arm64_x86_64-simulator'
ld: library not found for -lOpenSSL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [python.exe] Error 1
>>> Build Python fat library for iphonesimulator
mkdir -p build/iOS/python/iphonesimulator/lib
xcrun --sdk iphonesimulator libtool -no_warning_for_no_symbols -static -o build/iOS/python/iphonesimulator/lib/libPython.a build/iOS/Python-3.11.0b5-iphonesimulator.x86_64/_install/lib/libpython3.11.a build/iOS/Python-3.11.0b5-iphonesimulator.arm64/_install/lib/libpython3.11.a 2>&1 | tee -a build/iOS/python-iphonesimulator.libtool.log
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: build/iOS/Python-3.11.0b5-iphonesimulator.x86_64/_install/lib/libpython3.11.a (No such file or directory)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: build/iOS/Python-3.11.0b5-iphonesimulator.arm64/_install/lib/libpython3.11.a (No such file or directory)
# Copy headers from the first target associated with the SDK
cp -r build/iOS/Python-3.11.0b5-iphonesimulator.x86_64/_install/include build/iOS/python/iphonesimulator
cp: build/iOS/Python-3.11.0b5-iphonesimulator.x86_64/_install/include: No such file or directory

To Reproduce

git clone https://github.com/beeware/Python-Apple-support.git
cd Python-Apple-support
make iOS

Expected behavior build python for iOS

Environment: Mac M1 with MacOS Monterey 12.4 Python 3.9.13 and Python 2.7.16

freakboy3742 commented 2 years ago

Ok - so a few things:

  1. Github provides extensive Markdown formatting; if you're going to post a large chunk of terminal output it's really helpful to wrap that output in "triple quotes" so that it is formatted in a way that makes sense. I've applied those changes to your bug report.
  2. You may have noticed that the build process produces a lot of logs. All of those logs provide context. When a bug report only provides a selection of lines near the end of the log, you've almost certainly missed at least some of the context. If you're going to provide a log, you need to provide the complete log. It may be advisable to provide the full logs as an uploaded file, rather than trying to make the log fit into the ticket description.
  3. Briefcase has a CI configuration. This proves that the build works in a repeatable way. If the build isn't working for you, then the first thing we need to do is work out what is different between your system and the CI system. That is something that is almost impossible for us to diagnose, because we don't have access to your system.

In this specific case, the portion of the log you've provided indicates that the build failed because OpenSSL hasn't compiled successfully. However, because you haven't provided any of the logs from the OpenSSL portion of the build, it's impossible to provide any more diagnosis beyond this. You will find that there are files named build/iOS/openssl-*.log; I'd start looking in those to see if there has been a failure somewhere in the build.

freakboy3742 commented 2 years ago

Closing due to a lack of response.