Compile Erlang 24.2 for iOS on mac system

Michael S michael_489@REDACTED
Sun Jan 16 21:52:31 CET 2022


Okay something curious, I compiled with the scripts/install_openssl the Version 1.1.1k for ARCH=ios64-xcrun also verfied that the patch for openssl is applied to "Configurations/15-ios.conf"


./otp_build configure --xcomp-conf=./xcomp/erl-xcomp-arm64-ios.conf --with-ssl=/Users/michael/Entwicklung/ios_openssl

  LD/Users/michael/Entwicklung/compile/ios/otp/bin/aarch64-apple-ios/beam.emu

Apple clang version 13.0.0 (clang-1300.0.29.3)

Target: arm64-apple-darwin21.1.0

Thread model: posix

InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

  "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch arm64 -platform_version ios 15.0.0 15.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk -o /Users/michael/Entwicklung/compile/ios/otp/bin/aarch64-apple-ios/beam.emu -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/lib/ -L../lib/internal/aarch64-apple-ios -lc++ obj/aarch64-apple-ios/opt/emu/erl_main.o obj/aarch64-apple-ios/opt/emu/preload.o obj/aarch64-apple-ios/opt/emu/erl_process.o obj/aarch64-apple-ios/opt/emu/beam_emu.o obj/aarch64-apple-ios/opt/emu/emu_load.o obj/aarch64-apple-ios/opt/emu/beam_common.o obj/aarch64-apple-ios/opt/emu/beam_bif_load.o obj/aarch64-apple-ios/opt/emu/beam_bp.o 
