title: C - MADV_HUGEPAGE Compile Error
body: <p>I was trying to compile some C code, which works fine on Linux with just one command.</p>
  
  <p><code>./autogen.sh &amp;&amp; ./configure &amp;&amp; make</code></p>
  
  <p>I need this to be compiled for windows, so I installed cygwin and all the dependencies that I could think of, and now I'm getting a compile error. (Error at <code>make</code>).</p>
  
  <pre><code>-cpu-miner.o `test -f 'cpu-miner.c' || echo './'`cpu-miner.c
  cpu-miner.c: In function ‘miner_thread’:
  cpu-miner.c:1056:139: error: ‘MAP_HUGETLB’ undeclared (first use in this function)
     persistentctx = (struct cryptonight_ctx *)mmap(0, sizeof(struct cryptonight_ctx), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_POPULATE, 0, 0);
                                                                                                                                             ^
  cpu-miner.c:1056:139: note: each undeclared identifier is reported only once for each function it appears in
  cpu-miner.c:1056:153: error: ‘MAP_POPULATE’ undeclared (first use in this function)
     persistentctx = (struct cryptonight_ctx *)mmap(0, sizeof(struct cryptonight_ctx), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_POPULATE, 0, 0);
                                                                                                                                                           ^
  cpu-miner.c:1058:88: error: ‘MADV_HUGEPAGE’ undeclared (first use in this function)
     madvise(persistentctx, sizeof(struct cryptonight_ctx), MADV_RANDOM | MADV_WILLNEED | MADV_HUGEPAGE);
                                                                                          ^
  make[2]: *** [Makefile:563: minerd-cpu-miner.o] Error 1
  </code></pre>
  
  <p>The full code is over here:
  <a href="https://github.com/wolf9466/cpuminer-multi" rel="nofollow">https://github.com/wolf9466/cpuminer-multi</a></p>
  
  <p>I installed Cygwin with gcc, ming-w64, libcurl, and openssl, as the project dependencies stated, but I'm stumped here.</p>
  
  <p>(I did make changes to the code for optimization, but they're mathematical tweaks and they work fine on Linux, so I don't think that's the problem.)</p>
  
  <h2>Edit 1</h2>
  
  <p>It compiles now! I removed the hugepages thing and it compiled - but it's a Linux executable that has a .exe file name. It needs the cygwin dlls to run.</p>