Skip to main content
July 18, 2012
Answered

Cannot find lib when packaging for iOS

  • July 18, 2012
  • 1 reply
  • 5911 views

You can see the same question on StackOverflow here:

http://stackoverflow.com/questions/11547515/cannot-find-lib-when-packaging-for-ios

Hi,

I am developping an Air Native Extension (ANE) in order to be able to use the burstly(1) ads on mobile devices.

As for my setup, I am using the FlashDevelop 4.0.4(2) and Adobe Air 3.3 (3). I'm using Flex 4.6.0 SDK. The project is setup on Windows7.

In order to work on iOS devices, Burstly requires a number of frameworks and librares (4)

I managed to write and compile the .a library for iOS. I also have the interface (actionscript code) that will be shared for Android and iOS compiled into a swc and a librairy.swf. All of this is successfully packaged into a .ane which is included in my project.

When compiling a .a library on MacOS, all the framework and library used don't seems to be packaged in the ".a". This is why I had to use Air 3.3, for the -platformsdk option(5).

Since I work on Windows, I followed the instruction in this post to get the iOS SDK (6).

Following (4) and (5), I made a platformConfig.xml file like this, which is packaged in the .ane

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

        <sdkVersion>4.2</sdkVersion>

        <linkerOptions>

            <!-- to use the AssetsLibrary framework -->

            <option>-framework AssetsLibrary</option>

            <option>-framework AudioToolbox</option>

            <option>-framework AddressBook</option>

            <option>-framework AVFoundation</option>

            <option>-framework CFNetwork</option>

            <option>-framework CoreLocation</option>

            <option>-framework MapKit</option>

            <option>-framework MediaPlayer</option>

            <option>-framework MessageUI</option>

            <option>-framework OpenAL</option>

            <option>-framework OpenGLES</option>

            <option>-framework QuartzCore</option>

            <option>-framework StoreKit</option>

            <option>-framework SystemConfiguration</option>

            <option>-framework Foundation</option>

            <option>-framework CoreGraphics</option>

            <option>-libsqlite3</option>

            <option>-libxml2</option>

            <option>-libz</option>

        </linkerOptions>

    </platform>

and this is the line to compile the actuale .ane

    call "%FLEX_SDK%\bin\adt" -package -target ane ../release/burstlyadsextension.ane extension.xml -swc burstlyAds.swc -platform iPhone-ARM library.swf libBurstlyAds.a -platformoptions platformConfig.xml

Problem arises when I try to package the iOS app with ADT:

    call adt -package -target %TYPE%%TARGET% %OPTIONS% %SIGNING_OPTIONS% "%OUTPUT%" "%APP_XML%" %FILE_OR_DIR% -extdir lib/external/ -platformsdk ../Libraries/iPhoneOS5.0.sdk/

this happens:

"ld: library not found for -libsqlite3

Compilation failed while executing : ld64"

frameworks seems to be added fine, but the dylib are not. I tried to add the line:

    <option>-L usr/lib/</option>

before including the lib, but I got this error instead:

"ld: warning: directory not found for option '-Lusr/lib/'

ld: library not found for -libsqlite3

Compilation failed while executing : ld64"

I tried to use the full path, other relative path, but no matter what path I put in the option, I always get a "warning: directory not found for option". Even "<option>-L ../</option>" give me this warning. The only thing that seems to work is "<option>-L /../</option>", but my .dylib obviousle are not there.

So my questions are: What did I do wrong? Any idead what else I could try? Even an explanation as to why it is not working would be helpful!

Links:

#1: http://support.burstly.com/

#2: http://www.flashdevelop.org/

#3: http://get.adobe.com/fr/air/        //Sorry, my OS is in french

#4: http://support.burstly.com/kb/ios/required-compiler-flags-frameworks

#5: http://blogs.adobe.com/rajorshi/2011/11/16/ios5-support-for-airusing-external-sdks-to-package-apps/

#6: http://blogs.adobe.com/airodynamics/2012/05/18/using-platformsdk-for-ios-on-windows/

This topic has been closed for replies.
Correct answer

Hi Jean,

The warning, you can ignore, or add the folowing linker option to remove it:

<option>-ios_version_min 5.1(or whatever is the minimum supported iOS version for your app)</option>

As far as the errors are concerned, they are not related to your library, but the ANE. Recompile your ANE for armv7 only(i.e. remove armv6 in your XCode settings), as AIR only supports armv7, as does iOS5.1+.

I guess recompiling your static library and repackaging the ANE with the new .a will resolve your issue.

-Neha

1 reply

July 19, 2012

Hi,

You are not using the linker options correctly.

You need to change your linker options from:

            <option>-libsqlite3</option>

            <option>-libxml2</option>

            <option>-libz</option>

to:

            <option>-lsqlite3</option>

            <option>-lxml2</option>

            <option>-lz</option>

The linker options use the same syntax as the ld command. For help on ld syntax, use may use the 'man ld' command on your terminal.

Hope this solves your problem.

July 19, 2012

Thanks a lot, that took care of the

"ld: library not found for -libsqlite3

Compilation failed while executing : ld64"

But now, I'm stuck with this error instead:

ld: warning: -ios_version_min not specificed, assuming 4.0

