1Building and Installing Erlang/OTP 2================================== 3 4Introduction 5------------ 6 7This document describes how to build and install Erlang/OTP-%OTP-REL%. 8Erlang/OTP should be possible to build from source on any Unix/Linux system, 9including OS X. You are advised to read the whole document 10before attempting to build and install Erlang/OTP. 11 12The source code can be downloaded from the official site of Erlang/OTP or GitHub. 13* <http://www.erlang.org> 14* <https://github.com/erlang/otp> 15 16Required Utilities 17------------------ 18 19These are the tools you need in order to unpack and build Erlang/OTP. 20 21### Unpacking ### 22 23* GNU unzip, or a modern uncompress. 24* A TAR program that understands the GNU TAR format for long filenames. 25 26### Building ### 27 28* GNU `make` 29* Compiler -- GNU C Compiler, `gcc` or the C compiler frontend for LLVM, `clang`. 30* Perl 5 31* GNU `m4` -- If HiPE (native code) support is enabled. HiPE can be 32 disabled using `--disable-hipe` 33* `ncurses`, `termcap`, or `termlib` -- The development headers and 34 libraries are needed, often known as `ncurses-devel`. Use 35 `--without-termcap` to build without any of these libraries. Note that 36 in this case only the old shell (without any line editing) can be used. 37* `sed` -- Stream Editor for basic text transformation. 38 39#### Building in Git #### 40 41Build the same way as when building the unpacked tar file. 42 43#### Building on OS X #### 44 45* Xcode -- Download and install via the Mac App Store. 46 Read about [Building on a Mac][] before proceeding. 47 48### Installing ### 49 50* An `install` program that can take multiple file names. 51 52 53Optional Utilities 54------------------ 55 56Some applications are automatically skipped if the dependencies aren't met. 57Here is a list of utilities needed for those applications. You will 58also find the utilities needed for building the documentation. 59 60### Building ### 61 62* OpenSSL -- The opensource toolkit for Secure Socket Layer 63 and Transport Layer Security. 64 Required for building the application `crypto`. 65 Further, `ssl` and `ssh` require a working crypto application and 66 will also be skipped if OpenSSL is missing. The `public_key` 67 application is available without `crypto`, but the functionality 68 will be very limited. 69 70 The development package of OpenSSL including the header files are needed as well 71 as the binary command program `openssl`. At least version 0.9.8 of OpenSSL is required. 72 Read more and download from <http://www.openssl.org>. 73* Oracle Java SE JDK -- The Java Development Kit (Standard Edition). 74 Required for building the application `jinterface`. 75 At least version 1.6.0 of the JDK is required. 76 77 Download from <http://www.oracle.com/technetwork/java/javase/downloads>. 78 We have also tested with IBM's JDK 1.6.0. 79* `flex` -- Headers and libraries are needed to build the flex 80 scanner for the `megaco` application on Unix/Linux. 81* wxWidgets -- Toolkit for GUI applications. 82 Required for building the `wx` application. At least 83 version 3.0 of wxWidgets is required. 84 85 Download from <http://sourceforge.net/projects/wxwindows/files/3.0.0/> 86 or get it from GitHub: <https://github.com/wxWidgets/wxWidgets> 87 88 Further instructions on wxWidgets, read [Building with wxErlang][]. 89 90 91 92### Building Documentation ### 93 94* `xsltproc` -- A command line XSLT processor. 95 96 A tool for applying XSLT stylesheets 97 to XML documents. Download xsltproc from 98 <http://xmlsoft.org/XSLT/xsltproc2.html>. 99 100* `fop` -- Apache FOP print formatter (requires Java). Can be downloaded 101 from <http://xmlgraphics.apache.org/fop>. 102 103 104 105How to Build and Install Erlang/OTP 106----------------------------------- 107 108The following instructions are for building [the released source tar ball][]. 109 110The variable `$ERL_TOP` will be mentioned a lot of times. It refers to 111the top directory in the source tree. More information about `$ERL_TOP` 112can be found in the [make and $ERL_TOP][] section below. 113 114### Unpacking ### 115 116Start by unpacking the Erlang/OTP distribution file with your GNU 117compatible TAR program. 118 119 $ tar -zxf otp_src_%OTP-VSN%.tar.gz # Assuming bash/sh 120 121Now change directory into the base directory and set the `$ERL_TOP` variable. 122 123 $ cd otp_src_%OTP-VSN% 124 $ export ERL_TOP=`pwd` # Assuming bash/sh 125 126### Configuring ### 127 128Run the following commands to configure the build: 129 130 $ ./configure [ options ] 131 132By default, Erlang/OTP release will be installed in `/usr/local/{bin,lib/erlang}`. 133If you for instance don't have the permission to install in the standard location, 134 you can install Erlang/OTP somewhere else. For example, to install in 135`/opt/erlang/%OTP-VSN%/{bin,lib/erlang}`, use the `--prefix=/opt/erlang/%OTP-VSN%` option. 136 137On some platforms Perl may behave strangely if certain locales are 138set. If you get errors when building, try setting the LANG variable: 139 140 $ export LANG=C # Assuming bash/sh 141 142 143### Building ### 144 145Build the Erlang/OTP release. 146 147 $ make 148 149 150### Testing ### 151 152Before installation you should test whether your build is working properly 153by running our smoke test. The smoke test is a subset of the complete Erlang/OTP test suites. 154First you will need to build and release the test suites. 155 156 $ make release_tests 157 158This creates an additional folder in `$ERL_TOP/release` called `tests`. 159Now, it's time to start the smoke test. 160 161 $ cd release/tests/test_server 162 $ $ERL_TOP/bin/erl -s ts install -s ts smoke_test batch -s init stop 163 164To verify that everything is ok you should open `$ERL_TOP/release/tests/test_server/index.html` 165in your web browser and make sure that there are zero failed test cases. 166 167> *NOTE*: On builds without `crypto`, `ssl` and `ssh` there is a failed test case 168> for undefined functions. Verify that the failed test case log only shows calls 169> to skipped applications. 170 171### Installing ### 172 173You are now ready to install the Erlang/OTP release! 174The following command will install the release on your system. 175 176 $ make install 177 178 179### Running ### 180 181You should now have a working release of Erlang/OTP! 182Jump to [System Principles][] for instructions on running Erlang/OTP. 183 184 185### How to Build the Documentation ### 186 187Make sure you're in the top directory in the source tree. 188 189 $ cd $ERL_TOP 190 191If you have just built Erlang/OTP in the current source tree, you have 192already ran `configure` and do not need to do this again; otherwise, run 193`configure`. 194 195 $ ./configure [Configure Args] 196 197When building the documentation you need a full Erlang/OTP-%OTP-VSN% system in 198the `$PATH`. 199 200 $ export PATH=$ERL_TOP/bin:$PATH # Assuming bash/sh 201 202For the FOP print formatter, two steps must be taken: 203 204* Adding the location of your installation of `fop` in `$FOP_HOME`. 205 206 $ export FOP_HOME=/path/to/fop/dir # Assuming bash/sh 207 208* Adding the `fop` script (in `$FOP_HOME`) to your `$PATH`, either by adding `$FOP_HOME` to `$PATH`, or by copying the `fop` script to a directory already in your `$PATH`. 209 210Build the documentation. 211 212 $ make docs 213 214#### Build Issues #### 215 216We have sometimes experienced problems with Oracle's `java` running out of 217memory when running `fop`. Increasing the amount of memory available 218as follows has in our case solved the problem. 219 220 $ export FOP_OPTS="-Xmx<Installed amount of RAM in MB>m" 221 222More information can be found at 223* <http://xmlgraphics.apache.org/fop/0.95/running.html#memory>. 224 225 226### How to Install the Documentation ### 227 228The documentation can be installed either using the `install-docs` target, 229or using the `release_docs` target. 230 231* If you have installed Erlang/OTP using the `install` target, install 232 the documentation using the `install-docs` target. Install locations 233 determined by `configure` will be used. `$DESTDIR` can be used the 234 same way as when doing `make install`. 235 236 $ make install-docs 237 238* If you have installed Erlang/OTP using the `release` target, install 239 the documentation using the `release_docs` target. You typically want 240 to use the same `RELEASE_ROOT` as when invoking `make release`. 241 242 $ make release_docs RELEASE_ROOT=<release dir> 243 244 245### Accessing the Documentation ### 246 247After installation you can access the documentation by 248 249* Reading man pages. Make sure that `erl` is referring to the 250 installed version. For example `/usr/local/bin/erl`. 251 Try viewing at the man page for Mnesia 252 253 $ erl -man mnesia 254 255* Browsing the html pages by loading the page `/usr/local/lib/erlang/doc/erlang/index.html` 256 or `<BaseDir>/lib/erlang/doc/erlang/index.html` if the prefix option has been used. 257 258 259### How to Install the Pre-formatted Documentation ### 260 261Pre-formatted [html documentation][] and [man pages][] can be downloaded from 262* <http://www.erlang.org/download.html>. 263 264Extract the html archive in the installation directory. 265 266 $ cd <ReleaseDir> 267 $ tar -zxf otp_html_%OTP-VSN%.tar.gz 268 269For `erl -man <page>` to work the Unix manual pages have to be 270installed in the same way, i.e. 271 272 $ cd <ReleaseDir> 273 $ tar -zxf otp_man_%OTP-VSN%.tar.gz 274 275Where `<ReleaseDir>` is 276 277* `<PrefixDir>/lib/erlang` if you have installed Erlang/OTP using 278 `make install`. 279* `$DESTDIR<PrefixDir>/lib/erlang` if you have installed Erlang/OTP 280 using `make install DESTDIR=<TmpInstallDir>`. 281* `RELEASE_ROOT` if you have installed using 282 `make release RELEASE_ROOT=<ReleaseDir>`. 283 284 285Advanced configuration and build of Erlang/OTP 286---------------------------------------------- 287 288If you want to tailor your Erlang/OTP build and installation, please read 289on for detailed information about the individual steps. 290 291### make and $ERL\_TOP ### 292 293All the makefiles in the entire directory tree use the environment 294variable `ERL_TOP` to find the absolute path of the installation. The 295`configure` script will figure this out and set it in the top level 296Makefile (which, when building, it will pass on). However, when 297developing it is sometimes convenient to be able to run make in a 298subdirectory. To do this you must set the `ERL_TOP` variable 299before you run make. 300 301For example, assume your GNU make program is called `make` and you 302want to rebuild the application `STDLIB`, then you could do: 303 304 $ cd lib/stdlib; env ERL_TOP=<Dir> make 305 306where `<Dir>` would be what you find `ERL_TOP` is set to in the top level 307Makefile. 308 309### otp\_build vs configure/make ### 310 311Building Erlang/OTP can be done either by using the `$ERL_TOP/otp_build` 312script, or by invoking `$ERL_TOP/configure` and `make` directly. Building using 313`otp_build` is easier since it involves fewer steps, but the `otp_build` build 314procedure is not as flexible as the `configure`/`make` build procedure. The binary 315releases for Windows that we deliver are built using `otp_build`. 316 317### Configuring ### 318 319The configure script is created by the GNU autoconf utility, which 320checks for system specific features and then creates a number of makefiles. 321 322The configure script allows you to customize a number of parameters; 323type `./configure --help` or `./configure --help=recursive` for details. 324`./configure --help=recursive` will give help for all `configure` scripts in 325all applications. 326 327One of the things you can specify is where Erlang/OTP should be installed. By 328default Erlang/OTP will be installed in `/usr/local/{bin,lib/erlang}`. 329To keep the same structure but install in a different place, `<Dir>` say, 330use the `--prefix` argument like this: `./configure --prefix=<Dir>`. 331 332Some of the available `configure` options are: 333 334* `--prefix=PATH` - Specify installation prefix. 335* `--disable-parallel-configure` - Disable parallel execution of 336 `configure` scripts (parallel execution is enabled by default) 337* `--{enable,disable}-kernel-poll` - Kernel poll support (enabled by 338 default if possible) 339* `--{enable,disable}-hipe` - HiPE support (enabled by default on supported 340 platforms) 341* `--{enable,disable}-fp-exceptions` - Floating point exceptions (an 342 optimization for floating point operations). The default differs 343 depending on operating system and hardware platform. Note that by 344 enabling this you might get a seemingly working system that sometimes 345 fail on floating point operations. 346* `--enable-m64-build` - Build 64-bit binaries using the `-m64` flag to 347 `(g)cc` 348* `--enable-m32-build` - Build 32-bit binaries using the `-m32` flag to 349 `(g)cc` 350* `--with-assumed-cache-line-size=SIZE` - Set assumed cache-line size in 351 bytes. Default is 64. Valid values are powers of two between and 352 including 16 and 8192. The runtime system use this value in order to 353 try to avoid false sharing. A too large value wastes memory. A to 354 small value will increase the amount of false sharing. 355* `--{with,without}-termcap` - termcap (without implies that only the old 356 Erlang shell can be used) 357* `--with-javac=JAVAC` - Specify Java compiler to use 358* `--{with,without}-javac` - Java compiler (without implies that the 359 `jinterface` application won't be built) 360* `--{enable,disable}-dynamic-ssl-lib` - Dynamic OpenSSL libraries 361* `--{enable,disable}-builtin-zlib` - Use the built-in source for zlib. 362* `--{with,without}-ssl` - OpenSSL (without implies that the `crypto`, 363 `ssh`, and `ssl` won't be built) 364* `--with-ssl=PATH` - Specify location of OpenSSL include and lib 365* `--with-ssl-incl=PATH` - Location of OpenSSL `include` directory, 366 if different than specified by `--with-ssl=PATH` 367* `--with-ssl-rpath=yes|no|PATHS` - Runtime library path for OpenSSL. 368 Default is `yes`, which equates to a number of standard locations. If 369 `no`, then no runtime library paths will be used. Anything else should be 370 a comma separated list of paths. 371* `--with-libatomic_ops=PATH` - Use the `libatomic_ops` library for atomic 372 memory accesses. If `configure` should inform you about no native atomic 373 implementation available, you typically want to try using the 374 `libatomic_ops` library. It can be downloaded from 375 <https://github.com/ivmai/libatomic_ops/>. 376* `--disable-smp-require-native-atomics` - By default `configure` will 377 fail if an SMP runtime system is about to be built, and no implementation 378 for native atomic memory accesses can be found. If this happens, you are 379 encouraged to find a native atomic implementation that can be used, e.g., 380 using `libatomic_ops`, but by passing `--disable-smp-require-native-atomics` 381 you can build using a fallback implementation based on mutexes or spinlocks. 382 Performance of the SMP runtime system will however suffer immensely without 383 an implementation for native atomic memory accesses. 384* `--enable-static-{nifs,drivers}` - To allow usage of nifs and drivers on OSs 385 that do not support dynamic linking of libraries it is possible to statically 386 link nifs and drivers with the main Erlang VM binary. This is done by passing 387 a comma separated list to the archives that you want to statically link. e.g. 388 `--enable-static-nifs=/home/$USER/my_nif.a`. The path has to be absolute and the 389 name of the archive has to be the same as the module, i.e. `my_nif` in the 390 example above. This is also true for drivers, but then it is the driver name 391 that has to be the same as the filename. You also have to define 392 `STATIC_ERLANG_{NIF,DRIVER}` when compiling the .o files for the nif/driver. 393 If your nif/driver depends on some other dynamic library, you now have to link 394 that to the Erlang VM binary. This is easily achieved by passing `LIBS=-llibname` 395 to configure. 396* `--without-$app` - By default all applications in Erlang/OTP will be included 397 in a release. If this is not wanted it is possible to specify that Erlang/OTP 398 should be compiled without one or more applications, i.e. `--without-wx`. There is 399 no automatic dependency handling between applications. If you disable 400 an application that another application depends on, you also have to disable the 401 dependant application. 402* `--enable-gettimeofday-as-os-system-time` - Force usage of `gettimeofday()` for 403 OS system time. 404* `--enable-prefer-elapsed-monotonic-time-during-suspend` - Prefer an OS monotonic 405 time source with elapsed time during suspend. 406* `--disable-prefer-elapsed-monotonic-time-during-suspend` - Do not prefer an OS 407 monotonic time source with elapsed time during suspend. 408* `--with-clock-resolution=high|low` - Try to find clock sources for OS system 409 time, and OS monotonic time with higher or lower resolution than chosen by 410 default. Note that both alternatives may have a negative impact on the performance 411 and scalability compared to the default clock sources chosen. 412* `--disable-saved-compile-time` - Disable saving of compile date and time 413 in the emulator binary. 414 415If you or your system has special requirements please read the `Makefile` for 416additional configuration information. 417 418#### Updating configure scripts #### 419 420Generated `configure` scripts are nowadays included in the git repository. 421 422If you modify any `configure.in` files or the `erts/aclocal.m4` file, you need 423to regenerate `configure` scripts before the changes will take effect. First 424ensure that you have GNU `autoconf` of version 2.69 in your path. Then execute 425`./otp_build update_configure [--no-commit]` in the `$ERL_TOP` directory. The 426`otp_build` script will verify that `autoconf` is of correct version and will 427refuse to update the `configure` scripts if it is of any other version. 428 429#### Atomic Memory Operations and the VM #### 430 431The VM with SMP support makes quite a heavy use of atomic memory operations. 432An implementation providing native atomic memory operations is therefore very 433important when building Erlang/OTP. By default the VM will refuse to build 434if native atomic memory operations are not available. 435 436Erlang/OTP itself provides implementations of native atomic memory operations 437that can be used when compiling with a `gcc` compatible compiler for 32/64-bit 438x86, 32/64-bit SPARC V9, 32-bit PowerPC, or 32-bit Tile. When compiling with 439a `gcc` compatible compiler for other architectures, the VM may be able to make 440use of native atomic operations using the `__atomic_*` builtins (may be 441available when using a `gcc` of at least version 4.7) and/or using the 442`__sync_*` builtins (may be available when using a `gcc` of at least version 4434.1). If only the `gcc`'s `__sync_*` builtins are available, the performance 444will suffer. Such a configuration should only be used as a last resort. When 445compiling on Windows using a MicroSoft Visual C++ compiler native atomic 446memory operations are provided by Windows APIs. 447 448Native atomic implementation in the order preferred: 4491. The implementation provided by Erlang/OTP. 4502. The API provided by Windows. 4513. The implementation based on the `gcc` `__atomic_*` builtins. 4524. If none of the above are available for your architecture/compiler, you 453 are recommended to build and install [libatomic_ops][] before building 454 Erlang/OTP. The `libatomic_ops` library provides native atomic memory 455 operations for a variety of architectures and compilers. When building 456 Erlang/OTP you need to inform the build system of where the 457 `libatomic_ops` library is installed using the 458 `--with-libatomic_ops=PATH` `configure` switch. 4595. As a last resort, the implementation solely based on the `gcc` 460 `__sync_*` builtins. This will however cause lots of expensive and 461 unnecessary memory barrier instructions to be issued. That is, 462 performance will suffer. The `configure` script will warn at the end 463 of its execution if it cannot find any other alternative than this. 464 465### Building ### 466 467Building Erlang/OTP on a relatively fast computer takes approximately 4685 minutes. To speed it up, you can utilize parallel make with the `-j<num_jobs>` option. 469 470 $ export MAKEFLAGS=-j8 # Assuming bash/sh 471 $ make 472 473If you've upgraded the source with a patch you may need to clean up from previous 474builds before the new build. 475Make sure to read the [Pre-built Source Release][] section below before doing a `make clean`. 476 477Other useful information can be found at our GitHub wiki: 478* <http://wiki.github.com/erlang/otp> 479 480#### Within Git #### 481 482Build the same way as when building the unpacked tar file. 483 484#### OS X (Darwin) #### 485 486Make sure that the command `hostname` returns a valid fully qualified host 487name (this is configured in `/etc/hostconfig`). Otherwise you might experience 488problems when running distributed systems. 489 490If you develop linked-in drivers (shared library) you need to link using 491`gcc` and the flags `-bundle -flat_namespace -undefined suppress`. You also 492include `-fno-common` in `CFLAGS` when compiling. Use `.so` as the library 493suffix. 494 495If you have Xcode 4.3, or later, you will also need to download 496"Command Line Tools" via the Downloads preference pane in Xcode. 497 498#### Building with wxErlang #### 499 500If you want to build the `wx` application, you will need to get wxWidgets-3.0 501(`wxWidgets-3.0.3.tar.bz2` from <https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.3/wxWidgets-3.0.3.tar.bz2>) or get it from github with bug fixes: 502 503 $ git clone --branch WX_3_0_BRANCH git@github.com:wxWidgets/wxWidgets.git 504 505The wxWidgets-3.1 version should also work if 2.8 compatibility is enabled, 506add `--enable-compat28` to configure commands below. 507 508Configure and build wxWidgets (shared library on linux): 509 510 $ ./configure --prefix=/usr/local 511 $ make && sudo make install 512 $ export PATH=/usr/local/bin:$PATH 513 514Configure and build wxWidgets (static library on linux): 515 516 $ export CFLAGS=-fPIC 517 $ export CXXFLAGS=-fPIC 518 $ ./configure --prefix=/usr/local --disable-shared 519 $ make && sudo make install 520 $ export PATH=/usr/local/bin:$PATH 521 522Configure and build wxWidgets (on Mavericks - 10.9): 523 524 $ ./configure --with-cocoa --prefix=/usr/local 525 or without support for old versions and with static libs 526 $ ./configure --with-cocoa --prefix=/usr/local --with-macosx-version-min=10.9 --disable-shared 527 $ make 528 $ sudo make install 529 $ export PATH=/usr/local/bin:$PATH 530 531Check that you got the correct wx-config 532 533 $ which wx-config && wx-config --version-full 534 535Build Erlang/OTP 536 537 $ export PATH=/usr/local/bin:$PATH 538 $ cd $ERL_TOP 539 $ ./configure 540 $ make 541 $ sudo make install 542 543 544#### Pre-built Source Release #### 545 546The source release is delivered with a lot of platform independent 547build results already pre-built. If you want to remove these pre-built 548files, invoke `./otp_build remove_prebuilt_files` from the `$ERL_TOP` 549directory. After you have done this, you can build exactly the same way 550as before, but the build process will take a much longer time. 551 552> *WARNING*: Doing `make clean` in an arbitrary directory of the source 553> tree, may remove files needed for bootstrapping the build. 554> 555> Doing `./otp_build save_bootstrap` from the `$ERL_TOP` directory before 556> doing `make clean` will ensure that it will be possible to build after 557> doing `make clean`. `./otp_build save_bootstrap` will be invoked 558> automatically when `make` is invoked from `$ERL_TOP` with either the 559> `clean` target, or the default target. It is also automatically invoked 560> if `./otp_build remove_prebuilt_files` is invoked. 561> 562> If you need to verify the bootstrap beam files match the provided 563> source files, use `./otp_build update_primary` to create a new commit that 564> contains differences, if any exist. 565 566#### How to Build a Debug Enabled Erlang RunTime System #### 567 568After completing all the normal building steps described above a debug 569enabled runtime system can be built. To do this you have to change 570directory to `$ERL_TOP/erts/emulator` and execute: 571 572 $ (cd $ERL_TOP/erts/emulator && make debug) 573 574This will produce a beam.smp.debug executable. The 575file are installed along side with the normal (opt) version `beam.smp`. 576 577To start the debug enabled runtime system execute: 578 579 $ $ERL_TOP/bin/cerl -debug 580 581The debug enabled runtime system features lock violation checking, 582assert checking and various sanity checks to help a developer ensure 583correctness. Some of these features can be enabled on a normal beam 584using appropriate configure options. 585 586There are other types of runtime systems that can be built as well 587using the similar steps just described. 588 589 $ (cd $ERL_TOP/erts/emulator && make $TYPE) 590 591where `$TYPE` is `opt`, `gcov`, `gprof`, `debug`, `valgrind`, or `lcnt`. 592These different beam types are useful for debugging and profiling 593purposes. 594 595 596### Installing ### 597 598* Staged install using [DESTDIR][]. You can perform the install 599 phase in a temporary directory and later move the installation into 600 its correct location by use of the `DESTDIR` variable: 601 602 $ make DESTDIR=<tmp install dir> install 603 604 The installation will be created in a location prefixed by `$DESTDIR`. 605 It can, however, not be run from there. It needs to be moved into the 606 correct location before it can be run. If `DESTDIR` have not been set 607 but `INSTALL_PREFIX` has been set, `DESTDIR` will be set to 608 `INSTALL_PREFIX`. Note that `INSTALL_PREFIX` in pre R13B04 was buggy 609 and behaved as `EXTRA_PREFIX` (see below). There are lots of areas of 610 use for an installation procedure using `DESTDIR`, e.g. when creating 611 a package, cross compiling, etc. Here is an example where the 612 installation should be located under `/opt/local`: 613 614 $ ./configure --prefix=/opt/local 615 $ make 616 $ make DESTDIR=/tmp/erlang-build install 617 $ cd /tmp/erlang-build/opt/local 618 $ # gnu-tar is used in this example 619 $ tar -zcf /home/me/my-erlang-build.tgz * 620 $ su - 621 Password: ***** 622 $ cd /opt/local 623 $ tar -zxf /home/me/my-erlang-build.tgz 624 625* Install using the `release` target. Instead of doing `make install` you 626 can create the installation in whatever directory you like using the 627 `release` target and run the `Install` script yourself. `RELEASE_ROOT` 628 is used for specifying the directory where the installation should be 629 created. This is what by default ends up under `/usr/local/lib/erlang` 630 if you do the install using `make install`. All installation paths 631 provided in the `configure` phase are ignored, as well as `DESTDIR`, 632 and `INSTALL_PREFIX`. If you want links from a specific `bin` directory 633 to the installation you have to set those up yourself. An example where 634 Erlang/OTP should be located at `/home/me/OTP`: 635 636 $ ./configure 637 $ make 638 $ make RELEASE_ROOT=/home/me/OTP release 639 $ cd /home/me/OTP 640 $ ./Install -minimal /home/me/OTP 641 $ mkdir -p /home/me/bin 642 $ cd /home/me/bin 643 $ ln -s /home/me/OTP/bin/erl erl 644 $ ln -s /home/me/OTP/bin/erlc erlc 645 $ ln -s /home/me/OTP/bin/escript escript 646 ... 647 648 The `Install` script should currently be invoked as follows in the 649 directory where it resides (the top directory): 650 651 $ ./Install [-cross] [-minimal|-sasl] <ERL_ROOT> 652 653 where: 654 655 * `-minimal` Creates an installation that starts up a minimal amount 656 of applications, i.e., only `kernel` and `stdlib` are started. The 657 minimal system is normally enough, and is what `make install` uses. 658 * `-sasl` Creates an installation that also starts up the `sasl` 659 application. 660 * `-cross` For cross compilation. Informs the install script that it 661 is run on the build machine. 662 * `<ERL_ROOT>` - The absolute path to the Erlang installation to use 663 at run time. This is often the same as the current working directory, 664 but does not have to be. It can follow any other path through the 665 file system to the same directory. 666 667 If neither `-minimal`, nor `-sasl` is passed as argument you will be 668 prompted. 669 670* Test install using `EXTRA_PREFIX`. The content of the `EXTRA_PREFIX` 671 variable will prefix all installation paths when doing `make install`. 672 Note that `EXTRA_PREFIX` is similar to `DESTDIR`, but it does *not* have 673 the same effect as `DESTDIR`. The installation can and have to be run 674 from the location specified by `EXTRA_PREFIX`. That is, it can be useful 675 if you want to try the system out, running test suites, etc, before doing 676 the real install without `EXTRA_PREFIX`. 677 678#### Symbolic Links in --bindir #### 679 680When doing `make install` and the default installation prefix is used, 681relative symbolic links will be created from `/usr/local/bin` to all public 682Erlang/OTP executables in `/usr/local/lib/erlang/bin`. The installation phase 683will try to create relative symbolic links as long as `--bindir` and the 684Erlang bin directory, located under `--libdir`, both have `--exec-prefix` as 685prefix. Where `--exec-prefix` defaults to `--prefix`. `--prefix`, 686`--exec-prefix`, `--bindir`, and `--libdir` are all arguments that can be 687passed to `configure`. One can force relative, or absolute links by passing 688`BINDIR_SYMLINKS=relative|absolute` as arguments to `make` during the install 689phase. Note that such a request might cause a failure if the request cannot 690be satisfied. 691 692 693### Running ### 694 695#### Using HiPE #### 696 697HiPE supports the following system configurations: 698 699* x86: All 32-bit and 64-bit mode processors should work. 700 701 * Linux: Fedora Core is supported. Both 32-bit and 64-bit modes are 702 supported. 703 704 NPTL glibc is strongly preferred, or a LinuxThreads 705 glibc configured for "floating stacks". Old non-floating 706 stacks glibcs have a fundamental problem that makes HiPE 707 support and threads support mutually exclusive. 708 709 * Solaris: Solaris 10 (32-bit and 64-bit) and 9 (32-bit) are supported. 710 The build requires a version of the GNU C compiler (gcc) 711 that has been configured to use the GNU assembler (gas). 712 Sun's x86 assembler is emphatically **not** supported. 713 714 * FreeBSD: FreeBSD 6.1 and 6.2 in 32-bit and 64-bit modes should work. 715 716 * OS X/Darwin: Darwin 9.8.0 in 32-bit mode should work. 717 718* PowerPC: All 32-bit 6xx/7xx(G3)/74xx(G4) processors should work. 32-bit 719 mode on 970 (G5) and POWER5 processors should work. 720 721 * Linux (Yellow Dog) and OS X 10.4 are supported. 722 723* SPARC: All UltraSPARC processors running 32-bit user code should work. 724 725 * Solaris 9 is supported. The build requires a `gcc` that has been 726 configured to use Sun's assembler and linker. Using the GNU assembler 727 but Sun's linker has been known to cause problems. 728 729 * Linux (Aurora) is supported. 730 731* ARM: ARMv5TE (i.e. XScale) processors should work. Both big-endian and 732 little-endian modes are supported. 733 734 * Linux is supported. 735 736HiPE is automatically enabled on the following systems: 737 738* x86 in 32-bit mode: Linux, Solaris, FreeBSD 739* x86 in 64-bit mode: Linux, Solaris, FreeBSD 740* PowerPC: Linux, Mac OSX 741* SPARC: Linux 742* ARM: Linux 743 744On other supported systems, see [Advanced Configure][] on how to enable HiPE. 745 746If you are running on a platform supporting HiPE and if you have not disabled 747HiPE, you can compile a module into native code like this from the Erlang 748shell: 749 750 1> c(Module, native). 751 752or 753 754 1> c(Module, [native|OtherOptions]). 755 756Using the erlc program, write like this 757 758 $ erlc +native Module.erl 759 760The native code will be placed into the beam file and automatically loaded 761when the beam file is loaded. 762 763To add hipe options, write like this from the Erlang shell: 764 765 1> c(Module, [native,{hipe,HipeOptions}|MoreOptions]). 766 767Use `hipe:help_options/0` to print out the available options. 768 769 1> hipe:help_options(). 770 771 772 773 774 [$ERL_TOP/HOWTO/INSTALL-CROSS.md]: INSTALL-CROSS.md 775 [$ERL_TOP/HOWTO/INSTALL-WIN32.md]: INSTALL-WIN32.md 776 [DESTDIR]: http://www.gnu.org/prep/standards/html_node/DESTDIR.html 777 [Building in Git]: #Advanced-configuration-and-build-of-ErlangOTP_Building_Within-Git 778 [Advanced Configure]: #Advanced-configuration-and-build-of-ErlangOTP_Configuring 779 [Pre-built Source Release]: #Advanced-configuration-and-build-of-ErlangOTP_Building_Prebuilt-Source-Release 780 [make and $ERL_TOP]: #Advanced-configuration-and-build-of-ErlangOTP_make-and-ERLTOP 781 [html documentation]: http://www.erlang.org/download/otp_doc_html_%OTP-VSN%.tar.gz 782 [man pages]: http://www.erlang.org/download/otp_doc_man_%OTP-VSN%.tar.gz 783 [the released source tar ball]: http://www.erlang.org/download/otp_src_%OTP-VSN%.tar.gz 784 [System Principles]: ../system_principles/system_principles 785 [native build]: #How-to-Build-and-Install-ErlangOTP 786 [cross build]: INSTALL-CROSS.md 787 [Required Utilities]: #Required-Utilities 788 [Optional Utilities]: #Optional-Utilities 789 [Building on a Mac]: #Advanced-configuration-and-build-of-ErlangOTP_Building_OS-X-Darwin 790 [Building with wxErlang]: #Advanced-configuration-and-build-of-ErlangOTP_Building_Building-with-wxErlang 791 [libatomic_ops]: https://github.com/ivmai/libatomic_ops/ 792