When I upgraded my Mac OS X and my MacPorts Erlang was update to R16B03-1 version I have problem with new version of Erlang. I have application with parameterized modules which are no longer supported in R16**

If you need different version of Erlang on your OS Kerl – is great solution.

You can download the script directly from github:

$ curl -O https://raw.github.com/spawngrid/kerl/master/kerl

 

Then ensure it is executable

$ chmod a+x kerl

 

Usage

List the available releases (kerl ignores releases < 10):

$ kerl list releases
Getting the available releases from erlang.org...
R10B-0 R10B-2 R10B-3 R10B-4 R10B-5 R10B-6 R10B-7 R10B-8 R10B-9 R11B-0 R11B-1
R11B-2 R11B-3 R11B-4 R11B-5 R12B-0 R12B-1 R12B-2 R12B-3 R12B-4 R12B-5 R13A
R13B R13B01 R13B02 R13B03 R13B04 R14A R14B R14B01 R14B02

 

Run “./kerl update releases” to update this list from erlang.org
Pick your choice and build it:

$ kerl build R14B02 r14b02
Downloading otp_src_R14B02.tar.gz to /home/evax/.kerl/archives
(curl progresses...)
Verifying archive checksum...
(curl progresses...)
Checksum verified (229fb8f193b09ac04a57a9d7794349b7)
Extracting source code
Building Erlang/OTP R14B02 (r14b02), please wait...
Erlang/OTP R14B02 has been successfully built

 

Note that named builds allow you to have different builds for the same Erlang/OTP release with different configure options:

$ KERL_CONFIGURE_OPTIONS=--enable-hipe kerl build R14B02 r14b02_hipe
Verifying archive checksum...
Checksum verified (229fb8f193b09ac04a57a9d7794349b7)
Extracting source code
Building Erlang/OTP R14B02 (r14b02_hipe), please wait...
Erlang/OTP R14B02 (r14b02_hipe) has been successfully built
(Note that kerl uses the otp_build script internally, and './otp_build configure' disables HiPE on linux)

 

You can verify your build has been registered:

$ kerl list builds
R14B02,r14b02
R14B02,r14b02_hipe

 

Now install a build to some location:

$ kerl install r14b02 /path/to/install/dir/
Installing Erlang/OTP R14B02 (r14b02) in /path/to/install/dir...
You can activate this installation running the following command:
. /path/to/install/dir/activate

 

Later on, you can leave the installation typing:

kerl_deactivate

 

Here again you can check the installation’s been registered:

$ kerl list installations
r14b02 /path/to/install/dir

 

And at last activate it:

$ . /path/to/install/dir/activate

 

Activation will backup your $PATH, prepend it with the installation’s bin/ directory. Thus it’s only valid for the current shell session, and until you activate another installation or call kerl_deactivate.

You’re now ready to work with your r14b02 installation:

$ erl -version
Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 5.8.3

 

When you’re done just type: $ kerl_deactivate

Anytime you can check which installation, if any, is currently active with:

$ kerl active
No Erlang/OTP kerl installation is currently active

 

You can get an overview of the current kerl state with:

$ kerl status
Available builds:
R14B02,r14b02
R14B02,r14b02_hipe
----------
Available installations:
r14b02 /path/to/install/dir
----------
Currently active installation:
The current active installation is:
/path/to/install/dir

 

You can delete builds and installations with the following commands:

$ kerl delete build r14b02

 

The r14b02 build has been deleted

$ kerl delete installation /path/to/install/dir

 

The installation in /path/to/install/dir has been deleted
You can easily deploy an installation to another host having ssh and rsync access with the following command:

$ kerl deploy anotherhost /path/to/install/dir
Cloning Erlang/OTP r14b02 (/path/to/install/dir) to anotherhost (/path/to/install/dir) ...
On anotherhost, you can activate this installation running the following command:
. /path/to/install/dir/activate

 

Later on, you can leave the installation typing:
kerl_deactivate

As an experimental feature, you can build Erlang directly from a git repository with a command of the form “kerl build git ” where can be either a branch, a tag or a commit id as it will be passed to “git checkout”:

