Here is the screen shot that I created from my mac mini that I used to build my extension:
Once it was compiled, I copied the .a file over to my PC where I used ADT in the AIR 3.0 sdk to build the ane. I then used Flash Pro to build a sample application and ADT to build it. Once I got the external linking issue fixed, I was able to build an Ad-hoc build and I put it on my iPad2 and everything fired up and worked.
The only problem I am having is that I can't use more than one extension in the same project.
If an of you want me to change any settings to do any tests, just let me know and I will give it a try to see if works or not with what I have.
I'm encountering something similar. I'm trying to write a native extension and have a very simple one working, however once I attempt to use a Framework library I get the "ld warning: unexpected srelocation type 9" and the app hangs after launch. I'm using XCode 4.2, AIR 3.1, and Flash Builer 4.6. Is the verdict that I need to roll back to 4.1, so I can use 4.3 as my Base SDK? Or maybe, there's a way to get Base SDK 4.3 for XCode 4.2?
It seems if I have "Enable Linking With Shared Libraries" set to Yes, I can build and deploy the app but it crashes on start-up. If I have it set to "No" it works fine as long as I don't use any Framework libraries. If I do use one, I get link errors.
I've tried a bunch of combinations of code generation and link options, to no real effect. Any pointers would be great. I'd hate to go down the path of reverting xcode, unless I really needed too.
Hmm. I suppose another potention issue is I'm using FB4.6 (beta) to compile the SWC and SWF.
Hmm. I suppose another potention issue is I'm using FB4.6 (beta) to compile the SWC and SWF.
I had the same issue with both FB 4.6 (with the bundled AIR 3.1) and FB 4.5.1 (with AIR 3.0), so I think you can rule that out.
Update: I now have a project compiled with LLVM GCC4.2 and don't get the srelocation error. That was obviously not what's causing
that problem. It might be that I now don't use any third party libs that have that relocation (type 9).
As I understand it (and as andrea was on to above): the adt uses a linker (llvm?) that probably not is supporting that type of relocation.
Frameworks: I discovered that I had to use a platformoptions-file for some frameworks. Here is a page that explains about it:
The additional frameworks that can be used are listed here on my win7 installation:
c:\Program Files (x86)\Adobe\Adobe Flash Builder 4.6\sdks\4.6.0\lib\aot\stub\
I also managed to use a third party framework (though the page above states that you can't/shouldn't);
I extracted the single lib-file from the framework-archive and linked it with my other
native lib in xcode. Seemed to work, but it feels like a kind of "hacky" solution.
Glad to hear you got it to work... did you compile with the 4.3 or the 5.0 SDK?
I am only linking to AVFoundation (and obviously Foundation), so there should be no need for a platform options file.
I was getting type 9 relocations in *all* functions exported from my library, including the extension initializer which does nothing except setting a pointer to the context initializer and finalizer.
From my understanding, type 9 relocations are emitted when using optimized instructions for loading string constants, so I still think it's an issue with code generation and not with whatever frameworks you're linking to.
I honestly have neither the time nor the motivation to get back to debugging this issue, especially seeing that there is no response whatsoever from Adobe.
If someone is interested in digging further I can provide the full source code of the extension (which is a simple wrapper around AVAudioPlayer to allow playing back AAC audio on iOS).
Yes, although I did not get it to work with my initial third party lib.
I'm using 4.3SDK.
I understand that these things take time. It might be a compiler flag that switches off the optimization you're suggesting.
But... a little help from Adobe would be nice.
Thanks for the help. Sounds like no one has gotten this to work with the
iOS5 SDK / XCode 4.2 / Air 3.1?
I notice XCode 4.2.1 was released recently, and the notes mention some
compiler fixes. I'll give that a shot first, before seeing if I can find
iOS 4.3 SDK somewhere. It wasn't included with XCode 4.2.
I would recommend following http://blogs.adobe.com/rajorshi/2011/11/16/ios5-support-for-airusing-e xternal-sdks-to-package-apps/ in case you are writing and ANE for iOS on xCode 4.X.
AIR 3.1 has included some new features specifically to address the support of iOS 5. This blog is applicable only for Mac currently.
UPDATE: If ADT throws some warnings while packaging an ipa you can ignore them. Your app should work.
Thanks. I have tried including the iOS SDK using the -platformsdk flag.
Also tried including -framework Foundation as a linker flag, though the
blog post says it's included automatically, so that's probably not the
To be specific:
My extension works fine until I attempt to use the NSMutableDictionary
class from the Foundation SDK in my extension. If I set "Enable Linking
With Shared Libraries" to Yes, when I run adt I get linker "unexpected
srelocation type 9" warnings and the app hangs on launch.
If I set it to "No". I get the following link error, and am unable to build
"ld: absolute addressing (perhaps -mdynamic-no-pic) used in _getItem from
not allowed in slidable image. Use '-read_only_relocs suppress' to enable
Note: I already disabled the Generate Position Dependent Code option, to no
avail. Not sure what is creating the absolute addressing. Adding
-read_only_relocs suppress doesn't help much either. It just removes the
suggestion, but fails on essentially the same error. It's very possible,
there's some other linker or code generation option I need to throw in,
just not sure what. I'd love some confirmation from someone that has
successfully got this to work.
One correction. Actually, using NSMutableDictionary is working fine, so it's not the Foundation framework. It's when I add a constant from the Security framework that's getting me stuck. If I add this line:
CFTypeRef ref = kSecClassGenericPassword;
I get the "ld: absolute adressing .." error and'm unable to link. Guess I'll bang on it a bit more. Security framework should also be included with the default optoins, and I am pointing to the latest iPhoneOS5.0.sdk.
Finally update. So reverting to XCode 4.1 and iOS SDK 4.3 fixed the problem. I am now able to link against the Security framework as a shared library. Not sure if the problem was due to the compilers in XCode 4.2, building against 5.0 SDK (using the -platformsdk option), or something else. I'll pass more info on to Adobe to see if they can get help get to the bottom of it. At least I'm up and running now, I don't really need any features from 5.0.
Putting this up here, the suggestions on this site helped me fix my problem
Hope it can help someone
Is there any update? I have exactly the same problem with the security Framework.
I'm using Xcode 4.2 and AIR 3.1 and need to write a native Extension with keychain group access.
I got the same problem when trying to make a extensions that use a AVAssetWriter... any update on this problem ? we will install xcode 4.1 to see if this solution work but i hope something else is possible.
EDIT : i got the same problem as rusty ...
compile with shared library YES return type 9 error
Shared library to NO return
"ld: absolute addressing (perhaps -mdynamic-no-pic) used
We use Xcode 4.3, Air 3.2 , all the latest sdk and i don't use -platformsdk as i work on a pc.
other important notice... if i try to set shared librarie to NO while targeting IOS 4.0... it make a build fail! if i target IOS 4.1 it work.. with error absolute addressing (perhaps -mdynamic-no-pic) used ......
We are kind of lost with this bug.... we tried every solution giving on the subject.
Last solution is Xcode 4.1 just like rusty said... i'll write if it work.
Same Problem for me:
Error occurred while packaging the application:
ld: absolute addressing (perhaps -mdynamic-no-pic) used in _ASDemoGetStringLength from /var/folders/5f/3xcbv8v96gd6_rq6kbmj13900000gp/T/aa9bb7be-0f0e-4e79-8 5df-cc835b7dc2cf/libde.das3.ane.CalendarANE.a(CalendarANE.o) not allowed in slidable image. Use '-read_only_relocs suppress' to enable text relocs
Compilation failed while executing : ld64
Build stops completly with this warning.
Flash Buidler 4.7 on Mac OS 10.7.5
Tried with AIR SDK 3.5 and AIR SDK 3.7.
FREObject ASDemoGetStringLength( FREContext ctx, void* funcData, uint32_t argc, FREObject argv)
NSLog(@"+++ ASDemoGetStringLength +++" );
const uint8_t * stringArgument = NULL;
uint32_t strLength = 0;
FREResult status = FREGetObjectAsUTF8(argv[ 0 ], &strLength, &stringArgument);
int32_t value = [ [NSString stringWithUTF8String:(char *) &stringArgument] length ];
FREObject intValue = NULL;
status = FRENewObjectFromInt32(value, &intValue);
( line which is reponsible for the error is bold and this demo-code is no vodoo magic ).
"Enabled Linking with shared Libraries" is set to no in XCode.
Any solution from Adobe for this?
This "bug" occurs since 10 months for many devs, like we can see with in this thread.
The problem behind is also known.
But there is no fix for this?
I've found a fix for this "error/warning":
In Flash Builder 4.7 update the embedded AIRSDK to version 3.5 or greater like described here:
Replace the embedded AIR SDK in the linked Flex-SDK like described under this link:
Hint: The AIR SDK version for step 1 and step 2 should be exactly the same.
Now update the plattform namespace in your an descriptor files (ANE_NAME-platformoptions.xml and ANE_NAME-extension.xml) to:
(Should be the same like AIR SDK version)
And last but not least update your "app-description-XML" (APPNAME-app.xml) to the used AIR SDK version:
That should fix the problems ...
Hope that helps someone.
Europe, Middle East and Africa