obj/aarch64-apple-ios/opt/emu/beam_catches.o obj/aarch64-apple-ios/opt/emu/beam_debug.o obj/aarch64-apple-ios/opt/emu/beam_load.o obj/aarch64-apple-ios/opt/emu/beam_opcodes.o obj/aarch64-apple-ios/opt/emu/beam_ranges.o obj/aarch64-apple-ios/opt/emu/beam_transform.o obj/aarch64-apple-ios/opt/emu/beam_transform_engine.o obj/aarch64-apple-ios/opt/emu/beam_transform_helpers.o obj/aarch64-apple-ios/opt/emu/code_ix.o obj/aarch64-apple-ios/opt/emu/erl_alloc.o obj/aarch64-apple-ios/opt/emu/erl_mtrace.o obj/aarch64-apple-ios/opt/emu/erl_alloc_util.o obj/aarch64-apple-ios/opt/emu/erl_goodfit_alloc.o obj/aarch64-apple-ios/opt/emu/erl_bestfit_alloc.o obj/aarch64-apple-ios/opt/emu/erl_afit_alloc.o obj/aarch64-apple-ios/opt/emu/erl_init.o obj/aarch64-apple-ios/opt/emu/erl_atom_table.o obj/aarch64-apple-ios/opt/emu/erl_bif_table.o obj/aarch64-apple-ios/opt/emu/erl_bif_ddll.o obj/aarch64-apple-ios/opt/emu/erl_bif_guard.o obj/aarch64-apple-ios/opt/emu/erl_bif_info.o 
obj/aarch64-apple-ios/opt/emu/erl_bif_op.o obj/aarch64-apple-ios/opt/emu/erl_bif_os.o obj/aarch64-apple-ios/opt/emu/erl_bif_lists.o obj/aarch64-apple-ios/opt/emu/erl_bif_persistent.o obj/aarch64-apple-ios/opt/emu/erl_bif_atomics.o obj/aarch64-apple-ios/opt/emu/erl_bif_counters.o obj/aarch64-apple-ios/opt/emu/erl_bif_trace.o obj/aarch64-apple-ios/opt/emu/erl_bif_unique.o obj/aarch64-apple-ios/opt/emu/erl_guard_bifs.o obj/aarch64-apple-ios/opt/emu/erl_dirty_bif_wrap.o obj/aarch64-apple-ios/opt/emu/erl_trace.o obj/aarch64-apple-ios/opt/emu/copy.o obj/aarch64-apple-ios/opt/emu/utils.o obj/aarch64-apple-ios/opt/emu/bif.o obj/aarch64-apple-ios/opt/emu/io.o obj/aarch64-apple-ios/opt/emu/erl_printf_term.o obj/aarch64-apple-ios/opt/emu/erl_debug.o obj/aarch64-apple-ios/opt/emu/erl_md5.o obj/aarch64-apple-ios/opt/emu/erl_message.o obj/aarch64-apple-ios/opt/emu/erl_proc_sig_queue.o obj/aarch64-apple-ios/opt/emu/erl_process_dict.o obj/aarch64-apple-ios/opt/emu/erl_process_lock.o 
obj/aarch64-apple-ios/opt/emu/erl_port_task.o obj/aarch64-apple-ios/opt/emu/erl_arith.o obj/aarch64-apple-ios/opt/emu/time.o obj/aarch64-apple-ios/opt/emu/erl_time_sup.o obj/aarch64-apple-ios/opt/emu/external.o obj/aarch64-apple-ios/opt/emu/dist.o obj/aarch64-apple-ios/opt/emu/binary.o obj/aarch64-apple-ios/opt/emu/erl_db.o obj/aarch64-apple-ios/opt/emu/erl_db_util.o obj/aarch64-apple-ios/opt/emu/erl_db_hash.o obj/aarch64-apple-ios/opt/emu/erl_db_tree.o obj/aarch64-apple-ios/opt/emu/erl_thr_progress.o obj/aarch64-apple-ios/opt/emu/big.o obj/aarch64-apple-ios/opt/emu/hash.o obj/aarch64-apple-ios/opt/emu/index.o obj/aarch64-apple-ios/opt/emu/atom.o obj/aarch64-apple-ios/opt/emu/module.o obj/aarch64-apple-ios/opt/emu/export.o obj/aarch64-apple-ios/opt/emu/register.o obj/aarch64-apple-ios/opt/emu/break.o obj/aarch64-apple-ios/opt/emu/erl_async.o obj/aarch64-apple-ios/opt/emu/erl_lock_check.o obj/aarch64-apple-ios/opt/emu/erl_dyn_lock_check.o obj/aarch64-apple-ios/opt/emu/erl_gc.o 
obj/aarch64-apple-ios/opt/emu/erl_lock_count.o obj/aarch64-apple-ios/opt/emu/erl_posix_str.o obj/aarch64-apple-ios/opt/emu/erl_bits.o obj/aarch64-apple-ios/opt/emu/erl_math.o obj/aarch64-apple-ios/opt/emu/erl_fun.o obj/aarch64-apple-ios/opt/emu/erl_bif_port.o obj/aarch64-apple-ios/opt/emu/erl_term.o obj/aarch64-apple-ios/opt/emu/erl_node_tables.o obj/aarch64-apple-ios/opt/emu/erl_monitor_link.o obj/aarch64-apple-ios/opt/emu/erl_process_dump.o obj/aarch64-apple-ios/opt/emu/erl_hl_timer.o obj/aarch64-apple-ios/opt/emu/erl_cpu_topology.o obj/aarch64-apple-ios/opt/emu/erl_drv_thread.o obj/aarch64-apple-ios/opt/emu/erl_bif_chksum.o obj/aarch64-apple-ios/opt/emu/erl_bif_re.o obj/aarch64-apple-ios/opt/emu/erl_unicode.o obj/aarch64-apple-ios/opt/emu/packet_parser.o obj/aarch64-apple-ios/opt/emu/safe_hash.o obj/aarch64-apple-ios/opt/emu/erl_zlib.o obj/aarch64-apple-ios/opt/emu/erl_nif.o obj/aarch64-apple-ios/opt/emu/erl_bif_binary.o 
obj/aarch64-apple-ios/opt/emu/erl_ao_firstfit_alloc.o obj/aarch64-apple-ios/opt/emu/erl_thr_queue.o obj/aarch64-apple-ios/opt/emu/erl_sched_spec_pre_alloc.o obj/aarch64-apple-ios/opt/emu/erl_ptab.o obj/aarch64-apple-ios/opt/emu/erl_map.o obj/aarch64-apple-ios/opt/emu/erl_msacc.o obj/aarch64-apple-ios/opt/emu/erl_lock_flags.o obj/aarch64-apple-ios/opt/emu/erl_io_queue.o obj/aarch64-apple-ios/opt/emu/erl_db_catree.o obj/aarch64-apple-ios/opt/emu/socket_dbg.o obj/aarch64-apple-ios/opt/emu/socket_tarray.o obj/aarch64-apple-ios/opt/emu/socket_util.o obj/aarch64-apple-ios/opt/emu/erl_flxctr.o obj/aarch64-apple-ios/opt/emu/erl_nfunc_sched.o obj/aarch64-apple-ios/opt/emu/erl_global_literals.o obj/aarch64-apple-ios/opt/emu/beam_file.o obj/aarch64-apple-ios/opt/emu/sys.o obj/aarch64-apple-ios/opt/emu/sys_drivers.o obj/aarch64-apple-ios/opt/emu/sys_env.o obj/aarch64-apple-ios/opt/emu/sys_uds.o obj/aarch64-apple-ios/opt/emu/driver_tab.o obj/aarch64-apple-ios/opt/emu/unix_prim_file.o 
obj/aarch64-apple-ios/opt/emu/sys_float.o obj/aarch64-apple-ios/opt/emu/sys_time.o obj/aarch64-apple-ios/opt/emu/sys_signal_stack.o obj/aarch64-apple-ios/opt/emu/erl_poll.o obj/aarch64-apple-ios/opt/emu/erl_check_io.o obj/aarch64-apple-ios/opt/emu/erl_mseg.o obj/aarch64-apple-ios/opt/emu/erl_mmap.o obj/aarch64-apple-ios/opt/emu/erl_osenv.o obj/aarch64-apple-ios/opt/emu/erl_unix_sys_ddll.o obj/aarch64-apple-ios/opt/emu/erl_mtrace_sys_wrap.o obj/aarch64-apple-ios/opt/emu/erl_sys_common_misc.o obj/aarch64-apple-ios/opt/emu/erl_os_monotonic_time_extender.o obj/aarch64-apple-ios/opt/emu/erl_poll.flbk.o obj/aarch64-apple-ios/opt/emu/erlang_lttng.o obj/aarch64-apple-ios/opt/emu/inet_drv.o obj/aarch64-apple-ios/opt/emu/ram_file_drv.o obj/aarch64-apple-ios/opt/emu/ttsl_drv.o obj/aarch64-apple-ios/opt/emu/erl_tracer_nif.o obj/aarch64-apple-ios/opt/emu/prim_buffer_nif.o obj/aarch64-apple-ios/opt/emu/prim_file_nif.o obj/aarch64-apple-ios/opt/emu/zlib_nif.o 
obj/aarch64-apple-ios/opt/emu/prim_socket_nif.o obj/aarch64-apple-ios/opt/emu/prim_net_nif.o /Users/michael/Entwicklung/compile/ios/otp/lib/asn1/priv/lib/aarch64-apple-ios/asn1rt_nif.a /Users/michael/Entwicklung/compile/ios/otp/lib/crypto/priv/lib/aarch64-apple-ios/crypto.a -lutil -ldl -lm /Users/michael/Entwicklung/compile/ios/otp/erts/emulator/zlib/obj/aarch64-apple-ios/opt/libz.a /Users/michael/Entwicklung/compile/ios/otp/erts/emulator/pcre/obj/aarch64-apple-ios/opt/libepcre.a -lethread -lerts_internal_r -lpthread -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/lib/darwin/libclang_rt.ios.a

