2

I'm cross compiling ARM targeted toy example static lib for the usage in Mac iOS xCode projects.

In the lib there are only 2 files atoy.c and atoy.h with simple function taking 2 int arguments and returning int result of their combination.

Cross compilation steps are:

arm-none-eabi-gcc -g -Wall -march=armv7-a -c atoy.c
arm-none-eabi-ar rcs libatoy.a atoy.o
arm-none-eabi-ranlib libatoy.a

The resulted libatoy.a used on xCode 7.1.1 with project type iOS app gives the following errors:

... normal armv7
...
export IPHONEOS_DEPLOYMENT_TARGET=9.1
...
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk
...
/Users/.../Library/Developer/Xcode/DerivedData/.../Build/Intermediates/....build/Debug-iphoneos/PerformanceTest.build/Objects-normal/armv7/....LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=9.1 -dead_strip -fembed-bitcode-marker -fobjc-arc -fobjc-link-runtime -latoy -Xlinker -dependency_info -Xlinker
...
ld: warning: ignoring file /Users/.../libatoy.a, file was built for archive which is not the architecture being linked (armv7): /Users/.../libatoy.a
Undefined symbols for architecture armv7:
    "_aadd", referenced from:
    -[ViewController runTest] in ViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

There should be some .a file format differences that is generated on Linux Mint 17.2 x64. Or the case is hard Canadian cross compilation build-host-target problem?

I'm using gcc-arm-none-eabi package.

1

I do remember reading about compatibility problems with XCode 7 when trying to cross compile NetBSD 7 for ARM. I gave up on that and cross compiled it in a Linux server at work, so I cannot give more details.

  • that was a reverse to my problem situation hope linux way will work. I think I need to generate binary for mac os x os – Chesnokov Yuriy Nov 15 '15 at 9:40
  • 1
    Nevertheless when I tried a couple of months ago XCode was still in beta phase. Maybe things have changed by now. What I felt all the way long was a lack of decent documentation, too much experimentation. – Rui F Ribeiro Nov 15 '15 at 9:43
  • Linux is betterin that way gcc supports many targets including arm and darwin but how to combine them to have arm architecture in darwin mac os x format – Chesnokov Yuriy Nov 15 '15 at 9:49
  • No idea actually, that is a though one. Albeit Apple does contribute a lot downstream in patches, they also have a lot of specific modifications. That is a though one. I developed for a while for the OS/X iOS, more centered in Linux/Unix nowadays. – Rui F Ribeiro Nov 15 '15 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.