The following packages need to be installed before compiling erlang:
- gcc4core
- gcc4g++
- gmake
- unixodbc, unixodbc_dev
- libssl_dev
It's required to add "/opt/csw/bin" to the path of the environment.
It's highly recommended to install "libssl_dev" from OpenCSW before compiling erlang because otherwise the crypto module will not be build. See the additional configuration options required to make sure, that erlang is build with the installed SSL library.
Configure may complain about a missing "ar" tool. OpenCWS has probably installed GNU ar -- gar. It's possible to tell configure to use gar instead of ar by executing configure with the AR variable set.
AR=gar \
RANLIB=granlib \
DED_LD=ld \
DED_LDFLAGS="-64 -G -L/usr/lib/64 -L/usr/ucblib/sparcv9 -R/usr/ucblib/sparcv9" \
./configure --with-ssl=/opt/csw --disable-dynamic-ssl-lib \
--enable-m64-build --with-odbc=/opt/csw \
--without-wx
It's required to specify the CC and CXX environment variables when running gmake:
CC="gcc -m64" CXX="g++ -m64" gmake rel
But gmake will fail after a while. Next it's required to modify the patch named "js-src-config-SunOS5.10.mk.patch" and create a new patch named "js-src-config-SunOS5.5.mk.patch" in the directory "deps/erlang_js/c_src/patches/"
--- js-src-config-SunOS5.10.mk.patch.old Wed Sep 26 05:53:57 2012
+++ js-src-config-SunOS5.10.mk.patch Sat Nov 17 20:59:45 2012
@@ -5,15 +5,15 @@
OTHER_LIBS += -L/usr/sfw/lib/mozilla -R/usr/sfw/lib/mozilla
-CC=gcc
-+CC = gcc
-+LD = gcc
++CC = gcc -m64
++LD = gcc -m64
+MKSHLIB = $(LD) -shared
+OS_CFLAGS += -fPIC
+CFLAGS += -fPIC
+ifneq (86,$(findstring 86,$(OS_RELEASE)))
-+ASFLAGS += -xarch=v9 -DULTRA_SPARC
++ASFLAGS += -xarch=v9
+DEFINES += -DULTRA_SPARC
-+OS_CFLAGS += -Wa,-xarch=v9,-DULTRA_SPARC
++OS_CFLAGS += -Wa,-xarch=v9
+CFLAGS += -DULTRA_SPARC
+endif
--- c_src/js/src/config/SunOS5.5.mk.old Sat Nov 17 20:37:46 2012
+++ c_src/js/src/config/SunOS5.5.mk Sat Nov 17 20:38:22 2012
@@ -73,9 +73,9 @@
ifndef JS_NO_ULTRA # do we want ultra?
ifdef JS_THREADSAFE # only in thread-safe mode
DEFINES += -DULTRA_SPARC
-DEFINES += -Wa,-xarch=v8plus,-DULTRA_SPARC
+DEFINES += -Wa,-xarch=v9
else
-ASFLAGS += -xarch=v8plus -DULTRA_SPARC
+ASFLAGS += -xarch=v9
endif
endif
endif
The Makefile in "deps/erlang_js/c_src" needs to following change:
--- Makefile.old Sat Nov 17 21:39:06 2012
+++ Makefile Sat Nov 17 21:33:31 2012
@@ -47,7 +47,7 @@
done
(cd $(NSPR_DIR) && \
./configure --disable-debug --enable-optimize \
- --prefix=$(SYSTEM_DIR) $(NSPR_SIXTYFOUR) && \
+ --prefix=$(SYSTEM_DIR) --enable-64bit && \
$(MAKE) all install)
clean:
Remove already build libnspr4
rm deps/erlang\_js/c\_src/system/lib/libnspr4.*
--- c_src/build_deps.sh.old Sat Nov 17 21:45:57 2012
+++ c_src/build_deps.sh Sat Nov 17 21:46:06 2012
@@ -67,7 +67,7 @@
*)
if [ ! -d snappy-$SNAPPY_VSN ]; then
- tar -xzf snappy-$SNAPPY_VSN.tar.gz
+ gtar -xzf snappy-$SNAPPY_VSN.tar.gz
(cd snappy-$SNAPPY_VSN && ./configure --prefix=$BASEDIR/system --with-pic)
fi
Because in 1.7.0 sparcv9 is supported.
cd deps/eleveldb/c_src
rm -rf leveldb
wget http://leveldb.googlecode.com/files/leveldb-1.7.0.tar.gz
gtar xfvz leveldb-1.7.0.tar.gz
mv leveldb-1.7.0 leveldb
cd leveldb
Modifications for the file "build_detect_platform" ...
--- build_detect_platform.old Sat Nov 17 21:55:27 2012
+++ build_detect_platform Sat Nov 17 21:57:59 2012
@@ -41,7 +41,7 @@
fi
if test -z "$CXX"; then
CXX=g++
fi
# Detect OS
@@ -84,7 +84,7 @@
;;
SunOS)
PLATFORM=OS_SOLARIS
- COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_SOLARIS"
+ COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_SOLARIS -m64"
PLATFORM_LIBS="-lpthread -lrt"
PORT_FILE=port/port_posix.cc
;;
... and "Makefile"
--- Makefile.old Sat Nov 17 21:58:43 2012
+++ Makefile Sun Nov 18 00:13:55 2012
@@ -81,7 +81,7 @@
endif
$(SHARED3):
- $(CXX) $(LDFLAGS) $(PLATFORM_SHARED_LDFLAGS)$(SHARED2) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(SOURCES) -o $(SHARED3) $(LIBS)
+ $(CXX) $(LDFLAGS) -fPIC -shared $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(SOURCES) -o $(SHARED3) $(LIBS)
endif # PLATFORM_SHARED_EXT
@@ -192,8 +192,8 @@
else
.cc.o:
- $(CXX) $(CXXFLAGS) -c $< -o $@
+ $(CXX) -fPIC $(CXXFLAGS) -c $< -o $@
.c.o:
- $(CC) $(CFLAGS) -c $< -o $@
+ $(CC) -fPIC $(CFLAGS) -c $< -o $@
endif
After the modifications execute "gmake" in the "leveldb" directory. After leveldb is build, cd into "~/riak-1.x" and run the gmake to build riak again.
After riak is successful build, cd into ~/riak-.../rel/ and move the "riak" folder in