Archive for January, 2009
Compiling syslog-ng 3.0.1 on Solaris 10
This one was giving me an endless amount of pain, until I realised it was to do with the fact it was trying deperatly hard to compile against static versions of libraries that Solaris only provides dynamically (or something along those lines!).
The Glib Solaris 10 package is too old to be used so we’ll need to grab the latest version of glib and compile this up – it’s fairly easy. You’ll also need to grab and compile libevent (The one written by the author of syslog-ng, not the Linux kernel related dooderywhatsit). Then we can compile up syslog. It doesn’t like Sun Studio, and you’ll want to set –disable-static-linking.
export CFLAGS="-I/opt/local/include -I/usr/sfw/include -I/opt/sfw/include" export CPPFLAGS=$CFLAGS export LDFLAGS="-L/opt/local/lib -R/opt/local/lib -L/usr/sfw/lib -R/usr/sfw/lib -L/opt/sfw/lib -R/opt/sfw/lib" export CC=gcc export CXX=g++ ./configure --prefix=/opt/ec --enable-ssl --enable-pcre --disable-ipv6 --disable-static-linking --enable-dynamic-linking --disable-glibtest gmake gmake install
These things are harder than they should be.
3 comments January 30th, 2009
Solaris, Ruby and iconv.
Solaris 10 has a native C library version of iconv. Unfortunately it lacks various features people might want to use, such as transliteration. You can see an example of this here:
# ruby -e "require 'iconv'; p Iconv.iconv('ascii//ignore//translit', 'utf-8', 'Tést')"
-e:1:in `iconv': invalid encoding ("ascii//ignore//translit", "utf-8") (Iconv::InvalidEncoding)
from -e:1
Other people have commented on the problem, for example on this blog here. One suggestion is to install SUNWgnu-libiconv and utilise LD_PRELOAD. The SUNWgnu-libiconv package isn’t around on Solaris 10 (that I know of), so we need to compile up our own libiconv. And LD_PRELOAD is an inelegant, somewhat difficult to implement and potentially dangerous environment variable.
This sadly means we need to recompile things from source. But hey, it’s Solaris! I’m sure you’re used to this by now. So it’s time to get your recompiling hat on and build libiconv and Ruby. A fairly generic build would go something along these lines (feel free to alter all the “/opt/local” paths to suit your own requirements:
# mkdir -p /opt/src
# cd /opt/src
# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.12.tar.gz
# gtar -zxf libiconv-1.12.tar.gz
# cd libiconv-1.12
# ./configure --prefix=/opt/local
# gmake
# gmake install
# cd /opt/src
# cat <<EOF > /tmp/ruby.patch
--- ruby-1.8.6-p287.good/ext/iconv/extconf.rb Mon Feb 12 23:01:19 2007
+++ ruby-1.8.6-p287/ext/iconv/extconf.rb Thu Jan 29 19:07:45 2009
@@ -22,6 +22,7 @@
end
end
$defs.push('-DICONV_INPTR_CONST')
+ $DLDFLAGS += ' -L/opt/local/lib -R/opt/local/lib -liconv'
end
if conf
prefix = '$(srcdir)'
--- ruby-1.8.6-p287.good/ext/iconv/iconv.c Thu Jan 29 19:10:58 2009
+++ ruby-1.8.6-p287/ext/iconv/iconv.c Thu Jan 29 18:20:56 2009
@@ -16,7 +16,7 @@
#include "ruby.h"
#include <errno.h>
-#include <iconv.h>
+#include </opt/local/include/iconv.h>
#include <assert.h>
#include "st.h"
#include "intern.h"
EOF
# wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz
# gtar -zxf ruby-1.8.7-p72.tar.gz
# cd ruby-1.8.7-p72
# patch -p1
# export LDFLAGS="-L/usr/sfw/lib -R/usr/sfw/lib -L/opt/local/lib -R/opt/local/lib"
# export CFLAGS="-I/usr/sfw/include -I/opt/local/include"
# export CPPFLAGS=$CFLAGS
# ./configure --prefix=/opt/ruby
# gmake
# gmake install
The above patch basically overrides the iconv that’s used. If you’re feeling fruity, you could grab the source to Sun Web Stack and modify their Ruby, which includes DTrace patches.
1 comment January 30th, 2009
Enabling 64bit MySQL on Solaris Sun Web Stack 1.4
Sun Web Stack 1.4 includes both a 32bit and 64bit MySQL, with the standard bin/mysqld and bin/amd64/mysqld binaries.
By default, the SMF service sun-mysql50 runs in 32bit mode. To enable 64bit mode, simply:
# svccfg -s sun-mysql50:default svc:/application/database/sun-mysql50:default> listprop sun-mysql50 application sun-mysql50/action_authorization astring solaris.smf.manage.sun-mysql/default sun-mysql50/bin astring /opt/webstack/mysql/5.0/bin sun-mysql50/data astring /var/opt/webstack/mysql/5.0/data sun-mysql50/value_authorization astring solaris.smf.value.sun-mysql/default sun-mysql50/enable_64bit boolean true method_context framework method_context/group astring mysql method_context/limit_privileges astring :default method_context/privileges astring :default method_context/project astring :default method_context/resource_pool astring :default method_context/supp_groups astring :default method_context/use_profile boolean false method_context/user astring mysql method_context/working_directory astring /var/opt/webstack/mysql general framework general/enabled boolean true restarter framework NONPERSISTENT restarter/logfile astring /var/svc/log/application-database-sun-mysql50:default.log restarter/contract count 105 restarter/start_pid count 606 restarter/start_method_timestamp time 1233237617.117424000 restarter/start_method_waitstatus integer 0 restarter/auxiliary_state astring none restarter/next_state astring none restarter/state astring online restarter/state_timestamp time 1233237617.119195000 svc:/application/database/sun-mysql50:default> setprop sun-mysql50/enable_64bit=true svc:/application/database/sun-mysql50:default> exit # svcadm refresh sun-mysql50 # svcadm disable sun-mysql50 # svcadm enable sun-mysql50 # ps -ef | grep mysql mysql 649 490 0 14:00:06 ? 0:00 /bin/sh /opt/webstack/mysql/5.0/bin/64/mysqld_safe --user=mysql --datadir=/var/ mysql 747 649 0 14:00:06 ? 0:22 /opt/webstack/mysql/5.0/bin/64/mysqld --basedir=/opt/webstack/mysql/5.0 --datad
And as we can see from the process list, the 64 bit binary has been launched instead of the 32 bit one.
Add comment January 29th, 2009
Compiling Python 2.6 on Solaris 10
Sorry for not posting so much lately. Work has been busier than ever – it’s quite incredible. Just a quick post on compiling Python 2.6, which was giving me a few problems.
Dependencies
I’d recommend throwing on ncurses and readline from the Solaris 10 companion CD, the packages are SFWncur and SFWrline. The full dependency list is:
P SFWncur P SFWrline P SUNWbzip P SUNWcry P SUNWcsl P SUNWcslr P SUNWcsr P SUNWgccruntime P SUNWlibms P SUNWlibmsr P SUNWopenssl-libraries P SUNWzlib
Compiling
The _ctype module fails to compile with Sun Studio 12. Rather than fix this, I simply used gcc instead. Also Python seemed to be missing _ssl, so I popped in the appropriate library paths. Thus:
export "LDFLAGS=-L/opt/sfw/lib -R/opt/sfw/lib -L/usr/sfw/lib -R/usr/sfw/lib" export "CPPFLAGS=-I/usr/sfw/include -I/opt/sfw/include -I/opt/sfw/include/ncurses" export "CFLAGS=-I/opt/sfw/include" export "LIBS=-lncurses" export CC=gcc CXX=g++ ./configure --prefix=/opt/python26 --enable-shared --disable-ipv6 --with-threads --with-libs="-lncurses" --with-wctype-functions gmake gmake install
Not all the modules will compile, but the ones that were missing were not of importance (sqlite, bsdbd, etc).
1 comment January 27th, 2009
