Benjamin

静以修身,俭以养德,非澹薄无以明志,非宁静无以致远。
随笔 - 386, 文章 - 0, 评论 - 196, 引用 - 0
数据加载中……

Vs2015 professional + sp2编译jemalloc

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;

安装cygwin可以选择网易镜像,没有则先添加。网易镜像地址:http://mirrors.163.com/cygwin/,安装时,可以直接搜索上面的五个软件,一个一个安装即可
安装完成后还需要讲cygwin写入到path变量中。



     

 

posted on 2016-06-29 10:53 Benjamin 阅读(1521) 评论(0)  编辑 收藏 引用 所属分类: VC


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理