Skip to main content
May 27, 2013
Answered

Linker error while packaging iOS app with my ANE

  • May 27, 2013
  • 1 reply
  • 2037 views

While trying to write a iOS Native Extension for ZXingObjC (https://github.com/TheLevelUp/ZXingObjC), the following link error shows up when exporting in Flash Builder 4.x:

--------

Error occurred while packaging the application:

Undefined symbols for architecture armv7:

  "___divmodsi4", referenced from:

      +[ZXEncoder numDataBytesAndNumECBytesForBlockID:numDataBytes:numRSBlocks:blockID:numDataBytesInBlock:numECBytesInBlock:error:] in libcom.google.zxing.ZXingNativeExtension.a(ZXEncoder.o)

      +[ZXAztecEncoder encode:len:minECCPercent:] in libcom.google.zxing.ZXingNativeExtension.a(ZXAztecEncoder.o)

      +[ZXAztecEncoder generateCheckWords:totalSymbolBits:wordSize:] in libcom.google.zxing.ZXingNativeExtension.a(ZXAztecEncoder.o)

ld: symbol(s) not found for architecture armv7

Compilation failed while executing : ld64

--------

This happens in Flash Builder 4.6 or 4.7 using AIR SDK 3.7

This isn't my first Native Extension for iOS. No amount of fiddling around with adding frameworks or libraries in Xcode to the static library works.

Looking for guidance on what to try next to resolve this linker error...

This topic has been closed for replies.
Correct answer matt_cardoza

I'm going to leave the above for SEO for other people researching this error, but adding the following corrected my Undefined Symbol error

<linkerOptions>

        <option>-ios_version_min 5.1</option> 

          ...

</linkerOptions>

5.0 is probably fine, other random googling showed that it defaults to 4.0 which is likely a source of the issue.  Also of note, I did NOT need to add a linkerOption for any of the 3rd party libraries the XCode side uses.

1 reply

Participant
May 30, 2013

I am also receiving an error related to ___divmodsi4 (using different libraries which use that symbol) which appears to be a compiler level math function. It should be packaged automatically but apparently AIR isn't doing it.  No idea what additional library should be linked, attempts to link the 3rd party libraries (and/or packagedDepenency them) failed.

Undefined symbols for architecture armv7:

  "___divmodsi4", referenced from: (methods in a third party library)

My Platform.xml is as such:

<platform xmlns="http://ns.adobe.com/air/extension/3.7">

    <sdkVersion>6.0</sdkVersion>

    <linkerOptions>

    <option>-ObjC</option>   

    <option>-weak_framework Accounts</option>

    <option>-framework AddressBook</option>

    <option>-framework AddressBookUI</option>

    <option>-weak_framework AdSupport</option>

    <option>-framework CoreAudio</option>

    <option>-framework CoreLocation</option>

    <option>-framework CoreMotion</option>

    <option>-framework CoreTelephony</option>

    <option>-framework EventKit</option>

    <option>-framework EventKitUI</option>

    <option>-framework iAd</option>

    <option>-framework MapKit</option>

    <option>-framework MediaPlayer</option>

    <option>-framework MessageUI</option>

    <option>-framework OpenAL</option>

    <option>-weak_framework PassKit</option>

    <option>-framework StoreKit</option>

    <option>-weak_framework Twitter</option>

    <option>-framework UIKit</option>

    <option>-lsqlite3</option>

    <option>-lxml2</option>

    <option>-lz</option>

    </linkerOptions>

</platform>

If the author or anyone manages a solution, please post it in this thread!

matt_cardozaCorrect answer
Participant
May 30, 2013

I'm going to leave the above for SEO for other people researching this error, but adding the following corrected my Undefined Symbol error

<linkerOptions>

        <option>-ios_version_min 5.1</option> 

          ...

</linkerOptions>

5.0 is probably fine, other random googling showed that it defaults to 4.0 which is likely a source of the issue.  Also of note, I did NOT need to add a linkerOption for any of the 3rd party libraries the XCode side uses.

May 31, 2013

<platform xmlns="http://ns.adobe.com/air/extension/3.7">

    <sdkVersion>5.0</sdkVersion>

    <linkerOptions>

        <option>-ios_version_min 5.0</option>

        <option>-framework ImageIO</option>

    </linkerOptions>

</platform>

and no more helpful and useful linker error message...