Working on OpenSolaris 2009.06... but how to do headless???

General discussion about PS3 Media Server (no support or requests)

Re: Working on OpenSolaris 2009.06... but how to do headless???

Postby AustinPowersISU » Wed Jun 10, 2009 2:42 am

This is going to be a VERY LONG POST and I'm sorry, but here is the promised documentation for compiling lame, mplayer, and ffmpeg from source

UPDATED 2009-06-12 With GCC 4 instructions

--------------------------------------------------------------------------------
SETUP
--------------------------------------------------------------------------------

First, let's talk a bit about setup for compiling.


I followed this blog post for my build tools:

http://blogs.sun.com/lewiz/entry/compil ... laris_2008

Namely:

root@wd40:~# $ pfexec pkg set-authority -O http://blastwave.network.com:10000/ Blastwave
root@wd40:~# $ pfexec pkg install SUNWgcc SUNWgmake IPSgawk SUNWxorg-headers

And my path is:

root@wd40:~# export PATH=/usr/gnu/bin:/opt/csw/gnu:/usr/bin:/usr/X11/bin:/usr/sbin:/sbin:/usr/local/bin

Additionally, we need to make sure /usr/local/lib is in our library path or else some stuff bombs out

root@wd40:~# crle

Configuration file [version 4]: /var/ld/ld.config
Platform: 32-bit LSB 80386
Default Library Path (ELF): /lib:/usr/lib:/usr/local/lib
Trusted Directories (ELF): /lib/secure:/usr/lib/secure (system default)


No /usr/local/lib listed, so I ran:

root@wd40:~# crle -l /usr/local/lib -u

And now:

root@wd40:~# crle

Configuration file [version 4]: /var/ld/ld.config
Platform: 32-bit LSB 80386
Default Library Path (ELF): /lib:/usr/lib:/usr/local/lib
Trusted Directories (ELF): /lib/secure:/usr/lib/secure (system default)

Command line:
crle -c /var/ld/ld.config -l /lib:/usr/lib:/usr/local/lib

Also, we need to use ginstall instead of install. Let's make a link:

root@wd40:~# ln -s /usr/bin/ginstall /usr/bin/install

