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;