Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode 12 Build Error: LibTorch/install/lib/libpytorch_qnnpack.a , building for iOS, but linking in object file built for macOS #44143

Closed
vukovicnikola opened this issue Sep 3, 2020 · 12 comments
Assignees
Labels
module: ios Related to iOS support - build, API, Continuous Integration, document oncall: mobile Related to mobile support, including iOS and Android triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Milestone

Comments

@vukovicnikola
Copy link

vukovicnikola commented Sep 3, 2020

馃悰 Bug

When building Pytorch's official iOS project (with Enable Bitcode set to No), Xcode 12 gives the linking error copied below.

To Reproduce

I'm following the iOS guide on this page: https://pytorch.org/mobile/ios/

Error:

ld: in /Users/nikola/Downloads/PytorchMobile/Pods/LibTorch/install/lib/libpytorch_qnnpack.a (8x8-aarch64-neon.S.o), building for iOS, but linking in object file built for macOS, file '/Users/nikola/Downloads/PytorchMobile/Pods/LibTorch/install/lib/libpytorch_qnnpack.a' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Expected behavior

Expecting the build to complete like in the official documentation.

Environment

PyTorch version: 1.7.0a0+297c938
Is debug build: False
CUDA used to build PyTorch: None

OS: Mac OSX 10.15.6 (x86_64)
GCC version: Could not collect
Clang version: 11.0.3 (clang-1103.0.32.62)
CMake version: version 3.14.0

Python version: 3.7 (64-bit runtime)
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA

Versions of relevant libraries:
[pip3] numpy==1.18.2
[conda] blas 1.0 mkl
[conda] mkl 2019.4 233
[conda] mkl-include 2020.2 260
[conda] mkl-service 2.3.0 py37hfbe908c_0
[conda] mkl_fft 1.0.15 py37h5e564d8_0
[conda] mkl_random 1.1.0 py37ha771720_0
[conda] msgpack-numpy 0.4.3.2 py37_0
[conda] numpy 1.18.2 pypi_0 pypi
[conda] numpy-base 1.18.1 py37h3304bdc_1
[conda] numpydoc 0.9.2 py_0
[conda] pytorch 1.6.0 py3.7_0 pytorch
[conda] torch 1.4.0 pypi_0 pypi
[conda] torchstat 0.0.7 pypi_0 pypi
[conda] torchvision 0.5.0 pypi_0 pypi

@vukovicnikola vukovicnikola changed the title Xcode Build Error: LibTorch/install/lib/libpytorch_qnnpack.a , building for iOS, but linking in object file built for macOS Xcode 12 Build Error: LibTorch/install/lib/libpytorch_qnnpack.a , building for iOS, but linking in object file built for macOS Sep 3, 2020
@izdeby izdeby added oncall: mobile Related to mobile support, including iOS and Android module: ios Related to iOS support - build, API, Continuous Integration, document triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels Sep 9, 2020
@superlyy
Copy link

same issue here

@pavlonadolynskyi
Copy link

same ...

@alex-dosa92
Copy link

I have the same issue

@tintifax89
Copy link

Same issue. Any solutions/workarounds?

@xiaoqiangsheng2016
Copy link

xiaoqiangsheng2016 commented Sep 25, 2020

I have the same issue, but use Xcode11 is ok

@thezealousfool
Copy link

But we cannot use xcode 11 for iOS 14 app development. Right?

@xiaoqiangsheng2016
Copy link

xiaoqiangsheng2016 commented Sep 27, 2020

But we cannot use xcode 11 for iOS 14 app development. Right?

YES, iOS14 need Xcode12. we use Xcode12, and remove libTorch, use opencv instead. prediction use coreml(mlmodel file)

@pavlonadolynskyi
Copy link

managed to compile entire library via xcode 12 and problem gone, but faced another issue I can't fix:

Undefined symbols for architecture arm64: "c10::impl::ExcludeDispatchKeyGuard::ExcludeDispatchKeyGuard(c10::DispatchKey)", referenced from:

@vukovicnikola
Copy link
Author

Any updates on this? This is a breaking bug for anyone using iOS 14 i.e. anyone working on MacOS Big Sur

@xta0 xta0 self-assigned this Sep 30, 2020
@gchanan gchanan added this to the 1.7.0 milestone Sep 30, 2020
@xta0
Copy link
Contributor

xta0 commented Sep 30, 2020

The issue was in CMake's version. Obviously, 3.14 doesn't work well with XCode 12. We just tried 3.18, it works fine. Anyway, the solution would be

  1. upload a bug fix version to cocoapods - 1.6.1
  2. If you guys can't wait, you can build the static libs from source. Make sure you're using the latest CMake (3.18).

@husthyc
Copy link
Contributor

husthyc commented Oct 5, 2020

Now LibTorch 1.6.1 has been released. Please try pod repo update then pod install with your project (make sure the version number in your Podfile is NOT a FIXED "1.6.0". If it is, please use "~>1.6.0" or "1.6.1" as the version number).

This was referenced Oct 6, 2020
@gchanan
Copy link
Contributor

gchanan commented Oct 9, 2020

this looks like all the PRs have been merged to master, so closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: ios Related to iOS support - build, API, Continuous Integration, document oncall: mobile Related to mobile support, including iOS and Android triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests