1. Install Cygwin with at least the following packages:
* autoconf
* autogen
* gawk
* grep
* sed
2. Install Visual Studio 2015 with Visual C++
3. Add Cygwin\bin to the PATH environment variable
4. Open "VS2015 x86 Native Tools Command Prompt"
(note: x86/x64 doesn't matter at this point)
5. Generate header files:
sh -c "./autogen.sh CC=cl --enable-lazy-lock=no"
6. Now the project can be opened and built in Visual Studio:
msvc\jemalloc_vc2015.sln
jemalloc_vc2015.sln的平台设置中需要win10版本,win7下无法成功编译dll,因此在win7只能使用lib库,不能使用dll;
所以vs2015的solution Configurations选Debug-static或Release-static
solution Platforms选x86或x64
Error C2036 'void *': unknown size jemalloc F:\jemaolloc\jemalloc\include\jemalloc\internal\extent.h 227
修改
return ((void *)(uintptr_t)extent->e_addr - PAGE);
return (void*)((uintptr_t)extent->e_addr - PAGE);
其他的两处错误如法炮制,在编译顺利通过
最新的jemalloc的编译,需要注意git的版本,需要jemalloc-cmake版本,页面:https://github.com/jemalloc否则无法编译通过。
按照msvc中的ReadMe要求先安装Cygwin,在运行VS2015 x86 Native Tools Command Prompt(vs2017也是一样,x86/x64是不允许),切换到jemalloc目录下执行
sh -c "CC=cl ./autogen.sh",再用vs2015或者vs2017运行msvc\jemalloc_vc2015.sln;这里至少要求autoconf、autogen、gawk、grep、sed在cygwin;