how to compile using Visual Studio?
Mike Hommey
mh+jemalloc at glandium.org
Wed Oct 31 08:10:13 PDT 2012
On Wed, Oct 31, 2012 at 07:19:43AM -0700, Bob Price wrote:
> I have been trying unsuccessfully to compile jemalloc with Visual
> Studio 10.0 and 11.0 with no luck.
>
> The files and website mention mingw and windows separately, and the
> msvc_compat headers seem targeted for this, so I assume that it is
> possible.
>
> What I want to do is setup jemalloc with a unique prefix on the public
> methods and compile it to a static library to be able to use it as the
> memory allocator for just one part of a larger 64-bit application.
>
> Can anyone give me some guidance here?
>
> What I have tried so far is as follows, using the current 3.1.0
> download:
>
> Since I couldn't find a way to do this on Windows, I used a 64-bit
> Linux box and ran ./configure --with-jemalloc-prefix=je_
> --with-private-namespace=jeint_ to (hopefully) get all the header
> files in the desired state. Then I copied everything over to a 64-bit
> Windows7 with the MS SDK and Visual Studio installed, and I borrowed a
> makefile I use on another C library and updated the options to include
> the jemalloc include and include/msvc_compat directories, and to
> ensure that _WIN32 is defined, and set it up to compile all C code in
> src.
>
> When I run this and it tries to compile arena.c I get all kinds of
> redefinition errors and warnings from msvc_compat\stdint.h and then
> many syntax errors in include\jemalloc\internal\jemalloc.h.
>
> I suspect that the issue results from the configure on a Linux system,
> but instead of spending hours trying to understand how to manually do
> this for Windows VS I hope that someone here can get me going much
> more quickly.
You need a shell environment on your windows box. I don't think cygwin
is supported, so you might have to install msys. From a msys shell, just
run the configure script, making sure cl.exe is in the PATH. IIRC,
that's about all you need.
Mike
More information about the jemalloc-discuss
mailing list