Due to our path order, this install will be hit first (rather than the default install binary which won't work for some things)

After a lot of troubleshooting, it was determined that we must use GCC4. Get GCC4 from the Solaris Package Manager tool.

You'll need: gcc-432 and gcc-runtime-432

After that is installed:

root@wd40:~# cd /usr/gnu/bin/
root@wd40:~# mv cc cc.bak
root@wd40:~# ln -s /usr/bin/gcc-4.3.2 cc

root@wd40:/usr/gnu/bin# cd /usr/bin/
root@wd40:/usr/bin# mv gcc gcc.bak
root@wd40:/usr/bin# ln -s /usr/bin/gcc-4.3.2 gcc

Let's make sure we are using version 4 for both gcc and cc

root@wd40:/usr/bin# gcc -v
Using built-in specs.
Target: i386-pc-solaris2.11
Configured with: ../gcc-4.3.2/configure --prefix=/usr --program-suffix=-4.3.2 --infodir=/usr/share/info --mandir=/usr/share/man --libexecdir=/usr/lib --enable-shared --disable-static --disable-libtool-lock --target= --enable-objc-gc --

enable-concept-checks --disable-libada --enable-libssp --enable-languages=c,c++,objc,fortran --enable-threads=posix --enable-tls=yes --with-system-zlib --without-gnu-ld --with-ld=/usr/ccs/bin/ld --with-gnu-as --with-as=/usr/sfw/bin/gas

--with-gmp-include=/usr/include/gmp --with-gmp-lib=/usr/lib --with-mpfr-include=/usr/include/mpfr --with-mpfr-lib=/usr/lib --enable-c99 --enable-nls --enable-wchar_t --enable-libstdcxx-allocator=mt --with-pic
Thread model: posix
gcc version 4.3.2 (GCC)


root@wd40:/usr/bin# cc -v
Using built-in specs.
Target: i386-pc-solaris2.11
Configured with: ../gcc-4.3.2/configure --prefix=/usr --program-suffix=-4.3.2 --infodir=/usr/share/info --mandir=/usr/share/man --libexecdir=/usr/lib --enable-shared --disable-static --disable-libtool-lock --target= --enable-objc-gc --

enable-concept-checks --disable-libada --enable-libssp --enable-languages=c,c++,objc,fortran --enable-threads=posix --enable-tls=yes --with-system-zlib --without-gnu-ld --with-ld=/usr/ccs/bin/ld --with-gnu-as --with-as=/usr/sfw/bin/gas

--with-gmp-include=/usr/include/gmp --with-gmp-lib=/usr/lib --with-mpfr-include=/usr/include/mpfr --with-mpfr-lib=/usr/lib --enable-c99 --enable-nls --enable-wchar_t --enable-libstdcxx-allocator=mt --with-pic
Thread model: posix
gcc version 4.3.2 (GCC)

--------------------------------------------------------------------------------
LAME
--------------------------------------------------------------------------------

Downloaded lame source to /usr/local/src

root@wd40:/usr/local/src# wget http://superb-east.dl.sourceforge.net/s ... 8-2.tar.gz

root@wd40:/usr/local/src# tar -xvf lame-398-2.tar.gz

root@wd40:/usr/local/src# cd lame-398-2

root@wd40:/usr/local/src/lame-398-2# ./configure

root@wd40:/usr/local/src/lame-398-2# gmake

root@wd40:/usr/local/src/lame-398-2# gmake install

That should be it! Let's just make sure lame shows up where it should:

root@wd40:/usr/local/src/lame-398-2# which lame
/usr/local/bin/lame

Yep!

--------------------------------------------------------------------------------
Mplayer
--------------------------------------------------------------------------------

Downloaded latest Mplayer subversion snap to /usr/local/src

root@wd40:/usr/local/src/lame-398-2# cd /usr/local/src/

root@wd40:/usr/local/src# wget http://www.mplayerhq.hu/MPlayer/release ... ot.tar.bz2

root@wd40:/usr/local/src# tar -xvf mplayer-checkout-snapshot.tar.bz2

root@wd40:/usr/local/src# cd mplayer-checkout-2009-06-12/

Before we configure, we need to edit the configure script to disable the -rdynamic option, otherwise cc will complain later

root@wd40:/usr/local/src/mplayer-checkout-2009-06-12# vi configure

You can use whatever editor you want. Basically we need to remove the lines:

if test "$_real" = yes || test "$_xanim" = yes && ! win32 && ! qnx && ! darwin && ! os2 ; then
_ld_dl_dynamic='-rdynamic'
fi

And then save

root@wd40:/usr/local/src/mplayer-checkout-2009-06-12# ./configure --enable-debug --extra-cflags=-fomit-frame-pointer

I can't get it to work unless we use debug mode! Also, you must pass the extra cflag to get debug mode to work!

root@wd40:/usr/local/src/mplayer-checkout-2009-06-12# gmake

root@wd40:/usr/local/src/mplayer-checkout-2009-06-12# gmake install

Let's make sure our binaries are where they should be:

root@wd40:/usr/local/src/mplayer-checkout-2009-06-12# which mplayer
/usr/local/bin/mplayer

root@wd40:/usr/local/src/mplayer-checkout-2009-06-12# which mencoder
/usr/local/bin/mencoder

Yep!

--------------------------------------------------------------------------------
ffmpeg
--------------------------------------------------------------------------------

Downloaded the latest snapshot of ffmpeg

root@wd40:/usr/local/src/mplayer-checkout-2009-06-12# cd /usr/local/src/

root@wd40:/usr/local/src# wget http://ffmpeg.org/releases/ffmpeg-expor ... ot.tar.bz2

root@wd40:/usr/local/src# tar -xvf ffmpeg-export-snapshot.tar.bz2

root@wd40:/usr/local/src# cd ffmpeg-export-2009-06-12/

root@wd40:/usr/local/src/ffmpeg-export-2009-06-12# ./configure

root@wd40:/usr/local/src/ffmpeg-export-2009-06-12# gmake

After a while, this will bomb out with the output:

gcc -DHAVE_AV_CONFIG_H -I. -I"/usr/local/src/ffmpeg-export-2009-06-12" -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__EXTENSIONS__ -fomit-frame-pointer -g -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -O3 -fno-math-errno -fno-signed-zeros -c -o libavcodec/x86/mlpdsp.o libavcodec/x86/mlpdsp.c
/var/tmp//ccKWa4Vq.s: Assembler messages:
/var/tmp//ccKWa4Vq.s:96: Error: unbalanced parenthesis in operand 1.
/var/tmp//ccKWa4Vq.s:101: Error: unbalanced parenthesis in operand 1.
/var/tmp//ccKWa4Vq.s:106: Error: unbalanced parenthesis in operand 1.
/var/tmp//ccKWa4Vq.s:111: Error: unbalanced parenthesis in operand 1.
/var/tmp//ccKWa4Vq.s:128: Error: unbalanced parenthesis in operand 2.
gmake: *** [libavcodec/x86/mlpdsp.o] Error 1


I found the solution to this problem here:

http://opensolaris.org/jive/thread.jspa ... eID=383406

Run the command:

Code: Select all
root@wd40:/usr/local/src/ffmpeg-export-2009-06-12# gcc -save-temps -DHAVE_AV_CONFIG_H -I. -I"/usr/local/src/ffmpeg-export-2009-06-12" -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__EXTENSIONS__ -fomit-frame-pointer -g -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -O3 -fno-math-errno -fno-signed-zeros        -c -o libavcodec/x86/mlpdsp.o libavcodec/x86/mlpdsp.c


This will bomb out

root@wd40:/usr/local/src/ffmpeg-export-2009-06-12# vi mlpdsp.s

Use whatever editor you want. We need to replace:

4*(8 + (40 * (192000 / 48000)))

with

672

Once again, there will be 5 replacements needed

Then run this command:

Code: Select all
root@wd40:/usr/local/src/ffmpeg-export-2009-06-12# gcc -DHAVE_AV_CONFIG_H -I. -I"/usr/local/src/ffmpeg-export-2009-06-12" -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__EXTENSIONS__ -fomit-frame-pointer -g -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -O3 -fno-math-errno -fno-signed-zeros        -c -o libavcodec/x86/mlpdsp.o mlpdsp.s


And let's finish out make

root@wd40:/usr/local/src/ffmpeg-export-2009-06-12# gmake

This should finish without any errors

root@wd40:/usr/local/src/ffmpeg-export-2009-06-12# gmake install

Let's make sure we have our binary

root@wd40:/usr/local/src/ffmpeg-export-2009-06-12# which ffmpeg
/usr/local/bin/ffmpeg

YEP

--------------------------------------------------------------------------------
Done!
--------------------------------------------------------------------------------

Well, there you have it! lame, mplayer (including mencoder) and ffmpeg from source on OpenSolaris 2009.06.

--------------------------------------------------------------------------------
Cleanup
--------------------------------------------------------------------------------

Let's put gcc and cc back the way that we found them

root@wd40:/usr/local/src/ffmpeg-export-2009-06-12# cd /usr/bin/
root@wd40:/usr/bin# mv gcc.bak gcc
root@wd40:/usr/bin# cd /usr/gnu/bin/
root@wd40:/usr/gnu/bin# mv cc.bak cc

Just make sure the /usr/local/bin is in your path when you launch PS3 Media Server and things should be great!

export PATH=/usr/gnu/bin:/opt/csw/gnu:/usr/bin:/usr/X11/bin:/usr/sbin:/sbin:/usr/local/bin
Last edited by AustinPowersISU on Sat Jun 13, 2009 4:00 am, edited 3 times in total.
AustinPowersISU
 
Posts: 14
Joined: Tue Jun 09, 2009 2:55 am

Re: Working on OpenSolaris 2009.06... but how to do headless???

Postby adamretter » Wed Jun 10, 2009 9:48 am

Thanks that looks very intersting and I will try and replicate it on a fresh install...

I actually used a modified configure file to build mplayer from source, I found it here - http://blogs.sun.com/observatory/entry/ ... laris_this

Not sure exactly what the changes are, but it allows 1.0rc2 to build without any problems.


Just wondering, if you run the mencoder command that is listed in debug.log on the command line, what is the output of mencoder - does it segfault also?
adamretter
 
Posts: 10
Joined: Mon Jun 08, 2009 10:30 pm

Re: Working on OpenSolaris 2009.06... but how to do headless???

Postby adamretter » Wed Jun 10, 2009 9:50 am

Also in the mean time I have been in touch with one of the SFE spec file authors to try and understand why I cant build from the SFE packages, he can build the SFExvid package fine, but I am having problems - we are trying to resolve this at the moment. My hope is that we could eventually just build all the packages that we need from SFE.


http://pkgbuild.sourceforge.net/spec-files-extra/
adamretter
 
Posts: 10
Joined: Mon Jun 08, 2009 10:30 pm

Re: Working on OpenSolaris 2009.06... but how to do headless???

Postby AustinPowersISU » Wed Jun 10, 2009 8:37 pm

Yep, I get a segmentation fault and a core dump:

root@wd40:/vault/shared_storage# mencoder -ss 0 -quiet /vault/shared_storage/test/test.avi -quiet -quiet -oac lavc -of lavf -lavfopts format=asf -mpegopts format=mpeg2:muxrate=500000:vbuf_size=1194:abuf_size=64 -ovc lavc -channels 2 -lavdopts debug=0:threads=4 -lavcopts autoaspect=1:vcodec=wmv2:acodec=wmav2:abitrate=256:threads=1:keyint=1:vqscale=1:vqmin=2 -quiet -quiet -subdelay 20000 -quiet -quiet -ofps 24000/1001 -quiet -quiet -mc 0.1 -af lavcresample=48000 -srate 48000 -o /var/tmp/javaps3media/mencoder1244597831562

MEncoder SVN-r29352-snapshot-3.4.3 (C) 2000-2009 MPlayer Team
success: format: 0 data: 0x0 - 0x22609f14
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
VIDEO: [XVID] 624x352 24bpp 23.976 fps 1420.7 kbps (173.4 kbyte/s)
[V] filefmt:3 fourcc:0x44495658 size:624x352 fps:23.976 ftime:=0.0417
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 16000->192000)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
** MUXER_LAVF *****************************************************************
REMEMBER: MEncoder's libavformat muxing is presently broken and can generate
INCORRECT files in the presence of B-frames. Moreover, due to bugs MPlayer
will play these INCORRECT files as if nothing were wrong!
*******************************************************************************
OK, exit.
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
Segmentation Fault (core dumped)
AustinPowersISU
 
