Tuesday Jul 22, 2008

Compiling Subversion in coolstack 1.3

First set the PATH. Add the Studio 12 compiler into the PATH.
# PATH=/usr/sbin:/usr/bin/:/usr/ccs/bin:/opt/SUNWspro/bin/
In my test machine Studio 12 was installed in /opt/SUNWspro/bin. Now configure and compile neon and subversion.

Compile neon 0.28.2
# CFLAGS="-I/opt/coolstack/include" LDFLAGS="-L/opt/coolstack/lib" \\
        PATH=/opt/coolstack/bin:$PATH ./configure --prefix=/opt/coolstack \\
        --with-libxml2=/opt/coolstack --with-ssl=openssl
# /usr/sfw/bin/gmake
# /usr/sfw/bin/gmake install
Compile subversion 1.5.0
# CFLAGS="-I/opt/coolstack/include" LIBS="-lintl -lgettextlib" \\
          LD_LIBRARY_PATH=/opt/coolstack/lib LDFLAGS="-L/opt/coolstack/lib -R/opt/coolstack/lib" \\
          ./configure --prefix=/opt/coolstack --with-apxs=/opt/coolstack/apache2/bin/apxs \\
                      --with-apr=/opt/coolstack/apache2 --with-apr-util=/opt/coolstack/apache2 \\
# /usr/sfw/bin/gmake
# /usr/sfw/bin/gmake install
Note that gettextlib and intl libraries are required to compile subversion. These libraries are present in /opt/coolstack/lib directory. These libraries are packaged in CSKlibs package.

Linking improvements in Cool Stack 1.3

linkingimprovements CoolStack 1.3 has improved linking of various components. To make recent versions of apache, php and other web stack components, coolstack needs lots of base libraries. Some of these libraries are installed in /usr/lib and some are installed in /usr/sfw/lib. Here are the requirements for coolstack :
  • Need to bundle higher version of library than is available in S10. Example is libxml2. php 5 doesn't compile with libxml2 shipped with S10.
  •  Use as many as /usr/lib and /usr/sfw/lib libraries to avoid huge download size of packages.
  • When a library is present at two location, set the RPATH/RUNPATH in libraries correctly so that application will look in /opt/coolstack/lib directory first and then it will look into /usr/sfw/lib directory.

Duplicated libraries caused lots of trouble in coolstack. Here are few issues which we encountered in Cool Stack 1.2.
  1.  CoolStack 1.2 bundled libxml2 but didn't bundle libxslt. libxslt needs libxml2.  Let us run the ldd on php extension xsl.so. I have edited the output to make it brief :
    bash-3.00# ldd /opt/coolstack/php5/lib/php/extensions/no-debug-non-zts-20060613/xsl.so
    libreadline.so.5 => /opt/coolstack/lib/libreadline.so.5
    libcurses.so.1 => /lib/libcurses.so.1
    libexslt.so.0 => /usr/lib/libexslt.so.0
    libxslt.so.1 => /usr/lib/libxslt.so.1
    libxml2.so.2 => /opt/coolstack/lib/libxml2.so.2
    libxml2.so.2 => /usr/lib/libxml2.so.2
    Note that libxml2 is loaded twice. The reason is that when libxslt.so was loaded, it loaded libxml2.so from /usr/lib directory not from /opt/coolstack/lib directory. Reason is obvious /usr/lib/libxslt.so looks for a particular libxml2 (SUNW_1.6) and find it in /usr/lib directory. The result was obvious, xsl application failed to work with coolstack 1.2. Php crashed.

  2. CoolStack 1.2 bundled libfreetype but didn't bundle libfontconfig. Php's gd extension needs libgd.so. Here is the output (edited) of ldd on libgd.so.
    bash-3.00# ldd /opt/coolstack/lib/libgd.so
    libfontconfig.so.1 => /usr/lib/libfontconfig.so.1
    libfreetype.so.6 => /opt/coolstack/lib/libfreetype.so.6
    libpng12.so.0 => /usr/lib/libpng12.so.0
    libiconv.so.2 => /opt/coolstack/lib/libiconv.so.2
    libfreetype.so.6 => /usr/sfw/lib/libfreetype.so.6
    libexpat.so.0 => /usr/sfw/lib/libexpat.so.0
    Note that libfreetype.so is loaded twice. Once from /opt/coolstack/lib directory and once from /usr/sfw/lib directory. /usr/sfw/lib/libfreetype.so was loaded by /usr/lib/libfontconfig.so. If you look at the RPATH of libfontconfig, libfontconfig looks for libfreetype from /usr/sfw/lib directory.
    bash-3.00# dump -Lvp /usr/lib/libfontconfig.so.1 | grep PATH
    [9] RUNPATH /usr/sfw/lib
    [10] RPATH /usr/sfw/lib
    I don't know what was the effect of the above problem but I believe it would have caused problem in gd's functionality.
  3. libexpat.so is present in /usr/sfw/lib which can be accedently get preference over /opt/coolstack/apache2/lib/libexpat.so
  4. libmysqlclient.so is present in /usr/sfw/lib. Clients can accidently load /usr/sfw/lib version, instead of /opt/coolstack/mysql_32bit/lib/mysql/libmysqlclient.so
