Search code examples
c++iosiphonearchitecture

iOS: error when running project on real device


I included an external C++ library for my iOS project. This library was compiled and linked with my project from this: http://github.com/chili-epfl/chilitags/

Then when I run the project on simulator, it compiles. But when I run the project on real device like iPhone7, it fails.

The error was clear:

warning: ignoring file /usr/local/lib/libchilitags.dylib, file was built for x86_64 which is not the architecture being linked (arm64): /usr/local/lib/libchilitags.dylib

Because the lib file was ignored, the functions I used all caused fatal link error.

The reason was clear but I don't know what to do. iPhone7 was arm64 architecture but the file was x86_64 architecture and we have to run it on real devices.

So, what should I do so that I can run x86_64 libs on arm64 real devices? Thanks in advance.


Solution

  • BSo, what should I do so that I can run x86_64 libs on arm64 real devices?

    The problem is in different processor instruction set used in x86 and arm64.

    So, you should compile the library for arm64 or find it already compiled for target architecture.