Link errors with OpenSSL plugin when building universal (32 + 64-bit) binaries for iOS

We’ve started building with Corona Enterprise daily build 2515 and have updated our project settings to target armv7 and arm64. Unfortunately, we’re running into errors when linking against the libplugin.openssl.a library.

The errors start with the following:

Undefined symbols for architecture arm64:

  “_ASN1_INTEGER_free”, referenced from:

      _openssl_X509_REVOKED in libplugin.openssl.a(crl.o)

      _openssl_crl_parse in libplugin.openssl.a(crl.o)

      _openssl_ocsp_request_new in libplugin.openssl.a(ocsp.o)

And this continues on for 200+ symbols before Xcode cuts off reporting undefined symbols.

Has anyone managed to successfully link against the 64-bit slice of the OpenSSL plugin archive, or is this a known issue that will be addressed soon? Where are those missing symbols normally defined (i.e. is there a separate library that we need to link to in our project settings)?

Thanks

Bumping because this appears to be an issue with the OpenSSL plugin library.

Using the nm tool to list all symbols for all architectures in the “libplugin.openssl.a” file (size: 13,834,560 bytes) from Daily Build 2515 shows that the ASN1_INTEGER_free symbol is present for several architectures, but not for the arm64 architecture.

Here are the lines showing the object files where the _ASN1_INTEGER_free symbol is defined for the armv7, i386, x86_64 architectures:

(for architecture armv7):libplugin.openssl.a:tasn_typ.o: 00000030 T _ASN1_INTEGER_free

(for architecture i386):libplugin.openssl.a:tasn_typ.o: 00000090 T _ASN1_INTEGER_free

(for architecture x86_64):libplugin.openssl.a:tasn_typ.o: 0000000000000060 T _ASN1_INTEGER_free

So it seems the plugin library should be rebuilt to include the arm64 slice.

Engineering is looking into this.

Rob

Thanks. That would really help us with our testing on 64-bit devices.

hello rob, me also have that problem when try to use xcode simulator to test my app,

please reply when the update for this topic solved

thank you :slight_smile:

Hi,

This issue has been resolved and will be in the next daily build.

Posting a follow-up to confirm that the OpenSSL library included in the 2532 daily build links without the missing symbol errors that we encountered in previous versions. Thanks.

hello d can i still have problem with the openssl plugin,

can u provide which version of the plugin were fixed?

and maybe an example that works

hello dcan, hello rob i have download new corona update 2543 from information that i saw in http://coronalabs.com/blog/2015/01/21/update-on-corona-ios-64-bit-support-and-plugins/

but i still got this error on xcode when i m trying to use open ssl