Linking improvements in Cool Stack 1.3
  • 1. libxslt is now bundled in CSKruntime package.
  • libfontconfig is now bundled in CSKlibs package.
  • To handle dependent libraries on /usr/sfw/lib CoolStack 1.3 now creates symlink in /opt/coolstack/lib directory. Similarily symlinks have been created to include header files from /usr/sfw/include.
  • To the best of it's effort, none of the libraries have /usr/sfw/lib in it's RPATH/RUNPATH.
  • Almost all of the places where /usr/sfw was passed in configure options, now /opt/coostack is passed as a configure option. E.g. --with-ssl=/usr/sfw is replaced with --with-ssl=/opt/coolstack
  • Any library which links with libmysqlclient, /opt/coolstack/mysql_32bit/lib/mysql is added into it's RPATH.
  • libtool files create problems in linking other components. Therefore libtool files (.la) are not bundled in coolstack 1.3.

Monday Jul 21, 2008

Custom SSL in CoolStack 1.3

Custom ssl in coolstack 1.3 In CoolStack 1.3, applications which needs ssl are linked against /opt/coolstack/lib/libssl.so and /opt/coolstack/lib/libcrypto.so. In previous versions of coolstack, applications were directly linked with /usr/sfw/lib. There are several applications which uses ssl e.g apache, mysql, ruby etc.

Solaris 10 has openssl 0.9.7 installed in /usr/sfw/lib directory. If you have higher versions of openssl than 0.9.7 then in coolstack 1.3, it is very easy to use custom ssl without any recomplication.

In CoolStack 1.3, /opt/coolstack/lib/libssl.so and libcrypto.so are just symlinks to ssl libraries in /usr/sfw/lib directory. Suppose your custom ssl is located in /opt/ssl/lib then to to use custom ssl in coolstack 1.3, you need to remove the old symlinks and create new symlinks to new location of openssl.
# cd /opt/coolstack/lib
# rm libssl.so
# rm libssl.so.0.9.7
# ln -s /opt/ssl/lib/libssl.so libssl.so
# ln -s /opt/ssl/lib/libssl.0.9.8.so libssl.so.0.9.7

# rm libcrypto.so
# rm libcrypto.so.0.9.7
# ln -s /opt/ssl/lib/libcypto.so libcrypto.so
# ln -s /opt/ssl/lib/libcrypto.so.0.9.8 libcrypto.so.0.9.7

Monday Apr 28, 2008

Compiling Subversion in coolstack 1.2

CompilingSubversion Subversion compilation with Cool Stack 1.2 is not very straightforward. It is
a bug in Cool Stack 1.2

Coolstack apache needs ssl from /usr/sfw directory so Coolstack apache is
compiled with LDFLAGS="-L/opt/coolstack/lib -L/usr/sfw/lib" configure option.

This results in problems in libapr-1.la in libapruutil-1.la files. So when we
configure/compile subversion libexpat.so is available at multiple places. This
seems to be bug in coolstack apache. Apache apr should avoid having
/usr/sfw/lib in their RPATH.

I found out the workaround for this solution.

# echo $PATH

Step 1 : Remove libapr-1.la and libaprutil-la from /opt/coolstack/apache2/lib directory

# cd /opt/coolstack/apache2/lib/
# mv libapr-1.la /tmp/
# mv libaprutil-1.la /tmp/

Step 2 : Compile neon-0.25.5.tar.gz

# /usr/sfw/bin/gtar -zxf neon-0.25.5.tar.gz
# cd neon-0.25.5
# CFLAGS="-I/opt/coolstack/include" LDFLAGS="-L/opt/coolstack/lib" ./configure --prefix=/opt/coolstack --with-libxml2=/opt/coolstack --with-ssl=openssl
# make
# make install

Step 3 : configure subversion

# rm -rf subversion-1.4.6
# /usr/sfw/bin/gtar -jxf subversion-1.4.6.tar.bz2
# cd subversion-1.4.6
# CFLAGS="-I/opt/coolstack/include" LDFLAGS="-L/opt/coolstack/lib" ./configure --prefix=/opt/coolstack --with-apxs=/opt/coolstack/apache2/bin/apxs --with-apr=/opt/coolstack/apache2 --with-apr-util=/opt/coolstack/apache2 --with-neon=/opt/coolstack

Step 4 : Change Makefile manually : Add -lgettextlib -lintl manually to SVN_APR_LIBS and SVN_APRUTIL_LIBS

SVN_APR_LIBS =  -L/opt/coolstack/apache2/lib -R/opt/coolstack/apache2/lib -lapr-1 -luuid -lsendfile -lrt -lsocket -lnsl  -lpthread -lgettextlib -lintl
SVN_APRUTIL_LIBS =  -L/opt/coolstack/apache2/lib -R/opt/coolstack/apache2/lib -laprutil-1 -lldap  -lexpat -liconv -lgettextlib -lintl

Step 5 : build and install subversion

# make
# LD_LIBRARY_PATH=/opt/coolstack/apache2/lib:/opt/coolstack/lib:/usr/sfw/lib make install

I tried to run with "svn help" and it worked. I didn't try to run any tests on
it. I hope it should work fine with coolstack apache.

Step 6 : Revert back libapr-1.la and libaprutil-1.la (Optional)

You can add appropriate CFLAGS for optimization.

Basant Kukreja


Top Tags
« July 2016