$ kerl build git https://github.com/erlang/otp.git dev r14b02_dev
Checking Erlang/OTP git repositoy from https://github.com/erlang/otp.git...
Building Erlang/OTP r14b02_dev from git, please wait...
Erlang/OTP r14b02_dev from git has been successfully built

 

Issues

 

If kerl can’t build release of Erlang on your environment:

Verifying archive checksum...
Checksum verified (c330150913556a0fe73e57a441cb6375)
Building Erlang/OTP R16B03 (R16B03), please wait...
Build failed, see /Users/coolchevy/.kerl/builds/R16B03/otp_build_R16B03.log

 

You can see details in log file:

gmake[4]: Entering directory `/Users/coolchevy/.kerl/builds/R15B03/otp_src_R15B03/lib/odbc/c_src'
gcc  -g -O2  -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_NETDB_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRUCT_SOCKADDR_IN6_SIN6_ADDR=1 -DHAVE_MEMSET=1 -DHAVE_SOCKET=1 -DHAVE_PTHREAD_H=1  -I. -I/usr/lib/include -I/Users/coolchevy/.kerl/builds/R15B03/otp_src_R15B03/lib/erl_interface/include -DUNIX -o ../priv/obj/i386-apple-darwin13.1.0/odbcserver.o -c odbcserver.c
odbcserver.c:117:10: fatal error: 'sql.h' file not found
#include "sql.h"
         ^
1 error generated.
gmake[4]: *** [../priv/obj/i386-apple-darwin13.1.0/odbcserver.o] Error 1

 

Or like this:

beam/erl_bif_re.c:1060:15: error: use of undeclared identifier 'PCRE_ERROR_LOOP_LIMIT'
    if (rc == PCRE_ERROR_LOOP_LIMIT) {
              ^
beam/erl_bif_re.c:1115:21: error: no member named 'loop_limit' in 'struct pcre_extra'
    restartp->extra.loop_limit = ERTS_BIF_REDS_LEFT(BIF_P) * LOOP_FACTOR;
    ~~~~~~~~~~~~~~~ ^
beam/erl_bif_re.c:1118:25: error: no member named 'loop_limit' in 'struct pcre_extra'
    if (restartp->extra.loop_limit > loop_limit_tmp) {
        ~~~~~~~~~~~~~~~ ^
beam/erl_bif_re.c:1119:18: error: no member named 'loop_limit' in 'struct pcre_extra'
        restartp->extra.loop_limit = loop_limit_tmp;
        ~~~~~~~~~~~~~~~ ^
beam/erl_bif_re.c:1121:21: error: no member named 'loop_counter_return' in 'struct pcre_extra'
    restartp->extra.loop_counter_return = &loop_count;
    ~~~~~~~~~~~~~~~ ^
beam/erl_bif_re.c:1122:21: error: no member named 'restart_data' in 'struct pcre_extra'
    restartp->extra.restart_data = &restartp->restart_data;
    ~~~~~~~~~~~~~~~ ^
beam/erl_bif_re.c:1123:21: error: no member named 'restart_flags' in 'struct pcre_extra'
    restartp->extra.restart_flags = 0;
    ~~~~~~~~~~~~~~~ ^
beam/erl_bif_re.c:1131:15: error: use of undeclared identifier 'PCRE_ERROR_LOOP_LIMIT'
    if (rc == PCRE_ERROR_LOOP_LIMIT) {
              ^
9 warnings and 19 errors generated.
i386-apple-darwin13.1.0/Makefile:623: recipe for target 'obj/i386-apple-darwin13.1.0/opt/smp/erl_bif_re.o' failed
gmake[3]: *** [obj/i386-apple-darwin13.1.0/opt/smp/erl_bif_re.o] Error 1
gmake[3]: Leaving directory '/Users/coolchevy/.kerl/builds/R14B04/otp_src_R14B04/erts/emulator'

 

To resolve this issue you need set correct headers include path for your environment or install missing headers in your OS. For MacOS X solution is:

CFLAGS="-I/Developer/SDKs/MacOSX10.6.sdk/usr/include/"  ./kerl build R15B03 R15B03



coded by nessus