Posts: 14
Joined: Tue Jun 09, 2009 2:55 am

Re: Working on OpenSolaris 2009.06... but how to do headless???

Postby AustinPowersISU » Thu Jun 11, 2009 5:38 am

I forgot one step in my compile instructions before. We gotta use ginstall instead of install for some of the gmakes

Basically, this command needs to be ran before doing gmake install on some of the apps:

root@wd40:~# ln -s /usr/bin/ginstall /usr/bin/install

I added it above.
AustinPowersISU
 
Posts: 14
Joined: Tue Jun 09, 2009 2:55 am

Re: Working on OpenSolaris 2009.06... but how to do headless???

Postby AustinPowersISU » Thu Jun 11, 2009 6:21 am

I found this error when messing around with ffmpeg tonight:

root@wd40:~$ ffmpeg -y -i /vault/shared_storage/test/test.avi -ar 22050 -f flv ~/test.avi

....SNIP....

Compiler did not align stack variables. Libavcodec has been miscompiled
and may be very slow or crash. This is not a bug in libavcodec,
but in the compiler. You may try recompiling using gcc >= 4.2.
Do not report crashes to FFmpeg developers.

Interesting! Looks like I need gcc 4.2! Blastwave does not have this version, and I found this bugID:

http://bugs.opensolaris.org/bugdatabase ... id=6721621
AustinPowersISU
 
