1. Introduction
Memcached is a high-performance distributed memory object cache system. It reduces access to databases and file systems by caching data in the memory, reduces the burden on databases and operating systems, and increases the speed of application systems.
Memcached has been applied to many systems, and its latest version is memcached-1.4.5. With the continuous improvement of hardware technology, more and more applications of high-performance servers, especially 64-bit systems. In addition, memcached is cross-platform. Therefore, memcached is often compiled in 32-bit and 64-bit systems and in various operating systems.
The official website of memcached is http://www.memcached.org /. Download the latest stable version of memcached-1.4.5 can be smoothly compiled in Linux and UNIX. Many people may wonder how to compile in windows.
This article describes how to compile a memcached-1.4.5 in a Windows system for your reference.
2. Compile the target and Environment
Objective: To compile memcached-1.4.5.exe that can run on Intel Xeon x7560/Windows Server Enterprise 2008 SP2 (64bit) systems
List of computers and software used:
Compiler: PC/Windows Server 2003 Enterprise Edition SP2 (32bit)
Compiler: 64-bit GCC compiler
Compilation platform: msys/mingw-w64
3. Software Download preparation
Msys:
Download msys-1.0.11.exe
: Http://downloads.sourceforge.net/mingw/MSYS-1.0.11.exe
Mingw-w64:
Download: mingw-w64-bin_i686-mingw_20110516.zip
Http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/
Note: accept. In addition, the mingw64 and mingw open-source projects are not a single project. The former is a new project designed to migrate mingw to a 64-bit platform.
Memcached-1.4.5:
Download the package of my modified memcached-1.4.5. It contains memcached-1.4.5, libevent-2.0.11-stable, pthreads-w32-2-8-0-release (time in a hurry, did not download to 64-bit pthreads, If you download to, You Can slightly modify the replacement package inside the pthreads-w32-2-8-0-release) code.
: Http://download.csdn.net/source/3291154
4. Install the compiling environment
(1.exe install msys-1.0.11.exe
Msys, namely, minimal GNU (POSIX) System on Windows, is a small GNU environment, including basic bash and make. It is the best GNU environment in windows.
After the installation is complete, you can view
In this case, open msys from the menu or directly open msys. BAT to see the following running interface:
Run the GCC-V command and the command cannot be found because the GCC compiler has not been installed yet.
(2) configuration parameters
Open the C:/msys/1.0/etc folder and find the fstab file. If not, rename fstab. Sample to fstab. Find row
C:/mingw
Change
C:/msys/1.0/mingw // mingw
If it is a modified setting, do not change it.
(3) install the compiling environment
Uncompress mingw-w64-bin_i686-mingw_20110516.zip
Copy all the folders in the folder
Bin
Include
Lib
Libexec
Mingw
Share
X86_64-w64-mingw32
Copy to C:/msys/1.0/mingw
Copy all the folders under C:/msys/1.0/mingw, C:/msys/1.0/mingw, and overwrite them.
Open the msys Console
Enter gcc-V to display the following information:
$ Gcc-V
Using built-in specs.
Collect_gcc = C:/msys/1.0/mingw/bin/gcc.exe
Collect_lto_wrapper = C:/msys/1.0/mingw/bin/../libexec
0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with:.../../build/GCC/src/configure --
Prefix =/C/BB/vista64-mingw32/mingw-x86-x86_64/build/
/BB/vista64-mingw32/mingw-x86-x86_64/build/roo
-C ++ -- enable-fully-dynamic-string -- disable-multili
Thread model: Win32
GCC version 4.7.0 20110516 (experimental) (GCC)
From this we can see that the target platform for GCC compilation is a x86_64-w64, that is, a 64-bit system.
5. Compile memcached-1.4.5
(1) decompress the downloaded memcached_1.4.5_win file to the C:/msys/1.0/memcached directory.
(2) Open the msys console and switch to the C:/msys/1.0/memcached directory and run./build. Sh.
(3) Execute./build. SH and compile it. After compilation, the compiled results are displayed in the bin directory.
The memcached-1.4.5.exe is a complete executable file that does not require any library files (to facilitate the integration of library files and so on into exe ). Put your results in Windows Server Enterprise 2008 SP2 (64bit) to check the effect. Because the target system is 64-bit, the following error may be reported when running on a 32-bit system.