0

I want to cross-compile the libsodium cryptography library for use on iOS. Specifically, I want to compile it for armv7, armv7s and arm64 so that it works for older as well as newer iPhones.

I followed the instructions on the libsodium website (https://download.libsodium.org/doc/installation/index.html) to cross-compile it and ran the configure script like this:

./configure --host=armv7-apple-darwin

and the same for armv7s-apple-darwin and armv8-apple-darwin (which is the same as arm64 I think/hope, since arm64 wasn't supported). Then I did "make install" which succeeded without errors. However, if I then inspected the created static library:

lipo -info libsodium.a

it tells me:

Non-fat file: libsodium.a is architecture: x86_64

for all of these. Why is this static library targeted towards x86_64 architectures while I targeted the armv7, armv7s, armv8 architectures? Am I doing something wrong?

Nimyz
  • 339
  • 2
  • 11

1 Answers1

5

Just use the build script available in the source repository.

Alternatively, pre-built libraries are available in the Swift bindings.

Frank Denis
  • 1,475
  • 9
  • 12