Posts: 14
Joined: Tue Jun 09, 2009 2:55 am

Re: Working on OpenSolaris 2009.06... but how to do headless???

Postby AustinPowersISU » Thu Jun 11, 2009 6:25 am

GCC4.2 can be installed from the package manager in OpenSolaris.

I'm installing 4.3.2 and 4.3.2-dev right now. I'll report either tonight or tomorrow on any sucessess/failures after the re-compile of ffmpeg
AustinPowersISU
 
Posts: 14
Joined: Tue Jun 09, 2009 2:55 am

Re: Working on OpenSolaris 2009.06... but how to do headless???

Postby AustinPowersISU » Thu Jun 11, 2009 6:57 am

Well, the recompile of ffmpeg worked, and I don't get the stack variables errors, but I still get a segmentation fault in mplayer.

Even with this version of gcc, mlpdsp.s had to be modified as detailed in my previous giant post. However, the configure script did not need to be changed.

I tried to re-compile mplayer with the updated gcc and ran into errors. I'll look into this more later.
AustinPowersISU
 
Posts: 14
Joined: Tue Jun 09, 2009 2:55 am

Re: Working on OpenSolaris 2009.06... but how to do headless???

Postby adamretter » Thu Jun 11, 2009 10:54 pm

Okay I have managed to make some progress building packages of said software natively using SFE.

On a fresh OpenSolaris 2009.06 -

$ pfexec pkg install gcc-dev ss-dev

Download and extract latest JDS CBE - http://dlc.sun.com/osol/jds/downloads/c ... 86.tar.bz2
Add "Software Installation" profile to your user account in /etc/user_attr
run ./cbe-install

Download the SFE files using svn - see http://pkgbuild.sourceforge.net/spec-files-extra/
I stored mine in ~/SFE

$ cd ~/SFE
$ . /opt/dtbld/bin/env.sh
$ pkgtool build --download --autodeps --interactive ./encumbered/SFExvid.spec

That succeeds fine :-)

I then try and build SFEffmpeg, before which I need to install some dependencies -
$ pfexec pkg install SUNWlibsndfile SUNWncurses SUNWid3lib SUNWwxwidgets

$ pkgtool build --download --autodeps --interactive ./encumbered/SFEffmpeg.spec

Unfortunately this eventually fails because of errors building various dependencies, I think the culprits are SFElame and SFEgpac. :-(


I will do some more digging and tweaking in this area and see if I can make any further progress...
adamretter
 
Posts: 10
Joined: Mon Jun 08, 2009 10:30 pm

Re: Working on OpenSolaris 2009.06... but how to do headless???

Postby dannix » Fri Jun 12, 2009 12:18 pm

I will be actively following this thread as I am trying to get this working under OpenSolaris too, although you seem to have much more luck (and experience) then I.
dannix
 
Posts: 6
Joined: Fri Jun 12, 2009 11:57 am

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 5 guests