airsdk / Adobe-Runtime-Support

Report, track and discuss issues in Adobe AIR. Monitored by Adobe - and HARMAN - and maintained by the AIR community.
203 stars 11 forks source link

Adt flag "-hideAneLibSymbols yes" does not work since sdk 50.2 #2702

Open vanes1983 opened 1 year ago

vanes1983 commented 1 year ago

Problem Description

I use hideAneLibSymbols to avoid symbol duplicate problem in my multiple extensions. Since 50.2 sdk I cant run any method in extensions i use. Each ANE method call generates "[Fault] exception, information=ArgumentError: Error #3500: The extension context does not have a method with the name ***". I have reproduced the problem on IOS and have not tested it on Android.

Steps to Reproduce

Create any application with extension and build it with "-hideAneLibSymbols yes" flag

minimal example: https://drive.google.com/file/d/1kASisOVJJcCQhz3lrLGe30ozIifjJSZe/view?usp=sharing

Known Workarounds

To use 50.1 with a patch so that it generates files for the xcode/sdk versions required by the App Store: https://github.com/airsdk/Adobe-Runtime-Support/issues/2582#issuecomment-1511395337

marchbold commented 1 year ago

(Personally I feel this option should be deprecated, ANE developers should use unique names for their c functions. This option disables the ability to share code libraries across extensions and enforces duplication. FWIW our extensions don't support it.)

ajwfrost commented 1 year ago

Hi

Is it possible to enable the logging in ADT and check what the linker command is in these two versions? I didn't think anything had changed here but there may have been an update which is a culprit here.

Also would it be possible to provide your example files via the below link as we're unable to access Google Drive. https://transfer.harman.com/requests/LgCujTHB1ghefj088LoFGv

thanks

vanes1983 commented 1 year ago

Is it possible to enable the logging in ADT and check what the linker command is in these two versions? I didn't think anything had changed here but there may have been an update which is a culprit here.

There are some differences

without hideAneLibSymbols yes :

compile-abc command line: C:\Work\projects\sdk\ascsdk\lib\aot/bin/compile-abc/compile-abc-64.exe -mtriple=arm64-apple-ios -filetype=obj -sdk C:\Work\projects\sdk\ascsdk\lib\aot/lib/avmglue.abc -fields C:\Work\projects\sdk\ascsdk\lib\aot/lib/air-fields.arm64-air.txt -O3 -ane-symbol=AirAlertInitializer -ane-symbol=AirAlertFinalizer -abc-file-list=c:\Work\projects\test2\dist\AOTBuildOutput3004933255523208131.tmp\ABCFilesList.txt

ld64 command line: C:\Work\projects\sdk\ascsdk\lib\aot/bin/ld64/ld64.exe -pie -ObjC -dead_strip -Z -arch arm64 -L"C:\Work\projects\sdk\ascsdk\lib\aot/stub" -sdk_version 16.2 -F"C:\Work\projects\sdk\ascsdk\lib\aot/stub" -L"C:\Work\projects\sdk\ascsdk\lib\aot/lib" -o "../aot3435297392292716172.tmp" -exported_symbol _main -exported_symbol __mh_execute_header -x "C:\Work\projects\sdk\ascsdk\lib\aot/lib/libRuntimeHMAOT.arm-air.a" -lc++ -lSystem.B -lz -lobjc -lclang_rt.ios -framework CoreFoundation -framework UIKit -framework MobileCoreServices -framework CoreGraphics -framework Foundation -framework SystemConfiguration -framework AudioToolbox -framework CFNetwork -framework QuartzCore -framework OpenGLES -framework CoreLocation -framework CoreMedia -framework CoreVideo -framework AVFoundation -framework Security -framework GameController -framework CoreMotion -framework AssetsLibrary -framework WebKit -exported_symbol _AirAlertInitializer -exported_symbol _AirAlertFinalizer -filelist "c:\Work\projects\test2\dist\AOTBuildOutput3004933255523208131.tmp\OBJFilesList.txt" -ios_version_min 11.0

hideAneLibSymbols yes :

compile-abc command line: C:\Work\projects\sdk\ascsdk\lib\aot/bin/compile-abc/compile-abc-64.exe -mtriple=arm64-apple-ios -filetype=obj -sdk C:\Work\projects\sdk\ascsdk\lib\aot/lib/avmglue.abc -fields C:\Work\projects\sdk\ascsdk\lib\aot/lib/air-fields.arm64-air.txt -O3 -ane-symbol=com.freshplanet.ane.AirAlert_AirAlertInitializer -ane-symbol=com.freshplanet.ane.AirAlert_AirAlertFinalizer -abc-file-list=c:\Work\projects\test2\dist\AOTBuildOutput14806914845423620903.tmp\ABCFilesList.txt

ld64 command line: C:\Work\projects\sdk\ascsdk\lib\aot/bin/ld64/ld64.exe -r -ObjC -arch arm64 -alias _AirAlertInitializer _com.freshplanet.ane.AirAlert_AirAlertInitializer -exported_symbol _com.freshplanet.ane.AirAlert_AirAlertInitializer -alias _AirAlertFinalizer _com.freshplanet.ane.AirAlert_AirAlertFinalizer -exported_symbol _com.freshplanet.ane.AirAlert_AirAlertFinalizer C:\Users\vanes\AppData\Local\Temp\021c3bc1-75e6-4304-863d-632de41965fa\libcom.freshplanet.ane.AirAlert.a -o "c:\Work\projects\test2\dist\AOTBuildOutput14806914845423620903.tmp\com.freshplanet.ane.AirAlert.o" ld: warning: directory not found for option '-L/usr/lib' ld: warning: directory not found for option '-F/System/Library/Frameworks/'

ld64 command line: C:\Work\projects\sdk\ascsdk\lib\aot/bin/ld64/ld64.exe -pie -ObjC -dead_strip -Z -arch arm64 -L"C:\Work\projects\sdk\ascsdk\lib\aot/stub" -sdk_version 16.2 -F"C:\Work\projects\sdk\ascsdk\lib\aot/stub" -L"C:\Work\projects\sdk\ascsdk\lib\aot/lib" -o "../aot432170050572553561.tmp" -exported_symbol _main -exported_symbol __mh_execute_header -x "C:\Work\projects\sdk\ascsdk\lib\aot/lib/libRuntimeHMAOT.arm-air.a" -lc++ -lSystem.B -lz -lobjc -lclang_rt.ios -framework CoreFoundation -framework UIKit -framework MobileCoreServices -framework CoreGraphics -framework Foundation -framework SystemConfiguration -framework AudioToolbox -framework CFNetwork -framework QuartzCore -framework OpenGLES -framework CoreLocation -framework CoreMedia -framework CoreVideo -framework AVFoundation -framework Security -framework GameController -framework CoreMotion -framework AssetsLibrary -framework WebKit "c:\Work\projects\test2\dist\AOTBuildOutput14806914845423620903.tmp\com.freshplanet.ane.AirAlert.o" -exported_symbol _com.freshplanet.ane.AirAlert_AirAlertInitializer -exported_symbol _com.freshplanet.ane.AirAlert_AirAlertFinalizer -filelist "c:\Work\projects\test2\dist\AOTBuildOutput14806914845423620903.tmp\OBJFilesList.txt" -ios_version_min 11.0

vanes1983 commented 1 year ago

(Personally I feel this option should be deprecated, ANE developers should use unique names for their c functions. This option disables the ability to share code libraries across extensions and enforces duplication. FWIW our extensions don't support it.)

I have followed your suggestion. I have removed duplicated symbols and packaged my project without this flag successfully. So for me this problem is no longer relevant. Thanks.

ajwfrost commented 1 year ago

So it looks like it's doing an extra step when you're hiding the ANE symbols, to create an object file with the symbol names updated to include the ANE namespace, and then this is being linked in .. Not entirely sure why it's then failing to find these symbols at runtime! But thanks for the package, we can try getting this set up to reproduce it and dig into the problem.

Probably with a lower priority though, based on the above workaround/option..

thanks