Compiling applications on Solaris

From Stormsail
Jump to navigation Jump to search
 * compiler detective -> http://blogs.oracle.com/timc/entry/the_compiler_detective_what_compiler
  * Installing HandBrakeCLI
https://trac.handbrake.fr/browser/trunk/doc/BUILD-Linux
./configure --prefix=/opt/hand --disable-gtk --force --launch --launch-jobs=0
vi $SRC/contrib/fontconfig/module.defs
change:
#
# Under MinGW:
#
# - A 'i386-ming32-gcc' $(FONTCONFIG.GCC.gcc) command will be available,
#   and the '-arch <arch>' argument should be omitted, as it will confuse this compiler.
#
# - The $(FONTCONFIG.GCC.archs) variable is not set.
#   Therefore statically guess the target arch to be i386.
#
ifeq ($(BUILD.system),mingw)
    FONTCONFIG.cc_archoption      =
    FONTCONFIG.config_archoption  = --with-arch=i386
else ifeq ($(BUILD.system),linux)
    FONTCONFIG.cc_archoption      =
else
    FONTCONFIG.cc_archoption      = 
    FONTCONFIG.config_archoption  = --with-arch=i386
endif
cd $SRC/contrib/x264/
mv P01-solaris.patch P01-solaris


./configure --prefix=/opt/hand --disable-gtk
make contrib.fetch
make contrib.extract
make contrib.patch
libass-0.9.13.tar.gz
libiconv-1.13.1.tar.gz
download build autoconf & automake
vi /jack/HandBrake-0.9.6/contrib/x264/module.defs
add --disable-asm:
X264.CONFIGURE.extra += --disable-gpac --disable-avs --disable-lavf --disable-ffms --disable-swscale --disable-asm


cp libiconv-1.13.1.tar.gz /jack/HandBrake-0.9.6/build/contrib/libiconv
cp libass-0.9.13.tar.gz /jack/HandBrake-0.9.6/build/contrib/libass
libavcodec
vi /jack/HandBrake-0.9.6/contrib/ffmpeg/module.defs
FFMPEG.CONFIGURE.extra = \
add
--disable-ssse3


For others looking at the same issue:
We hashed this issue out off-list, using
configure CC='gcc -m64'
works, just
configure CFLAGS=-m64


