Showing posts from June, 2011

FFMPEG - Linux Build

This guild give you steps by step explanation on how to build ffmpeg from source for Linux. I am using CentOS 5.6 as platform
1. Additional repository. Get Epel so that you can yasm, git, etc... libraries
wget rpm -Uvh epel-release-5*.rpm
2. Download FFMPEG source from
3. Download the following libraries from CentOS command line with wget
wget wget wget wget wget wget wget wget http://downlo…

LInux - Recover from ldconfig error

If you accidentally ldconfig a library folder with libraries that are not suitable for your current Linux kernel and you restart your system, you may get yourself into a situation whereby you cannot log into the system anymore.
This is possible if you ldconfig a folder with libraries that requires glibc 2.5 during runtime. However, you system is using only glibc 2.3. At your next system startup, your system will try to load the shared object, but, it will fail and denied your log in.
To recover from this, you could do the following (assuming that you are using CentOS)
1. Boot up your system with your Linux installation disc 2. Go into Rescue mode. Simply following the on screen instruction given to load rescue mode. 3. When you are in Rescue mode, you are able to access your system. Usually, your original drive will be mounted in /mnt/sysimage/ 4. Create a file at / 5. Then, cd /mnt/sysimage/ 6. Then, find your corrupted ld linkage. Using as example, you can perform f…

Critical Section - Windows vs Linux in C++

Just to provide a simple equivalent critical section code between Windows and Linux
For Windows, critical section code are located at WinBase.h. Normally, you do not need to include this header as it is pre-loading in VS compiler
For Linux, mutex code are located in pthread.h. You will have to include this header file in order to use mutex in Linux

Creating critical section variable
This variable will be the object to be acquired when you want to use any critical resource
On Windows
On Linux
pthread_mutex_t m;

Initializing critical section
You have to initialize the critical section resource before using
On Windows
On Linux
//create mutex attribute variable pthread_mutexattr_t mAttr;
// setup recursive mutex for mutex attribute pthread_mutexattr_settype(&mAttr, PTHREAD_MUTEX_RECURSIVE_NP);
// Use the mutex attribute to create the mutex pthread_mutex_init(&m, &mAttr);
// Mutex attribute can be destroy after initializing the mutex var…