How to build openlibraries for opensolaris

Platform

  • OpenSolaris
    • it's a bit tricky
    • some of the libraries we want to use can only be built with GNU tools
  • two versions of gcc installed!
    • one appears to be Sun's: gcc 3.4.3 in /usr/sfw/bin
    • the second is (apparently) Blastwave's in /opt/csw/gcc3/bin/
    • as olibs depends on some of the optional packages in /opt/csw we should use the same
      • libpng, libjpeg, etc.
      • this appears to be the wrong choice!
      • building with /opt/csw/ gcc produces libraries that appear to fail to load without any debug or error. *sigh*
  • many packages not installed
    • use pkg-get -a | less to list
    • use sudo pkg-get -i <packagename> to install
    • installed:
      • pkgconfig
        • required as e.g. libavformat will not be searched for without pkgconfig being present
        • ensure PKG_CONFIG=/opt/csw/bin/pkg-config is set
      • boost (broken)
      • ffmpeg (very old, see below)
      • lame (fails to work w/ ffmpeg)
  • to sync, you will need to set CVS_RSH=ssh
  • GNU tools are prefixed with 'g'
  • boost
    • modify user-config.jam to tell gcc to use a SUN style linker
      • using gcc : : : <linker-type>sun ;
    • modify the configure script to add --layout=system to BJAM_OPTIONS
  • ffmpeg
    • the pkg-get provided version is very out of date (late 2005)
    • building ffmpeg on OpenSolaris requires the following:
      • use gmake (--make=gmake)
      • ensure there is a local link to ggrep in the ffmpeg directory, and PATH is set:
        • ln -s /opt/csw/bin/ggrep grep
        • ln -s /opt/csw/bin/gstrip strip
        • ln -s /opt/csw/bin/ginstall install
        • export PATH=<path to symbolic links>:$PATH
      • add --disable-vhook
        • hack; works around a call to add -rdynamic
      • add --disable-mmx
        • hack; fixes linkage problem with MMX code
      • modify configure to ensure -fPIC -DPIC are included when compiling
      • ffmpeg will only install and build using GNU tools
      • once installed, ensure you set PKG_CONFIG_PATH to reflect location of .pc files
    • lame
      • straight forward
      • download, ./configure --prefix=/home/admin/vmfx/staging/usr/local/ --disable-gtktest --disable-static
      • make, make install
      • add --enable-libmp3lame to ffmpeg
    • AMR
      • libamr code from here: http://www.penguin.cz/~utx/amr
      • requires GNU patch to be used:
        • ln -s /usr/bin/gpatch patch
      • libamrwb builds no problems
        • add --enable-libamr-wb to ffmpeg
      • libamrnb 6.1.0.3 has issues
      • libamrnb 6.2.0.4rc1 builds cleanly
        • add --enable-libamr-nb to ffmpeg
    • FAAD2
      • v2.5 will not work with ffmpeg without hacking
      • v2 doesn't build
        • modify generated Makefile.in to remove spaces in RPM section (should be tabs)
        • modify to remove usage of lrintf()
      • ./configure --prefix=/home/admin/vmfx/staging/usr/local/
      • add --enable-libfaad to ffmpeg
    • FAAC
      • straight forward
      • ./configure -prefix=/home/admin/vmfx/staging/usr/local/
      • add --enable-libfaac to ffmpeg
  • default compiler is gcc 3.4.3
    • this appears to be slightly broken
    • the code in boost/python/detail/config.hpp contains the following define:
#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
// Replace broken Tru64/cxx offsetof macro
# define BOOST_PYTHON_OFFSETOF(s_name, s_member) \
        ((size_t)__INTADDR__(&(((s_name *)0)->s_member))) #else
# define BOOST_PYTHON_OFFSETOF offsetof
#endif

which is used in boost/python/object/instance.hpp:

template <class Data>
struct additional_instance_size
{     
    typedef instance<Data> instance_data;
    typedef instance<char> instance_char;
    BOOST_STATIC_CONSTANT(
        std::size_t, value = sizeof(instance_data)
                           - BOOST_PYTHON_OFFSETOF(instance_char,storage));
};

this needs to be replaced with:

#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
// Replace broken Tru64/cxx offsetof macro
# define BOOST_PYTHON_OFFSETOF(s_name, s_member) \
        ((size_t)__INTADDR__(&(((s_name *)0)->s_member))) 
#else
# define BOOST_PYTHON_OFFSETOF(TYPE, MEMBER)                    \
  (__offsetof__ (reinterpret_cast <size_t>                      \
                 (&reinterpret_cast <const volatile char &>     \
                  (static_cast<TYPE *> (0)->MEMBER))))
#endif
  • python
    • default python install is 2.3
    • comes from the packaging system
    • pyconfig.h needs to be modified to work around another gcc bug:
    • comment out _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED (!)
    • due to differences in dlopen on opensolaris, bootstrap.py needs to be modified to pass in the flag RTLD_PARENT
    • the platform string on opensolaris is "SunOS"
  • openlibraries
    • ensure CXXFLAGS=-I/opt/csw/include is set
    • ensure LDFLAGS=-L/opt/csw/lib is set
    • configure with ./configure --enable-gpl --disable-glew --disable-glu --disable-glut --disable-cg --disable-gelato --disable-opengl --with-boostprefix=/home/admin/vmfx/usr/local --with-pythonversion=2.3 --with-pythonprefix=/opt/csw/ --prefix=/home/admin/vmfx/usr/local/ --with-boostthreadruntime=mt

Attachments