Undefined symbols for architecture arm64:

"_BN_CTX_free", referenced from:

_mod_exp_nif in crypto.a(bn_static.o)

_srp_value_B_nif in crypto.a(srp_static.o)

_srp_user_secret_nif in crypto.a(srp_static.o)

_srp_host_secret_nif in crypto.a(srp_static.o)



but the output is also the same as before for the undefined symbols.

The same otp_build configure is also correct with the "with-ssl", because the IOS-BUILD on Erlang said, it should match to libcrypto.a file?
or which erlang github otp tag did you tried it to compiled it that it works?

Thanks Michael


Am 14.01.22 um 16:22 schrieb Dominic Letz:
> Looks like the OpenSSL build you have created is missing some symbols. Getting OpenSSL to cross-compile correctly was fun for me as well although I don't recall all the error messages.
>
> This is the script I'm using to compile OpenSSL (you probably want ARCH=ios64-xcrun for native iOS or ARCH=iossimulator-arm64 for the simulator on an M1)
> https://github.com/elixir-desktop/runtimes/blob/master/scripts/install_openssl.sh
>
> This is the patched cross-compilation config file to make it generate the right symbols:
> https://github.com/elixir-desktop/runtimes/blob/master/patch/openssl-ios.conf
> (copy it to openssl-$VSN/Configurations/15-ios.conf)
>
> And this was my related pull request to get some of this into OpenSSL master, they only merged it to OpenSSL-3.0 though hence I think the manual patching above is atm the only way.
> https://github.com/openssl/openssl/pull/16659
>
> Hope this helps to fix the OpenSSL linkage.
>
> Cheers!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20220116/2cd33bf8/attachment.htm>


More information about the erlang-questions mailing list