Problems building for IOS and linking to libssh2

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems building for IOS and linking to libssh2

rollastre@gmail.com
Hello.

I have built libssh2 with openssl in windows (MVC 2017), linux (GCC >6),
mac (clang 8 - 10), android (NDK19 / API 21-24 / clang) successfully.
Now I am stuck trying to build it for iOS. The error I get is about an
undefined symbol as folows

ld: warning: -headerpad_max_install_names is ignored when used with
-bitcode_bundle (Xcode setting ENABLE_BITCODE=YES)
undefined symbols for architecture armv7:
     "_ENGINE_load_builtin_engines", referenced from:
         _libssh2_init in global.c.o
         __libssh2_init_if_needed in global.c.o
     "_ENGINE_register_all_complete", referenced from:
         _libssh2_init in global.c.o
         __libssh2_init_if_needed in global.c.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see
invocation)

 From what I understand, the problem is that the static lib is not
including a symbol?

I am using XCode 10.2.1 and the command I used to build OpenSSL is

./Configure iphoneos-cross
-lsysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk
-mios-version-min=10.0 -fembed-bitcode -O3
--sysroot=/Application/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk
-fPIC --with-zlib-include=/Users/roll/sdks/zlib/include
--with-zlib-lib=/Users/roll/sdks/zlib/lib

the build process ends without error and a libcrypto.a and libssl.a
files are created.

Can anybody point me what am I doing wrong or misunderstanding?

Thanks in advance.

Reply | Threaded
Open this post in threaded view
|

Re: Problems building for IOS and linking to libssh2

Teja Prabhu
https://stackoverflow.com/questions/6429494/undefined-symbols-for-architecture-armv7

Look at common cause 3 in the first answer. These are the undefined symbols:

"_ENGINE_load_builtin_engines", referenced from:
         _libssh2_init in global.c.o
         __libssh2_init_if_needed in global.c.o
     "_ENGINE_register_all_complete", referenced from:
         _libssh2_init in global.c.o
         __libssh2_init_if_needed in global.c.o

presumably you didn't recompile them for iOS.

Teja Prabhu


On Thu, May 9, 2019 at 12:11 AM [hidden email] <[hidden email]> wrote:
Hello.

I have built libssh2 with openssl in windows (MVC 2017), linux (GCC >6),
mac (clang 8 - 10), android (NDK19 / API 21-24 / clang) successfully.
Now I am stuck trying to build it for iOS. The error I get is about an
undefined symbol as folows

ld: warning: -headerpad_max_install_names is ignored when used with
-bitcode_bundle (Xcode setting ENABLE_BITCODE=YES)
undefined symbols for architecture armv7:
     "_ENGINE_load_builtin_engines", referenced from:
         _libssh2_init in global.c.o
         __libssh2_init_if_needed in global.c.o
     "_ENGINE_register_all_complete", referenced from:
         _libssh2_init in global.c.o
         __libssh2_init_if_needed in global.c.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see
invocation)

 From what I understand, the problem is that the static lib is not
including a symbol?

I am using XCode 10.2.1 and the command I used to build OpenSSL is

./Configure iphoneos-cross
-lsysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk
-mios-version-min=10.0 -fembed-bitcode -O3
--sysroot=/Application/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk
-fPIC --with-zlib-include=/Users/roll/sdks/zlib/include
--with-zlib-lib=/Users/roll/sdks/zlib/lib

the build process ends without error and a libcrypto.a and libssl.a
files are created.

Can anybody point me what am I doing wrong or misunderstanding?

Thanks in advance.