Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:19
erlang
3801-xcomp-Add-aarch64-darwin.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 3801-xcomp-Add-aarch64-darwin.patch of Package erlang
From a484d2c66747d5c6df8e77028f48e9d1fb1e6d62 Mon Sep 17 00:00:00 2001 From: Wojtek Mach <wojtek@wojtekmach.pl> Date: Wed, 24 Nov 2021 22:28:30 +0100 Subject: [PATCH 1/2] xcomp: Add aarch64-darwin Below [1] is a script to cross-compile OpenSSL & OTP for aarch64-darwin. A couple of notes however: 1. Wx cannot be cross-compiled yet: > ``` > ********************************************************************* > ********************************************************************* > ********************** APPLICATIONS INFORMATION ******************* > ********************************************************************* > > wx : Cross compilation of the wx driver is not supported yet, wx will NOT be usable > ``` 2. Erlang shell successfully starts: $ uname -sm Darwin arm64 $ ./bin/erl Erlang/OTP 24 [erts-12.1.5] [source-df1294f108] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] Eshell V12.1.5 (abort with ^G) 1> 3. But crypto is not working yet: ./bin/erl Erlang/OTP 24 [erts-12.1.5] [source-df1294f108] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] Eshell V12.1.5 (abort with ^G) 1> crypto:start(). =ERROR REPORT==== 29-Nov-2021::14:50:14.218776 === Unable to load crypto library. Failed with error: "load_failed, Failed to load NIF library: 'dlopen(/Users/wojtek/Downloads/otp-24.1.7-aarch64-darwin/lib/crypto-5.0.4/priv/lib/crypto.so, 2): no suitable image found. Did find: /Users/wojtek/Downloads/otp-24.1.7-aarch64-darwin/lib/crypto-5.0.4/priv/lib/crypto.so: mach-o, but wrong filetype /Users/wojtek/Downloads/otp-24.1.7-aarch64-darwin/lib/crypto-5.0.4/priv/lib/crypto.so: stat() failed with errno=35'" OpenSSL might not be installed on this system. =WARNING REPORT==== 29-Nov-2021::14:50:14.222040 === The on_load function for module crypto returned: {error,{load_failed,"Failed to load NIF library: 'dlopen(/Users/wojtek/Downloads/otp-24.1.7-aarch64-darwin/lib/crypto-5.0.4/priv/lib/crypto.so, 2): no suitable image found. Did find:\n\t/Users/wojtek/Downloads/otp-24.1.7-aarch64-darwin/lib/crypto-5.0.4/priv/lib/crypto.so: mach-o, but wrong filetype\n\t/Users/wojtek/Downloads/otp-24.1.7-aarch64-darwin/lib/crypto-5.0.4/priv/lib/crypto.so: stat() failed with errno=35'"}} ** exception error: undefined function crypto:start/0 [1] the script: ``` set -e main() { export MAKEFLAGS=-j$(getconf _NPROCESSORS_ONLN) openssl_vsn=1.1.1l otp_vsn=$(cat OTP_VERSION) target=aarch64-darwin openssl_dir="$PWD/tmp/openssl-$openssl_vsn-$target" otp_dir="$PWD/tmp/otp-$otp_vsn-$target" mkdir -p tmp if [ ! -d "$openssl_dir" ]; then build_openssl $openssl_dir $openssl_vsn $target fi export PATH=$openssl_dir/bin:$PATH echo "openssl" file `which openssl` echo if [ ! -d $otp_dir ]; then build_otp $otp_dir $otp_vsn $target $openssl_dir fi (cd $otp_dir && ./Install -sasl $PWD) export PATH=$otp_dir/bin:$PATH echo "otp" file `which erlc` file $otp_dir/lib/crypto-*/priv/lib/crypto.so # erl +V # erl -noshell -eval 'ok = crypto:start(), io:format("crypto ok~n"), halt().' echo } build_openssl() { dir=$1 vsn=$2 target=$3 if [ "$target" = "x86_64-darwin" ]; then openssl_target=darwin64-x86_64-cc fi if [ "$target" = "aarch64-darwin" ]; then openssl_target=darwin64-arm64-cc fi cd tmp if [ ! -d openssl-$vsn-src ]; then url=https://www.openssl.org/source/openssl-$vsn.tar.gz echo "downloading $url" curl --fail -LO $url tar -xf openssl-$vsn.tar.gz mv openssl-$vsn openssl-$vsn-src fi cd openssl-$vsn-src ./Configure \ $openssl_target \ --prefix=$dir make make install_sw cd ../.. } build_otp() { dir=$1 vsn=$2 target=$3 openssl_dir=$4 cwd=$PWD # path to OTP git checkout. Comment-out if you want to download it. otp_src_dir=$HOME/src/otp if [ ! -d "$otp_src_dir" ]; then cd tmp url="https://github.com/erlang/otp/releases/download/OTP-${vsn}/otp_src_${vsn}.tar.gz" echo "downloading $url" curl --fail -LO $url tar -xf otp_src_${vsn}.tar.gz cd otp_src_${vsn} fi export ERL_TOP=`pwd` ./otp_build configure \ --disable-dynamic-ssl-lib \ --with-ssl=$openssl_dir \ --xcomp-conf=xcomp/erl-xcomp-$target.conf ./otp_build boot -a ./otp_build release -a $dir cd $cwd } main ``` --- xcomp/erl-xcomp-aarch64-darwin.conf | 283 ++++++++++++++++++++++++++++ 1 file changed, 283 insertions(+) create mode 100644 xcomp/erl-xcomp-aarch64-darwin.conf diff --git a/xcomp/erl-xcomp-aarch64-darwin.conf b/xcomp/erl-xcomp-aarch64-darwin.conf new file mode 100644 index 0000000000..1dd15aeb16 --- /dev/null +++ b/xcomp/erl-xcomp-aarch64-darwin.conf @@ -0,0 +1,283 @@ +## -*-shell-script-*- +## +## %CopyrightBegin% +## +## Copyright Ericsson AB 2009-2012. All Rights Reserved. +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## +## %CopyrightEnd% +## +## File: erl-xcomp.conf.template +## Author: Rickard Green +## +## ----------------------------------------------------------------------------- +## When cross compiling Erlang/OTP using `otp_build', copy this file and set +## the variables needed below. Then pass the path to the copy of this file as +## an argument to `otp_build' in the configure stage: +## `otp_build configure --xcomp-conf=<FILE>' +## ----------------------------------------------------------------------------- + +## Note that you cannot define arbitrary variables in a cross compilation +## configuration file. Only the ones listed below will be guaranteed to be +## visible throughout the whole execution of all `configure' scripts. Other +## variables needs to be defined as arguments to `configure' or exported in +## the environment. + +## -- Variables for `otp_build' Only ------------------------------------------- + +## Variables in this section are only used, when configuring Erlang/OTP for +## cross compilation using `$ERL_TOP/otp_build configure'. + +## *NOTE*! These variables currently have *no* effect if you configure using +## the `configure' script directly. + +# * `erl_xcomp_build' - The build system used. This value will be passed as +# `--build=$erl_xcomp_build' argument to the `configure' script. It does +# not have to be a full `CPU-VENDOR-OS' triplet, but can be. The full +# `CPU-VENDOR-OS' triplet will be created by +# `$ERL_TOP/make/autoconf/config.sub $erl_xcomp_build'. If set to `guess', +# the build system will be guessed using +# `$ERL_TOP/make/autoconf/config.guess'. +erl_xcomp_build=guess + +# * `erl_xcomp_host' - Cross host/target system to build for. This value will +# be passed as `--host=$erl_xcomp_host' argument to the `configure' script. +# It does not have to be a full `CPU-VENDOR-OS' triplet, but can be. The +# full `CPU-VENDOR-OS' triplet will be created by +# `$ERL_TOP/make/autoconf/config.sub $erl_xcomp_host'. +erl_xcomp_host=aarch64-apple-darwin + +# * `erl_xcomp_configure_flags' - Extra configure flags to pass to the +# `configure' script. +erl_xcomp_configure_flags="" + +## -- Cross Compiler and Other Tools ------------------------------------------- + +## If the cross compilation tools are prefixed by `<HOST>-' you probably do +## not need to set these variables (where `<HOST>' is what has been passed as +## `--host=<HOST>' argument to `configure'). + +## All variables in this section can also be used when native compiling. + +export XCOMP_SDK=macosx +export XCOMP_SDKROOT=`xcrun -sdk $XCOMP_SDK --show-sdk-path` +export XCOMP_ARCH="-arch arm64" + +# * `CC' - C compiler. +CC="xcrun -sdk $XCOMP_SDK cc $XCOMP_ARCH" + +# * `CFLAGS' - C compiler flags. +CFLAGS="" + +# * `STATIC_CFLAGS' - Static C compiler flags. +#STATIC_CFLAGS= + +# * `CFLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library +# search path for the shared libraries. Note that this actually is a +# linker flag, but it needs to be passed via the compiler. +#CFLAG_RUNTIME_LIBRARY_PATH= + +# * `CPP' - C pre-processor. +#CPP= + +# * `CPPFLAGS' - C pre-processor flags. +#CPPFLAGS= + +# * `CXX' - C++ compiler. +CXX="xcrun -sdk $XCOMP_SDK c++ $XCOMP_ARCH" + +# * `CXXFLAGS' - C++ compiler flags. +CXXFLAGS=$CFLAGS + +# * `LD' - Linker. +LD="xcrun -sdk $XCOMP_SDK ld $XCOMP_ARCH" + +# * `LDFLAGS' - Linker flags. +LDFLAGS="-L$XCOMP_SDKROOT/usr/lib/ -lc++ -v" + +# * `LIBS' - Libraries. +#LIBS= + +## -- *D*ynamic *E*rlang *D*river Linking -- + +## *NOTE*! Either set all or none of the `DED_LD*' variables. + +# * `DED_LD' - Linker for Dynamically loaded Erlang Drivers. +DED_LD=$LD + +# * `DED_LDFLAGS' - Linker flags to use with `DED_LD'. +DED_LDFLAGS="-L$XCOMP_SDKROOT/usr/lib/ -r -v" + +# * `DED_LD_FLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library +# search path for shared libraries when linking with `DED_LD'. +#DED_LD_FLAG_RUNTIME_LIBRARY_PATH= + +## -- Large File Support -- + +## *NOTE*! Either set all or none of the `LFS_*' variables. + +# * `LFS_CFLAGS' - Large file support C compiler flags. +#LFS_CFLAGS= + +# * `LFS_LDFLAGS' - Large file support linker flags. +#LFS_LDFLAGS= + +# * `LFS_LIBS' - Large file support libraries. +#LFS_LIBS= + +## -- Other Tools -- + +# * `RANLIB' - `ranlib' archive index tool. +RANLIB="xcrun -sdk $XCOMP_SDK ranlib" + +# * `AR' - `ar' archiving tool. +AR="xcrun -sdk $XCOMP_SDK ar" + +# * `GETCONF' - `getconf' system configuration inspection tool. `getconf' is +# currently used for finding out large file support flags to use, and +# on Linux systems for finding out if we have an NPTL thread library or +# not. +#GETCONF= + +## -- Cross System Root Locations ---------------------------------------------- + +# * `erl_xcomp_sysroot' - The absolute path to the system root of the cross +# compilation environment. Currently, the `crypto', `odbc', `ssh' and +# `ssl' applications need the system root. These applications will be +# skipped if the system root has not been set. The system root might be +# needed for other things too. If this is the case and the system root +# has not been set, `configure' will fail and request you to set it. +erl_xcomp_sysroot=$XCOMP_SDKROOT + +# * `erl_xcomp_isysroot' - The absolute path to the system root for includes +# of the cross compilation environment. If not set, this value defaults +# to `$erl_xcomp_sysroot', i.e., only set this value if the include system +# root path is not the same as the system root path. +#erl_xcomp_isysroot= + +## -- Optional Feature, and Bug Tests ------------------------------------------ + +## These tests cannot (always) be done automatically when cross compiling. You +## usually do not need to set these variables. Only set these if you really +## know what you are doing. + +## Note that some of these values will override results of tests performed +## by `configure', and some will not be used until `configure' is sure that +## it cannot figure the result out. + +## The `configure' script will issue a warning when a default value is used. +## When a variable has been set, no warning will be issued. + +# * `erl_xcomp_after_morecore_hook' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `__after_morecore_hook' that can be +# used for tracking used `malloc()' implementations core memory usage. +# This is currently only used by unsupported features. +#erl_xcomp_after_morecore_hook= + +# * `erl_xcomp_bigendian' - `yes|no'. No default. If `yes', the target system +# must be big endian. If `no', little endian. This can often be +# automatically detected, but not always. If not automatically detected, +# `configure' will fail unless this variable is set. Since no default +# value is used, `configure' will try to figure this out automatically. +#erl_xcomp_bigendian= + +# * `erl_xcomp_double_middle` - `yes|no`. No default. If `yes`, the +# target system must have doubles in "middle-endian" format. If +# `no`, it has "regular" endianness. This can often be automatically +# detected, but not always. If not automatically detected, +# `configure` will fail unless this variable is set. Since no +# default value is used, `configure` will try to figure this out +# automatically. +#erl_xcomp_double_middle_endian + +# * `erl_xcomp_clock_gettime_cpu_time' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `clock_gettime()' implementation +# that can be used for retrieving process CPU time. +#erl_xcomp_clock_gettime_cpu_time= + +# * `erl_xcomp_getaddrinfo' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a working `getaddrinfo()' implementation that can +# handle both IPv4 and IPv6. +#erl_xcomp_getaddrinfo= + +# * `erl_xcomp_gethrvtime_procfs_ioctl' - `yes|no'. Defaults to `no'. If `yes', +# the target system must have a working `gethrvtime()' implementation and +# is used with procfs `ioctl()'. +#erl_xcomp_gethrvtime_procfs_ioctl= + +# * `erl_xcomp_dlsym_brk_wrappers' - `yes|no'. Defaults to `no'. If `yes', the +# target system must have a working `dlsym(RTLD_NEXT, <S>)' implementation +# that can be used on `brk' and `sbrk' symbols used by the `malloc()' +# implementation in use, and by this track the `malloc()' implementations +# core memory usage. This is currently only used by unsupported features. +#erl_xcomp_dlsym_brk_wrappers= + +# * `erl_xcomp_kqueue' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a working `kqueue()' implementation that returns a file +# descriptor which can be used by `poll()' and/or `select()'. If `no' and +# the target system has not got `epoll()' or `/dev/poll', the kernel-poll +# feature will be disabled. +#erl_xcomp_kqueue= + +# * `erl_xcomp_linux_clock_gettime_correction' - `yes|no'. Defaults to `yes' on +# Linux; otherwise, `no'. If `yes', `clock_gettime(CLOCK_MONOTONIC, _)' on +# the target system must work. This variable is recommended to be set to +# `no' on Linux systems with kernel versions less than 2.6. +#erl_xcomp_linux_clock_gettime_correction= + +# * `erl_xcomp_linux_nptl' - `yes|no'. Defaults to `yes' on Linux; otherwise, +# `no'. If `yes', the target system must have NPTL (Native POSIX Thread +# Library). Older Linux systems have LinuxThreads instead of NPTL (Linux +# kernel versions typically less than 2.6). +#erl_xcomp_linux_nptl= + +# * `erl_xcomp_linux_usable_sigaltstack' - `yes|no'. Defaults to `yes' on Linux; +# otherwise, `no'. If `yes', `sigaltstack()' must be usable on the target +# system. `sigaltstack()' on Linux kernel versions less than 2.4 are +# broken. +#erl_xcomp_linux_usable_sigaltstack= + +# * `erl_xcomp_linux_usable_sigusrx' - `yes|no'. Defaults to `yes'. If `yes', +# the `SIGUSR1' and `SIGUSR2' signals must be usable by the ERTS. Old +# LinuxThreads thread libraries (Linux kernel versions typically less than +# 2.2) used these signals and made them unusable by the ERTS. +#erl_xcomp_linux_usable_sigusrx= + +# * `erl_xcomp_poll' - `yes|no'. Defaults to `no' on Darwin/MacOSX; otherwise, +# `yes'. If `yes', the target system must have a working `poll()' +# implementation that also can handle devices. If `no', `select()' will be +# used instead of `poll()'. +#erl_xcomp_poll= + +# * `erl_xcomp_putenv_copy' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have a `putenv()' implementation that stores a copy of the +# key/value pair. +#erl_xcomp_putenv_copy= + +# * `erl_xcomp_reliable_fpe' - `yes|no'. Defaults to `no'. If `yes', the target +# system must have reliable floating point exceptions. +#erl_xcomp_reliable_fpe= + +# * `erl_xcomp_posix_memalign' - `yes|no'. Defaults to `yes' if `posix_memalign' +# system call exists; otherwise `no'. If `yes', the target system must have a +# `posix_memalign' implementation that accepts larger than page size +# alignment. +#erl_xcomp_posix_memalign= + +# * `erl_xcomp_code_model_small` - `yes|no`. Default to `no`. If `yes`, the target +# system must place the beam.smp executable in the lower 2 GB of memory. That is it +# should not use position independent executable. +#erl_xcomp_code_model_small= + +## ----------------------------------------------------------------------------- -- 2.31.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor