Showing posts from April, 2011

Boost - Building from source

Boost is a comprehensive and portable libraries. It provides libraries from Math, IO, Network, etc... You can check out the list of libraries here. The main reason for my interest in this libraries is their portability. They had figured out the the x86 and x64 portability issues on these libraries. All you need is to compile the source with appropriate switches for your code. Moreover, this is a free library that can be used both commercial and non-commercial usage.
How to build from source
Follow the step to build the Boost from source.
1. Download latest version here
2. Unzip/untar the downloaded source
3. Use command prompt to run bootstrap.bat for Windows and for Linux
5. Then, run the following bjam for build
Bjam linux 32 bit with GCC
./bjam --build-dir="/root/boost_1_46_1/lib" --build-type=complete toolset=gcc address-model=32 architecture=x86 link=static --with-thread --with-serialization
Bjam Window commands 64 bit with MSVC 10
bjam --build-dir="C:\Boost\boo…

MS Virtual PC - Compact Dynamic Virtual Hard Disk For Linux Guest OS

If you are using Microsoft Virtual PC with dynamic virtual hard disk, you will realize that the size of the dynamic hard disk grow over time and it will not shrink.
MS Virtual PC provide a function to compact hardisk

But prior to use that function, you have to prepare the disk for compaction. Their preparation is simply mean zeroing your hard disk. MS Virtual PC can only reclaim zero-ed hard disk space.
For Linux, do the following
1. Start up your Linux virtual machine
2. At the console in any directory level, type
cat /dev/zero >
This will eventually fill up your virtual hard disk with 0 in This will take some time depends on the size of your hard disk.
3. When it is done, type the following commands
sync; sleep 30;sync
This is to make sure the data is written to disk
4. Then, type
This is to remove the zero file. By doing the above operation, it filled the virtual disk with zero data.
5. Shut down the Linux Virtual Machine and run the Compact Tools at MS Virt…

Linux - Check Shared Object Compile Version

If you want to check whether a shared object (.so) is 32 bits or 64 bits compiled, you can use the following commands
1. file
This file command will output the file type of the given file. It will work for .so files. Look for ELF XX-bit in the output. It will tell you whether the file is 32 bits or 64 bits compiled.

2. readelf -h
Thie readelf command will output the information about elf files. Look for Class: ELFXX where XX will tell you whether the file is 32 bit or 64 bit compiled

Please note that readelf -h works for archive files (.a) as well.
For windows, see Dumpbin command

Linux - RPM

RPM is one of the tools for linux package install. Below are some useful commands
Please replace XXX with your rpm package name

1. Install to default folder
rpm -i XXX.rpm
2. Install with Relocation
rpm -i --prefix=/ur/path XXX.rpm
3. Check whether a rpm package can be relocated
rpm -qpi XXX.rpm | grep Relocations
4. Check for installed package in machine
rpm -qa | grep XXX
5. Uninstall a package
rpm -e XXX
6. Upgrade a package
rpm -U XXX.rpm