View Single Post
  #24  
Old 08-28-2011, 04:54 AM
tommieie tommieie is offline
Junior Member
 
Join Date: Feb 2010
Posts: 11
tommieie is on a distinguished road
Default

Re: RTMPDump - how do I compile source code in Linux like Ubuntu?


Quote:
Originally Posted by BirdOfPrey View Post
Hi all!
I'm quite a fan of RTMPDump as it allows me to schedule the download of my favourite live streams and watch them when I have the time for them, with a little program I made.

In some cases when an error was thrown RTMPDump2.3 does not close the window (specifically when recv receives -1) so I needed to modify librtmp to suit my needs.
Although the README file on the source package is quite helpful it seems it is a bit outdated, so here is a guide to compile RTMPDump with the current release.

Here is my experience with compiling RTMPDump2.3 with Ubuntu Maverick.
First compile I compiled for linux to see if all is ok.
Download and install OpenSSL:
Code:
wget http://www.openssl.org/source/openssl-1.0.0d.tar.gz
tar xvzf openssl-1.0.0d.tar.gz
cd openssl-1.0.0d
./config
make
sudo make install
Download and install libz:
Code:
wget http://zlib.net/zlib-1.2.5.tar.gz
tar xvzf zlib-1.2.5.tar.gz
cd zlib-1.2.5
./configure
make
sudo make install
go to cd rtmpdump-2.3 directory and edit Makefile line
Code:
LIB_OPENSSL=-lssl -lcrypto
to
Code:
LIB_OPENSSL=-lssl -lcrypto -ldl
finally make the project
Code:
make INC=-I/usr/local/ssl/include/ LDFLAGS=-L/usr/local/ssl/lib
If all goes ok, you'll get the rtmpdump binary built!

Having the linux version built I started the adventure of cross compiling it for windows
So I extracted the rtmpdump-2.3 tgz to another folder, rtmpdump-2.3Win in order not to screw up the linux built version
Code:
 wget http://rtmpdump.mplayerhq.hu/download/rtmpdump-2.3.tgz
tar xvzf rtmpdump-2.3.tgz rtmpdump-2.3Win
cd rtmpdump-2.3Win/
PS-the svn version didn't compile, use the tzg version!

To cross compile anything for windows you need mingw32 which you get with the command
Code:
sudo apt-get install mingw32

Then configure the openSSL for windows
Code:
wget http://www.openssl.org/source/openssl-1.0.0d.tar.gz
tar xvzf openssl-1.0.0d.tar.gz
cd openssl-1.0.0d
./Configure mingw --prefix=`pwd`/win32libs -DL_ENDIAN -DOPENSSL_NO_HW  --cross-compile-prefix=i586-mingw32msvc-
make
Get zlib already compiled for windows (less hassle this way)
Code:
wget http://zlib.net/zlib125-dll.zip
unzip zlib125-dll.zip
cd lib
cp zdll.lib libz.a
Then issue this magic command, where you should replace
  • -I/home/birdofprey/rtmpdump-2.3Win/openssl-1.0.0d/include/ for the path where the openssl includes are located (ssl.h, rc4.h, etc).
  • -I/home/birdofprey/rtmpdump-2.3Win/include/ for the path where the zlib includes are located (zlib.h, zconf.h)
  • -L/home/birdofprey/rtmpdump-2.3Win/openssl-1.0.0d/ with the path that leads you to the newly built windows libs libcrypto.a and libssl.a
  • -L/home/birdofprey/rtmpdump-2.3Win/lib for the path of your extracted libz.a.


Code:
make SYS=mingw INC="-I/home/birdofprey/rtmpdump-2.3Win/openssl-1.0.0d/include/ -I/home/birdofprey/rtmpdump-2.3Win/include/ -I/usr/i586-mingw32msvc/include/ -I/usr/local/include/" LDFLAGS="-L/home/birdofprey/rtmpdump-2.3Win/openssl-1.0.0d/ -L/usr/i586-mingw32msvc/lib/ -L/home/birdofprey/rtmpdump-2.3Win/lib" XCFLAGS="-DWIN32 -D_WIN32" CROSS_COMPILE=i586-mingw32msvc-
et voila you get a brand new rtmpdump.exe

to test it on linux do
Code:
sudo apt-get install wine
wine rtmpdump
and you'll get the marvelous strings:

Code:
RTMPDump v2.3 Mod BirdOfPrey
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
Application tried to create a window, but no driver could be loaded.
Make sure that your X server is running and that $DISPLAY is set correctly.
err:systray:initialize_systray Could not create tray window
fixme:toolhelp:CreateToolhelp32Snapshot Unimplemented: heap list snapshot
fixme:toolhelp:Heap32ListFirst : stub
ERROR: You must specify a hostname (--host) or url (-r "rtmp://host[:port]/playpath") containing a hostname
To put it working on windows you need to put rtmpdump.exe, librtmp.dll and zlib1.dll in the same folder.

Have fun compiling RTMPDump!
Can you help me with this compile? I'm fairly new to compiling C-code in Ubuntu, but I did follow your manual very carefully, however I get the following error:

tom@ubuntu:~/Downloads/rtmpdump-2.3$ make INC=-I/usr/local/ssl/include/ LDFLAGS=-L/usr/local/ssl/lib
make[1]: Entering directory `/home/tom/Downloads/rtmpdump-2.3/librtmp'
gcc -shared -Wl,-soname,librtmp.so.0 -L/usr/local/ssl/lib -o librtmp.so.0 rtmp.o log.o amf.o hashswf.o parseurl.o -lssl -lcrypto -lz
/usr/bin/ld: /usr/local/ssl/lib/libssl.a(s23_meth.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/ssl/lib/libssl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [librtmp.so.0] Error 1
make[1]: Leaving directory `/home/tom/Downloads/rtmpdump-2.3/librtmp'
make: *** [librtmp/librtmp.a] Error 2
tom@ubuntu:~/Downloads/rtmpdump-2.3$

Can you please give an indication where it does go wrong?

Thanks!
Reply With Quote