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

Error building numpy-iOS #128

Closed carybakker closed 2 years ago

carybakker commented 2 years ago

Describe the bug make numpy-iOS fails on 3.9 branch for me

To Reproduce Steps to reproduce the behavior:

  1. checkout 3.9 branch
  2. make iOS
  3. make numpy-iOS
  4. build fails

Expected behavior Successful build of numpy-iOS

Environment:

Build error

/Python-Apple-support/build/macOS/python/bin/python3 -m ensurepip make: /Python-Apple-support/build/macOS/python/bin/python3: No such file or directory make: *** [pip] Error 1 python3 does exist, but it's not at the ./build/macOS/python/bin/python3 location... the path is ./build/macOS/Python-3.9.6/dist/bin/python3 I created a soft link to Python-3.9.6 with: `ln -s ./Python-3.9.6/dist ./python` This allows the build to continue, but the build errors out with: distutils.errors.CompileError: Command "xcrun --sdk iphonesimulator clang -arch x86_64 --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -mios-version-min=8.0 -fembed-bitcode -c /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/source.c -o /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/source.o -MMD -MF /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/source.o.d" failed with exit status 1 make: *** [build/iOS/packages/numpy/build/temp.iphonesimulator.x86_64-3.9/libpymath.a] Error 1 And an error further up reported is: C compiler: xcrun --sdk iphonesimulator clang -arch x86_64 --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -mios-version-min=8.0 -fembed-bitcode creating /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/var creating /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/var/folders creating /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/var/folders/z3 creating /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/var/folders/z3/5156tl1n16785d9p8yhkrm540000gn creating /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T creating /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c compile options: '-c' xcrun: /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/source.c clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot] clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot] /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/source.c:4:13: error: implicit declaration of function 'zungqr_' is invalid in C99 [-Werror,-Wimplicit-function-declaration] zungqr_(); ^ /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/source.c:4:13: note: did you mean 'zungqr'? /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/source.c:1:6: note: 'zungqr' declared here void zungqr(); ^ 1 error generated. clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot] clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot] /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/source.c:4:13: error: implicit declaration of function 'zungqr_' is invalid in C99 [-Werror,-Wimplicit-function-declaration] zungqr_(); ^ /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/source.c:4:13: note: did you mean 'zungqr'? /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/source.c:1:6: note: 'zungqr' declared here void zungqr(); ^ 1 error generated. Traceback (most recent call last): File "/Users/carybakker/dev/junk/embed_python/Python-Apple-support/build/iOS/packages/numpy/numpy/distutils/unixccompiler.py", line 57, in UnixCCompiler__compile self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + deps + File "/Users/carybakker/dev/junk/embed_python/Python-Apple-support/build/iOS/packages/numpy/numpy/distutils/ccompiler.py", line 89, in m = lambda self, *args, **kw: func(self, *args, **kw) File "/Users/carybakker/dev/junk/embed_python/Python-Apple-support/build/iOS/packages/numpy/numpy/distutils/ccompiler.py", line 152, in CCompiler_spawn raise DistutilsExecError('Command "%s" failed with exit status %d%s' % (cmd, s, msg)) distutils.errors.DistutilsExecError: Command "xcrun --sdk iphonesimulator clang -arch x86_64 --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -mios-version-min=8.0 -fembed-bitcode -c /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/source.c -o /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/source.o -MMD -MF /var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/var/folders/z3/5156tl1n16785d9p8yhkrm540000gn/T/tmp8tietm9c/source.o.d" failed with exit status 1
siege098 commented 2 years ago

I played around with this awhile ago and has similar issues. I don't think this add-on is working and I think they should flag it as such so people don't waste their time. One issue is Apple's Accelerate backend, which this uses, does not appear to be supported in numpy anymore. I think to get this working Openblas as an Accelerate alternative would need to be ported. This is a problem because Openblas is written in Fortran and there is not a Fortran compiler for iOS (its not impossible to compile this but it is a difficult task.). However, with the fact that Apple's computers are now using the same chip as iOS devices, I am hopeful a simpler Fortran solution may be coming soon to iOS. The only other solution would be that the numpy people get the Accelerate backend working again.

freakboy3742 commented 2 years ago

Closing as we're deprecating the numpy build system provided by this project, in favour of a more comprehensive approach to support binary packages.