Building a PHP Extension with a specific version

When building a native php extension it’s possible to run into problems when there are different php versions installed on the build system. As the extension is build with the php version / sources that are in the search path.

That is why “configure” allows to pass in a path to the php-config executable of the version /sources your are targeting. Run the configure for your extension like that:

./configure –with-php-config=[path to your php bin directory]/php-config

php-config returns all the necessary information so that configure is able to setup a valid makefile.

Building The live555 Streaming Media Framework on Windows with Visual Studio 2012/13

The live555 Streaming Media framework allows to stream content over RTP, and comes with a RTSP server. Below some hints how to build on Windows 7 64Bit with Visual Studio Express 2012 though these should also work with VS 2013.

On the command line

More current versions of Visual Studio IDE do not support building makefile based projects, so you need to build from the command line. Instructions on generating makefiles for the windows command-line can be found in the official documentation.

You can still build the project in the IDE. Check the second part of the post for instructions on how to modify the project for that.

  • From the Windows SDKs include directory copy “NtWin32.Mak” and “Win32.Mak” to the VS include directory eg. “C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include”.
  • Edit win32config and make “TOOLS32” point to the location of your build tools for me that was “C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC”. Change “msvcirt.lib” to “msvcrt.lib” in the “LINK_OPTS_0” param and the “LINKS” param to ‘ “$(TOOLS32)\bin\$(link)” -out:’ (without the ticks).
  • Get the sources from here: http://www.live555.com/liveMedia/public/ and unpack them somewhere. You will also need the Windows Platform SDK.
  • From the start menu launch  “Developer Command Prompt for VS2012” this will give you a console that is configured for building with VS. Go to the directory where you unpacked the sources and execute “genWindowsMakefiles”.
  • Now run “nmake -f file.mak”  in all subdirs. Eg. “nmake -f groupsock.mak” in the groupsock dir. You should proceed in the following order:
  • liveMedia
  • groupsock
  • UsageEnvironment
  • BasicUsageEnvironment
  • testProgs
  • mediaServer

In the IDE

To get the project to build in the VS IDE you need to patch two files:
In “DelayQueue.cpp” after "const DelayInterval ETERNITY(INT_MAX, MILLION-1);" add

const DelayInterval DELAY_MINUTE = 60*DELAY_SECOND;
const DelayInterval DELAY_HOUR = 60*DELAY_MINUTE;
const DelayInterval DELAY_DAY = 24*DELAY_HOUR;

In “DelayQueue.hh” replace
extern DelayInterval const DELAY_ZERO;
extern DelayInterval const DELAY_SECOND;
DelayInterval const DELAY_MINUTE = 60*DELAY_SECOND;
DelayInterval const DELAY_HOUR = 60*DELAY_MINUTE;
DelayInterval const DELAY_DAY = 24*DELAY_HOUR;

with

extern DelayInterval const DELAY_ZERO;
extern DelayInterval const DELAY_SECOND;
extern DelayInterval const DELAY_MINUTE;
extern DelayInterval const DELAY_HOUR;
extern DelayInterval const DELAY_DAY;

Don’t forget to add the live555 libs as dependencies to the project. You will also need “advapi32.lib”.