ln -s /usr/bin/libtool .
For some packages, you seem to also run into trouble where libtool can't figure out what you're doing:
   $ libtool --mode=compile target-gcc -g -O2 -c foo.c
   libtool: compile: unable to infer tagged configuration
   libtool: compile: specify a tag with `--tag'
OK, so it couldn't figure out that we're compiling C code. No problem, just add the tag --tag=CC. Works when we compile:
  * [[1][Compiling HandBrake on OpenSolaris]]
  * [[2][Compiling Handbrake CLI on Nexenta]]
  * [[3][Compiling and installing ffmpeg on Solaris]]

make install fails with strange "cycle detected" errors from find and a "libavdevice.a was not found anywhere!"

   * This is because it is trying to use /usr/sbin/install which appears to be broken, or at least incompatible with GNU install.
   * Solve this by symlinking /usr/bin/ginstall to /use/bin/install (if /usr/bin is before /usr/sbin in the PATH). Essentially, get it to use ginstall instead and it works dandy. 

http://www.neuhalfen.name/2011/10/15/MPlayer_On_Solaris11/

mplayer rebuild for Solaris 11:

http://www.neuhalfen.name/2011/10/15/MPlayer_On_Solaris11/

build 32bits otherwise mplayer vd_codec will complain.
libmad
a52dec
libdca
xvidcore
faac
x264 ./configure --enable-pic --disable-asm --enable-shared --prefix=/opt/x264
lame


depend fmri=pkg:/developer/gcc/[email protected] type=require
depend fmri=pkg:/[email protected] type=require
depend fmri=pkg:/[email protected] type=require
depend fmri=pkg:/[email protected] type=require
depend fmri=pkg:/[email protected] type=require
depend fmri=pkg:/[email protected] type=require
depend fmri=pkg:/MBLx264@20100125 type=require
depend fmri=pkg:/[email protected] type=require


a52dec-0.7.4
faac-1.28
faad2-2.7
lame-3.99
libdca-0.0.5
libmad-0.15.1b
x264
xvidcore


libmad:
remove -fforce-mem from CFLAGS


MPlayer-1.0rc2

xvid fix -> http://seriouswebapps.com/installing-xvid-122-on-opensolaris
cd /src
tar xzf xvidcore-1.2.2.tar.gz && cd xvidcore/build/generic
CFLAGS=$( find -L /my -type d -name include -exec echo "-I{} " \; | grep -v "[.][0-9]" | grep -v "pth" | tr -d '\n' ) \
 CPPFLAGS=$( find -L /my -type d -name include -exec echo "-I{} " \; | grep -v "[.][0-9]" | grep -v "pth" | tr -d '\n' ) \
 LDFLAGS=$( find -L /my -type d -name lib -exec echo "-L{} -R{} " \; | grep -v "[.][0-9]" | tr -d '\n' ) \
 CC=gcc \
 ./configure --prefix=/my/xvidcore-1.2.2 >>mylog.txt
# modify line 133 in Makefile, replace "$(CC)" with "/bin/ld"
vi Makefile
# modify line 48 in platform.inc, to read
SPECIFIC_LDFLAGS=-h libxvidcore.$(SHARED_EXTENSION).$(API_MAJOR) -B dynamic -shared -M libxvidcore.ld -lc -lm -lpthread
vi platform.inc
gmake all >>mylog.txt && su
gmake install >>mylog.txt
ln -s /my/xvidcore-1.2.2 /my/xvidcore
ln -s libxvidcore.so.4.2 /my/xvidcore-1.2.2/lib/libxvidcore.so
ln -s /my/xvidcore/lib/* /usr/lib/
ln -s /my/xvidcore/include/* /usr/include/
exit

Package Building

pkgsend generate root > MANIFEST.files
root@monkey:/opt/package/a52dec# more MANIFEST.files
# [email protected], client release 5.11
set name=pkg.description value="ATSC A/52 stream decoder"
set name=pkg.fmri value="pkg:/[email protected],0.5.11-0.0.0"
set name=pkg.name value="ATSC A/52 stream decoder"
set name=description value="ATSC A/52 stream decoder"
set name=info.maintainer value="Andy Harrison ([email protected])"
dir group=bin mode=0755 owner=root path=usr
<snip>


pkgsend publish -s /export/repo/misc/stormsail -d root test
root@monkey:/opt/package/libdca# more trans 
<transform file dir -> default owner root>
<transform file dir -> default group bin>
<transform file -> default mode 0644>
<transform dir -> default mode 0755> 
root@monkey:/opt/package/libdca# pkgmogrify -I . -O test MANIFEST.files trans


root@monkey:/export/build/MPlayer-1.0rc4#./configure --prefix=/opt/test --extra-ldflags="-lm"
root@monkey:/export/build/MPlayer-1.0rc4#

There is a bug in the latest SVN source as you end up with an error like this:

gcc -MD -MP -Wundef -Wall -Wno-switch -Wno-parentheses -Wpointer-arith -Wredundant-decls -Wstrict-prototypes -Wmissing-prototypes -Wdisabled-optimization -Wno-pointer-sign   -Wdeclaration-after-statement -std=gnu99 -Werror-implicit-function-declaration -O4 -march=native -mtune=native -pipe -ffast-math -fomit-frame-pointer -fno-tree-vectorize  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -Ilibdvdread4 -I. -Iffmpeg   -I/usr/X11/include  -I/usr/include/freetype2   -c -o libao2/ao_sun.o libao2/ao_sun.c
libao2/ao_sun.c: In function 'realtime_samplecounter_available':
libao2/ao_sun.c:161:35: error: 'MSGTR_AO_SUN_RtscWriteFailed' undeclared (first use in this function)
libao2/ao_sun.c:161:35: note: each undeclared identifier is reported only once for each function it appears in
gmake: *** [libao2/ao_sun.o] Error 1

Essentially MSGTR_AO_SUN_RtscWriteFailed hasn't been defined...... so let's find in out of an older release and add the following to help_mp.h:

#define MSGTR_AO_SUN_RtscWriteFailed "[AO SUN] rtsc: write failed.\n"
  * http://mailman.videolan.org/pipermail/x264-devel/2012-January/008959.html -> Patch for x264 using Solaris Compilers