Here is some information on the build machine I'm using for reference:
-
Dataset
$ dsadm list UUID OS PUBLISHED URN 467ca742-4873-11e1-80ea-37290b38d2eb smartos 2012-02-14 sdc:sdc:smartos64:1.5.3
-
Global Zone version
[root@00-1b-21-a3-86-51 /tmp]# uname -a SunOS 00-1b-21-a3-86-51 5.11 joyent_20120223T221136Z i86pc i386 i86pc
-
Package Set (on SmartOS guest)
$ cat /opt/local/etc/pkgin/repositories.conf http://pkgsrc.joyent.com/sdc6/2011Q3/gcc46-64/All
-
GCC version
$ gcc --version gcc (GCC) 4.6.1
$ pkgin -y install gmake gcc-compiler binutils scmgit pkg_alternatives autoconf sun-jdk6-6.0.26
NOTE You can remove the sun-jdk6-6.0.26
if you aren't building riak_ee
Clone the OTP repo from Scott Fritchie's repo to get DTrace
$ git clone git://github.com/slfritchie/otp.git
$ cd otp
$ git checkout dtrace-r14b04
When I built it, the last commit was:
commit 6762a53e26db0dffbde542234fd3d18ebe337f58
Author: Scott Lystig Fritchie <[email protected]>
Date: Sat Feb 11 22:44:11 2012 -0600
Fix type error in dtrace:user_trace_i4s4()
Generate the configure script and configure
$ env ERL_TOP=`pwd` ./otp_build autoconf
There are two patches that are needed to make things behave on SmartOS.
The first one applies to Makefile.in files and makes adjustments to the OMIT_OMIT_FP flags:
--- erts/emulator/Makefile.in.orig 2011-10-03 13:12:07.000000000 -0500
+++ erts/emulator/Makefile.in 2012-04-25 12:28:07.000000000 -0500
@@ -207,7 +207,7 @@
LIB_SUFFIX=.a
endif
-OMIT_OMIT_FP=no
+OMIT_OMIT_FP=yes
ifeq (@EMU_LOCK_CHECKING@,yes)
NO_INLINE_FUNCTIONS=true
--- erts/lib_src/Makefile.in.orig 2011-10-03 13:12:07.000000000 -0500
+++ erts/lib_src/Makefile.in 2012-04-25 12:28:13.000000000 -0500
@@ -20,7 +20,7 @@
include $(ERL_TOP)/make/target.mk
include ../include/internal/$(TARGET)/ethread.mk
-OMIT_OMIT_FP=no
+OMIT_OMIT_FP=yes
CC=@CC@
Assuming you call this makefile.patch
you can apply it like
$ patch -p0 < makefile.patch
Erlang's configure doesn't pick up on SmartOS being a Sun kernel in all the places it needs to, so this patch fixes inet_drv.c
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index 43114c6..dd45cae 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -4166,7 +4166,7 @@ static int inet_ctl_ifget(inet_descriptor* desc, char* buf, int len,
break;
case INET_IFOPT_HWADDR: {
-#ifdef SIOCGIFHWADDR
+#if defined(SIOCGIFHWADDR) && !defined(sun)
if (ioctl(desc->s, SIOCGIFHWADDR, (char *)&ifreq) < 0)
break;
buf_check(sptr, s_end, 1+2+IFHWADDRLEN);
Assuming you called the file inet_drv.patch
you can just
$ patch -p0 < inet_drv.patch
Finally we can start building.
Configure:
$ env ERL_TOP=`pwd` ./configure --enable-dtrace + EVERYTHING YOU NEED
This is what I did exactly:
$ ./configure --prefix=/usr/local/erlang-r14b04-dtrace-64 --enable-dtrace --enable-m64-build
Make:
$ make
$ sudo make install
I know, droppin' knowledge on that last one!
If you applied the patches correctly you should see something like this fly by on make
:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * *
* * NOTE: Omit frame pointer optimization has been omitted * *
* * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
If not, you did something wrong!
This is what I have after I install using the above instructions:
$ erl
Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8] [async-threads:0] [hipe] [kernel-poll:false] [dtrace]
Make sure that "[dtrace]" is listed before moving on!
$ wget http://www.erlang.org/download/otp_src_R15B01.tar.gz
Unlike R14B04, this one works out of the box
$ ./configure --prefix=/usr/local/erlang-r15b01-dtrace-64 --with-dynamic-trace=dtrace --enable-m64-build
$ make
$ sudo make install
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false] [dtrace]
Eshell V5.9.1 (abort with ^G)
1> dyntrace:available().
true
2>
Done.
This works out of box, just do the typical make commands.
In progress...