[tor-bugs] #20530 [Core Tor/Tor]: undefined reference to 'munmap' and 'mmap' building tor on Windows

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Nov 2 11:33:47 UTC 2016


#20530: undefined reference to 'munmap' and 'mmap' building tor on Windows
----------------------------+---------------------
 Reporter:  ice             |          Owner:
     Type:  defect          |         Status:  new
 Priority:  Medium          |      Milestone:
Component:  Core Tor/Tor    |        Version:
 Severity:  Normal          |     Resolution:
 Keywords:  windows, mingw  |  Actual Points:
Parent ID:                  |         Points:
 Reviewer:                  |        Sponsor:
----------------------------+---------------------

Comment (by ice):

 Sorry I am not that familiar with trac. I attached the config-output.txt
 file to the comment above? Anyway. I meant to attach it here.

 So after reading the configure output, there is no mention of the items
 you listed above.

 I have also disabled HAVE_SYS_MMAN_H in orconfig.h and there was no
 change; same error as above-- after cleaning and rebuilding.

 The header files that mention getpagesize on my system are as follows:

 E:\dev\MinGW64\mingw\include\commctrl.h 142 KB C/C++ Header 2012-09-24
 2:56:07 PM 2014-05-26 8:40:29 PM 2014-05-26 8:40:29 PM 1
 1808 #define TBM_GETPAGESIZE (WM_USER+22)

 E:\dev\MinGW64\mingw\include\dbgeng.h 110 KB C/C++ Header 2012-09-24
 2:56:07 PM 2014-05-26 8:40:35 PM 2014-05-26 8:40:35 PM 3
 744     STDMETHOD(GetPageSize)(THIS_ PULONG Size) PURE;
 846     STDMETHOD(GetPageSize)(THIS_ PULONG Size) PURE;
 967     STDMETHOD(GetPageSize)(THIS_ PULONG Size) PURE;

 E:\dev\MinGW64\mingw\include\msrdc.h 16 KB C/C++ Header 2012-09-24 2:56:09
 PM 2014-05-26 8:41:03 PM 2014-05-26 8:41:03 PM 3
 261     STDMETHOD(GetPageSize)(THIS_ DWORD *pageSize) PURE;
 275 #define ISimilarityTraitsMapping_GetPageSize(This,pageSize)
 (This)->lpVtbl->GetPageSize(This,pageSize)

 I don't think they are related to this, or are they?

 More importantly, I am not so sure about mmap and friends on Windows. I
 think these are linux/unix specific. On the gcc-patches mailing list[1]
 one can read the following.

 "When compiling for windows, there shouldn't be any mmap/munmap references
 at all. While cygwin may supply some version of these, dlmalloc defines
 w32mmap/w32unmap which directly calls the appropriate routines for windows
 when WIN32 is defined (which I believe is always the case for the mingw
 compiler)."

 On MSDN[2] there is mention of CreateFileMapping, and I think this and
 friends are what are used on Windows.

 If you take a look at the mmapmodule[3] of Python, you'll notice how on
 Windows that function and its associated types are the ones used in place
 of mmap, etc.


 [1] https://gcc.gnu.org/ml/gcc-patches/2009-06/msg02240.html
 [2] https://msdn.microsoft.com/en-
 us/library/windows/desktop/aa366537(v=vs.85).aspx
 [3] https://github.com/python-git/python/blob/master/Modules/mmapmodule.c

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/20530#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list