WalleyM
WalleyM

Reputation: 172

Immediate runtime error with Tensorflow C api on M1 Mac

I am trying to use the Tensorflow C api in an xcode project. As soon as the app starts running a BAD_INSTRUCTION error is generated on the main thread. This error comes from:

tensorflow::monitoring::MetricDef<(tensorflow::monitoring::MetricKind)1, long long, 2>::MetricDef<char [11], char [7]>(absl::lts_2020_02_25::string_view, absl::lts_2020_02_25::string_view, char const (&) [11], char const (&) [7]) ()

I installed the api using: https://www.tensorflow.org/install/lang_c

I am building for x86_64 architectures (Using Rosetta to translate) and linked the library through specifying a runpath search path to the .dylib's directory. I also included this path as a regular search path and added the header search path too. Finally, I added both .dylibs to the 'link binary with libraries' list.

I am running xcode 12.4 on a M1 macbook pro. If anyone knows any way to get more information about the crash out of xcode that'd be useful too.

I have tried installing on an intel MacBook and that worked fine.

Upvotes: 1

Views: 613

Answers (1)

JCWasmx86
JCWasmx86

Reputation: 3583

The M1 processor is ARM.

You compiled for x86_64 (Intel architecture) this means, that it isn't compatible.

You'd have to compile it for ARM, otherwise it won't run. (That's like trying to run JVM Bytecode in .NET, it just won't work)

For more information, see this answer

Upvotes: 1

Related Questions