Compile libRTMP with MinGW


The libRTMP library provides online multimedia streaming support for many open-source projects, such as ffmpeg and curl. I am building librtmp for use with ffmpeg and mplayer. I downloaded the latest release tarball from here.

  1. First, I compiled zlib as shown in this post.

    make -f win32/Makefile.gcc
    cp -iv zlib1.dll /mingw/bin
    cp -iv zconf.h zlib.h /mingw/include
    cp -iv libz.a /mingw/lib
    cp -iv libz.dll.a /mingw/lib
  2. Then, I built OpenSSL as shown in this post.

    ./Configure -DHAVE_STRUCT_TIMESPEC -L/mingw/lib -lz -lpthreadGC2 -lws2_32 --prefix=/mingw threads zlib mingw
    make
    make install
  3. Then, I built librtmp.

    make SYS=mingw
    cp -iv *.exe /mingw/bin

    To build the shared library, I typed:

    cd librtmp
    gcc -shared -o librtmp.dll -Wl,--out-implib,librtmp.dll.a rtmp.o log.o amf.o hashswf.o parseurl.o -lssl -lcrypto -lz -lws2_32 -lwinmm -lgdi32

    To install librtmp, I typed the following:

    cp -iv librtmp.dll /mingw/bin
    cp -iv amf.h http.h log.h rtmp.h /mingw/include/librtmp
    cp -iv librtmp*.a /mingw/lib
    cp -iv librtmp.pc /mingw/lib/pkgconfig
  4. Sometimes, librtmp.pc fails to be generated. In that case, make it yourself and copy it to /mingw/lib/pkgconfig.

    prefix=/mingw
    exec_prefix=${prefix}
    libdir=${exec_prefix}/lib
    incdir=${prefix}/include/librtmp
    
    Name: librtmp
    Description: RTMP implementation
    Version: 2.3
    Requires: openssl libcrypto
    URL: http://rtmpdump.mplayerhq.hu
    Libs: -L${libdir} -lrtmp -lz
    Libs.private: -lws2_32 -lwinmm -lgdi32 -lssl -lcrypto
    Cflags: -I${incdir}

你可能感兴趣的:(Compile libRTMP with MinGW)