Undefined symbols for architecture x86_64:
  “_opendir$INODE64”, referenced from:
      _OPENSSL_DIR_read in libplugin.openssl.a(o_dir.o)
  “_readdir$INODE64”, referenced from:
      _OPENSSL_DIR_read in libplugin.openssl.a(o_dir.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

  “_opendir$INODE64”, referenced from:

      _OPENSSL_DIR_read in libplugin.openssl.a(o_dir.o)

  “_readdir$INODE64”, referenced from:

      _OPENSSL_DIR_read in libplugin.openssl.a(o_dir.o)

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Ld /Users/jonas/Library/Developer/Xcode/DerivedData/App-fjnmeiaujhxqlaglapwhcmhmnblh/Build/Intermediates/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/App normal i386
    cd /Users/jonas/Documents/svnxRepository/_1.snakes_hunt/code/ios/ios
    export IPHONEOS_DEPLOYMENT_TARGET=6.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/jonas/Library/Developer/Xcode/DerivedData/App-fjnmeiaujhxqlaglapwhcmhmnblh/Build/Products/Debug-iphonesimulator -L/Users/jonas/Documents/svnxRepository/_1.snakes_hunt/code/ios/ios/CoronaEnterprise/Corona/ios/lib -L/Applications/CoronaEnterprisePlugins/openssl/2014.2159/iphone -L/Applications/CoronaEnterprisePlugins/analytics-flurry/2014.2264/iphone -L/Applications/CoronaEnterprisePlugins/gameNetwork-apple/2014.2455/iphone -L/Applications/CoronaEnterprisePlugins/gameanalytics/2013.1202/iphone -L/Applications/CoronaEnterprisePlugins/native-popup-social/2013.1164/iphone -L/Applications/CoronaEnterprisePlugins/facebook/2014.2430/iphone -L/Users/jonas/Documents/svnxRepository/_1.snakes_hunt/code/ios/ios/Ads -L/Users/jonas/Documents/svnxRepository/_1.snakes_hunt/code/ios/ios/Ads/Applovin -F/Users/jonas/Library/Developer/Xcode/DerivedData/App-fjnmeiaujhxqlaglapwhcmhmnblh/Build/Products/Debug-iphonesimulator -F/Users/jonas/Documents/svnxRepository/_1.snakes_hunt/code/ios/ios/Ads/Chartboost -filelist /Users/jonas/Library/Developer/Xcode/DerivedData/App-fjnmeiaujhxqlaglapwhcmhmnblh/Build/Intermediates/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/App.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -all_load -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.0 -framework CoreMedia -framework CoreTelephony -framework AdSupport -framework Chartboost -lfacebook -lAppLovinSdk -lplugin.openssl -lanalytics-flurry -lgamenetwork-apple -lplugin_gameanalytics -lnative-popup-social -framework CoreVideo -framework GLKit -weak_framework Accounts -weak_framework Social -framework AddressBook -framework AddressBookUI -framework AudioToolbox -framework AVFoundation -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework CoreMotion -framework Foundation -framework GameKit -framework ImageIO -lobjc -lsqlite3 -framework MapKit -framework MediaPlayer -framework MessageUI -framework MobileCoreServices -framework OpenAL -framework OpenGLES -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -weak_framework Twitter -framework UIKit -lplayer /Users/jonas/Library/Developer/Xcode/DerivedData/App-fjnmeiaujhxqlaglapwhcmhmnblh/Build/Products/Debug-iphonesimulator/libplugin_library.a -Xlinker -dependency_info -Xlinker /Users/jonas/Library/Developer/Xcode/DerivedData/App-fjnmeiaujhxqlaglapwhcmhmnblh/Build/Intermediates/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/App_dependency_info.dat -o /Users/jonas/Library/Developer/Xcode/DerivedData/App-fjnmeiaujhxqlaglapwhcmhmnblh/Build/Intermediates/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/App

Undefined symbols for architecture i386:
  “_fwrite$UNIX2003”, referenced from:
      _int_rsa_verify in libplugin.openssl.a(rsa_sign.o)
      _test_rc4_init_key in libplugin.openssl.a(eng_openssl.o)
      _TXT_DB_read in libplugin.openssl.a(txt_db.o)
      _read_string in libplugin.openssl.a(ui_openssl.o)
      _read_string_inner in libplugin.openssl.a(ui_openssl.o)
      _ENGINE_load_gost in libplugin.openssl.a(gost_eng.o)
      _dtls1_retransmit_buffered_messages in libplugin.openssl.a(d1_both.o)
      …
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
 

is there anything that i’ve missed?

because i have change the corona enterprise and the plugin with build 2543

Hi DragonGameStudio,

We ran into this issue as well, and found a solution posted by another developer. You can fix this by adding the following functions to any of your Objective-C, C or C++ source files for your project. We added them to our main.mm:

// Functions that appear to be missing when targeting the Xcode iOS Simulators // These are used by the Corona SDK OpenSSL plugin #include \<dirent.h\> #include \<fnmatch.h\> extern "C" DIR \* opendir$INODE64( char \* dirName ); DIR \* opendir$INODE64( char \* dirName ) { return opendir( dirName ); } extern "C" struct dirent \* readdir$INODE64( DIR \* dir ); struct dirent \* readdir$INODE64( DIR \* dir ) { return readdir( dir ); }

You may have to implement additional wrapper functions, but these are the two that we needed.

Hope that helps.

hello nixhydra2, i have try your solution,

but i still get same error,

do you still have another?

Bumping because this appears to be an issue with the OpenSSL plugin library.

Using the nm tool to list all symbols for all architectures in the “libplugin.openssl.a” file (size: 13,834,560 bytes) from Daily Build 2515 shows that the ASN1_INTEGER_free symbol is present for several architectures, but not for the arm64 architecture.

Here are the lines showing the object files where the _ASN1_INTEGER_free symbol is defined for the armv7, i386, x86_64 architectures:

(for architecture armv7):libplugin.openssl.a:tasn_typ.o: 00000030 T _ASN1_INTEGER_free

(for architecture i386):libplugin.openssl.a:tasn_typ.o: 00000090 T _ASN1_INTEGER_free

(for architecture x86_64):libplugin.openssl.a:tasn_typ.o: 0000000000000060 T _ASN1_INTEGER_free

So it seems the plugin library should be rebuilt to include the arm64 slice.

Engineering is looking into this.

Rob

Thanks. That would really help us with our testing on 64-bit devices.

hello rob, me also have that problem when try to use xcode simulator to test my app,

please reply when the update for this topic solved

thank you :slight_smile:

Hi,

This issue has been resolved and will be in the next daily build.

Posting a follow-up to confirm that the OpenSSL library included in the 2532 daily build links without the missing symbol errors that we encountered in previous versions. Thanks.

hello d can i still have problem with the openssl plugin,

can u provide which version of the plugin were fixed?

and maybe an example that works

hello dcan, hello rob i have download new corona update 2543 from information that i saw in http://coronalabs.com/blog/2015/01/21/update-on-corona-ios-64-bit-support-and-plugins/

but i still got this error on xcode when i m trying to use open ssl

Undefined symbols for architecture x86_64:
  “_opendir$INODE64”, referenced from:
      _OPENSSL_DIR_read in libplugin.openssl.a(o_dir.o)
  “_readdir$INODE64”, referenced from:
      _OPENSSL_DIR_read in libplugin.openssl.a(o_dir.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

  “_opendir$INODE64”, referenced from:

      _OPENSSL_DIR_read in libplugin.openssl.a(o_dir.o)

  “_readdir$INODE64”, referenced from:

      _OPENSSL_DIR_read in libplugin.openssl.a(o_dir.o)

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Ld /Users/jonas/Library/Developer/Xcode/DerivedData/App-fjnmeiaujhxqlaglapwhcmhmnblh/Build/Intermediates/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/App normal i386
    cd /Users/jonas/Documents/svnxRepository/_1.snakes_hunt/code/ios/ios
    export IPHONEOS_DEPLOYMENT_TARGET=6.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/jonas/Library/Developer/Xcode/DerivedData/App-fjnmeiaujhxqlaglapwhcmhmnblh/Build/Products/Debug-iphonesimulator -L/Users/jonas/Documents/svnxRepository/_1.snakes_hunt/code/ios/ios/CoronaEnterprise/Corona/ios/lib -L/Applications/CoronaEnterprisePlugins/openssl/2014.2159/iphone -L/Applications/CoronaEnterprisePlugins/analytics-flurry/2014.2264/iphone -L/Applications/CoronaEnterprisePlugins/gameNetwork-apple/2014.2455/iphone -L/Applications/CoronaEnterprisePlugins/gameanalytics/2013.1202/iphone -L/Applications/CoronaEnterprisePlugins/native-popup-social/2013.1164/iphone -L/Applications/CoronaEnterprisePlugins/facebook/2014.2430/iphone -L/Users/jonas/Documents/svnxRepository/_1.snakes_hunt/code/ios/ios/Ads -L/Users/jonas/Documents/svnxRepository/_1.snakes_hunt/code/ios/ios/Ads/Applovin -F/Users/jonas/Library/Developer/Xcode/DerivedData/App-fjnmeiaujhxqlaglapwhcmhmnblh/Build/Products/Debug-iphonesimulator -F/Users/jonas/Documents/svnxRepository/_1.snakes_hunt/code/ios/ios/Ads/Chartboost -filelist /Users/jonas/Library/Developer/Xcode/DerivedData/App-fjnmeiaujhxqlaglapwhcmhmnblh/Build/Intermediates/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/App.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -all_load -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.0 -framework CoreMedia -framework CoreTelephony -framework AdSupport -framework Chartboost -lfacebook -lAppLovinSdk -lplugin.openssl -lanalytics-flurry -lgamenetwork-apple -lplugin_gameanalytics -lnative-popup-social -framework CoreVideo -framework GLKit -weak_framework Accounts -weak_framework Social -framework AddressBook -framework AddressBookUI -framework AudioToolbox -framework AVFoundation -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework CoreMotion -framework Foundation -framework GameKit -framework ImageIO -lobjc -lsqlite3 -framework MapKit -framework MediaPlayer -framework MessageUI -framework MobileCoreServices -framework OpenAL -framework OpenGLES -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -weak_framework Twitter -framework UIKit -lplayer /Users/jonas/Library/Developer/Xcode/DerivedData/App-fjnmeiaujhxqlaglapwhcmhmnblh/Build/Products/Debug-iphonesimulator/libplugin_library.a -Xlinker -dependency_info -Xlinker /Users/jonas/Library/Developer/Xcode/DerivedData/App-fjnmeiaujhxqlaglapwhcmhmnblh/Build/Intermediates/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/App_dependency_info.dat -o /Users/jonas/Library/Developer/Xcode/DerivedData/App-fjnmeiaujhxqlaglapwhcmhmnblh/Build/Intermediates/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/App

Undefined symbols for architecture i386:
  “_fwrite$UNIX2003”, referenced from:
      _int_rsa_verify in libplugin.openssl.a(rsa_sign.o)
      _test_rc4_init_key in libplugin.openssl.a(eng_openssl.o)
      _TXT_DB_read in libplugin.openssl.a(txt_db.o)
      _read_string in libplugin.openssl.a(ui_openssl.o)
      _read_string_inner in libplugin.openssl.a(ui_openssl.o)
      _ENGINE_load_gost in libplugin.openssl.a(gost_eng.o)
      _dtls1_retransmit_buffered_messages in libplugin.openssl.a(d1_both.o)
      …
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
 

is there anything that i’ve missed?

because i have change the corona enterprise and the plugin with build 2543

Hi DragonGameStudio,

We ran into this issue as well, and found a solution posted by another developer. You can fix this by adding the following functions to any of your Objective-C, C or C++ source files for your project. We added them to our main.mm:

// Functions that appear to be missing when targeting the Xcode iOS Simulators // These are used by the Corona SDK OpenSSL plugin #include \<dirent.h\> #include \<fnmatch.h\> extern "C" DIR \* opendir$INODE64( char \* dirName ); DIR \* opendir$INODE64( char \* dirName ) { return opendir( dirName ); } extern "C" struct dirent \* readdir$INODE64( DIR \* dir ); struct dirent \* readdir$INODE64( DIR \* dir ) { return readdir( dir ); }

You may have to implement additional wrapper functions, but these are the two that we needed.

Hope that helps.