Undefined symbols for architecture armv7:

  "_ADBannerContentSizeIdentifier480x32", referenced from:

      +[Burstly_iad_Adaptor initializeContentSizeIdentifiers] in libcom.bhvr.burstlyads.a(Burstly_iad_Adaptor.o)

      -[Burstly_iad_Adaptor supportedSizes] in libcom.bhvr.burstlyads.a(Burstly_iad_Adaptor.o)

  "_OBJC_CLASS_$_ADBannerView", referenced from:

      objc-class-ref in libcom.bhvr.burstlyads.a(Burstly_iad_Adaptor.o)

  "_OBJC_CLASS_$_EKEventStore", referenced from:

      objc-class-ref in libcom.bhvr.burstlyads.a(BurstlyORMMAView.o)

  "_OBJC_CLASS_$_FlurryAnalytics", referenced from:

      objc-class-ref in libcom.bhvr.burstlyads.a(Burstly_flurry_Adaptor.o)

  "_OBJC_CLASS_$_CMMotionManager", referenced from:

      objc-class-ref in libcom.bhvr.burstlyads.a(BurstlyORMMAJavascriptBridge.o)

  "_ADBannerContentSizeIdentifier320x50", referenced from:

      +[Burstly_iad_Adaptor initializeContentSizeIdentifiers] in libcom.bhvr.burstlyads.a(Burstly_iad_Adaptor.o)

      -[Burstly_iad_Adaptor supportedSizes] in libcom.bhvr.burstlyads.a(Burstly_iad_Adaptor.o)

      -[Burstly_iad_Adaptor makeSizesSetWithArray:] in libcom.bhvr.burstlyads.a(Burstly_iad_Adaptor.o)

  "_MedialetsShouldLogDebug", referenced from:

      -[MedialetsAdServer sendAppPixelWithURL:] in libcom.bhvr.burstlyads.a(MedialetsAdServer.o)

      -[MedialetsAdServer adFitsSlot:adID:] in libcom.bhvr.burstlyads.a(MedialetsAdServer.o)

      -[MedialetsAdServer nextAdFromList:forTargetKey:keywords:andBlockKeywords:] in libcom.bhvr.burstlyads.a(MedialetsAdServer.o)

      -[MedialetsAdServer isAdValidForSlot:forTargetKey:keywords:andBlockKeywords:] in libcom.bhvr.burstlyads.a(MedialetsAdServer.o)

      -[MedialetsAdServer nextAdForAdView:] in libcom.bhvr.burstlyads.a(MedialetsAdServer.o)

      -[MedialetsAdServer startCacheLoad] in libcom.bhvr.burstlyads.a(MedialetsAdServer.o)

      -[MedialetsAdServer processReceivedData:] in libcom.bhvr.burstlyads.a(MedialetsAdServer.o)

      ...

  "_OBJC_CLASS_$_EKEvent", referenced from:

      objc-class-ref in libcom.bhvr.burstlyads.a(BurstlyORMMAView.o)

  "_ADBannerContentSizeIdentifierPortrait", referenced from:

      +[Burstly_iad_Adaptor initializeContentSizeIdentifiers] in libcom.bhvr.burstlyads.a(Burstly_iad_Adaptor.o)

  "_OBJC_CLASS_$_CTTelephonyNetworkInfo", referenced from:

      objc-class-ref in libcom.bhvr.burstlyads.a(BurstlyUtils.o)

  "_ADBannerContentSizeIdentifierLandscape", referenced from:

      +[Burstly_iad_Adaptor initializeContentSizeIdentifiers] in libcom.bhvr.burstlyads.a(Burstly_iad_Adaptor.o)

  "_MedialetsShouldLogInternal", referenced from:

      -[MedialetsAdServer init] in libcom.bhvr.burstlyads.a(MedialetsAdServer.o)

      -[MedialetsAdServer qualifiedAdsFromList:forAdView:] in libcom.bhvr.burstlyads.a(MedialetsAdServer.o)

      -[MedialetsAdServer qualifiedAd:foradSlotKey:] in libcom.bhvr.burstlyads.a(MedialetsAdServer.o)

      -[MedialetsAdServer nextAdFromList:forTargetKey:keywords:andBlockKeywords:] in libcom.bhvr.burstlyads.a(MedialetsAdServer.o)

      -[MedialetsAdServer nextAdForAdView:] in libcom.bhvr.burstlyads.a(MedialetsAdServer.o)

      -[MedialetsAdServer attemptCacheLoad] in libcom.bhvr.burstlyads.a(MedialetsAdServer.o)

      -[MedialetsAdServer startCacheLoad] in libcom.bhvr.burstlyads.a(MedialetsAdServer.o)

      ...

  "_OBJC_CLASS_$_FlurryAppCircle", referenced from:

      objc-class-ref in libcom.bhvr.burstlyads.a(Burstly_flurry_Adaptor.o)

  "_OBJC_CLASS_$_ADInterstitialAd", referenced from:

      objc-class-ref in libcom.bhvr.burstlyads.a(Burstly_iad_Adaptor.o)

ld: symbol(s) not found for architecture armv7

Compilation failed while executing : ld64

Which is the same error as when I did not include any library at all.

Any other insight?

Correct answer
July 19, 2012

Hi Jean,

The warning, you can ignore, or add the folowing linker option to remove it:

<option>-ios_version_min 5.1(or whatever is the minimum supported iOS version for your app)</option>

As far as the errors are concerned, they are not related to your library, but the ANE. Recompile your ANE for armv7 only(i.e. remove armv6 in your XCode settings), as AIR only supports armv7, as does iOS5.1+.

I guess recompiling your static library and repackaging the ANE with the new .a will resolve your issue.

-Neha