pombreda / re2

Automatically exported from code.google.com/p/re2
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

compile failure: Windows (unordered_set) #50

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
NOTE: stdint.h included in the patch will break gcc on Linux! TODO: Need to 
move the <stdint.h> to a Windows specific sub-directory.

The remaining changes are minimal and #ifdef'ed to Windows so they won't break 
GCC on Linux.

To Test, On Windows, double click "re2.vcproj".

MSVC 2005 (8) fails because it does not have support for C++ TR1.

Original issue reported on code.google.com by unixma...@gmail.com on 1 Oct 2011 at 5:32

Attachments:

GoogleCodeExporter commented 9 years ago
stdint.h is available on Windows, no need to include it. Just rewrite the 
codebase to use uintptr_t where needed to remove the LPP64/LLP64 differences.

Original comment by PontusJo...@gmail.com on 1 Oct 2011 at 9:28

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Could you attach the test results?

Original comment by PontusJo...@gmail.com on 1 Oct 2011 at 7:11

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Without the tests actually compiling I don't see how it could be considered 
complete enough to be merged into mainline codebase.

I know for a fact that the issues you encounter during test compilation is an 
implicit result of a a faulty compilation.

If you're confident that you could back your patch up and actually get it 
merged to mainline feel free to use my changes as references.

I have no idea how much has changed since f6d25e6f2ce1 but it worked back then 
at least, https://bitbucket.org/root_op/re2-msvc.

Original comment by PontusJo...@gmail.com on 1 Oct 2011 at 9:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
//SAMPLE TEST CODE AS PROOF THE LIB WORKS ON MS WIN

#include "re2.h"

#include <windows.h>

#include <string>
#include <stdio.h>

int main(void)
{
  RE2 re_full_prefix("(GET|POST|HEAD)[ ]+(?:([[:alpha:]]{1,6})://([^/ ]+))?(/[^ ]*)(?:[ ]+HTTP/([[:digit:]]{1,3})\\.([[:digit:]]{1,4}))?[\\r\\n]{0,3}");
  if(!re_full_prefix.ok()) throw std::exception(re_full_prefix.error().c_str());

  std::string method, proto, host, URL, ver_major, ver_minor;
  if(!RE2::FullMatch("GET   /homeatlast HTTP/1.0", re_full_prefix, &method, &proto, &host, &URL, &ver_major, &ver_minor))
  {
    printf("1: does not match!\n");
    return 1;
  }
  printf("Method: %s\n", method.c_str());
  printf("Proto: %s\n", proto.c_str());
  printf("Host: %s\n", host.c_str());
  printf("URL: %s\n", URL.c_str());
  printf("Major Ver: %s\n", ver_major.c_str());
  printf("Minor Ver: %s\n", ver_minor.c_str());
  Sleep(2000);
  return 0;
}

Original comment by unixma...@gmail.com on 3 Oct 2011 at 4:29

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This is Brian Gunlogson, just wondering why the patch is not merged? I added a 
working testcase (see #8 above).

The original testcases do not compile under Windows because I haven't bothered 
to port them.

stdint.h is not needed for MSVC++ 2010, so that file in my patch may be removed.

Original comment by unixma...@gmail.com on 11 Nov 2011 at 4:10

GoogleCodeExporter commented 9 years ago
I've created a fork, available at http://code.google.com/p/re2win/ the source 
will be made available within an hour.

Attached is the final patch that I'll post here.

Original comment by unixma...@gmail.com on 27 Nov 2011 at 8:26

Attachments:

GoogleCodeExporter commented 9 years ago
hi,

how can i remove this error ??

re2-2011-09-30-src-win32\re2\util/util.h(52) : fatal error C1083: Cannot open 
include file: 'unordered_set': No such file or directory

Original comment by gaireh...@gmail.com on 2 Mar 2012 at 4:05

GoogleCodeExporter commented 9 years ago
The supported compilers for this patch on Windows are Microsoft Visual Studio 
2008 & Microsoft Visual Studio 2010. Make sure you are using those versions. 
2005 is not and will not be supported. It is just too old to have features 
support that RE2 requires. Also non-Microsoft Compilers are not supported under 
Windows. I just don't have the time to add them.

Original comment by unixma...@gmail.com on 2 Mar 2012 at 4:18

GoogleCodeExporter commented 9 years ago
Could you verify the MSVC version via something like this?
#ifdef WIN32
#if _MSC_VER < 1500 
#pragma error "This requires at least Microsoft Visual Studio 2008"
#endif
#endif

I'd like to use RE2 in Google Chrome and having MSVC support upstream would be 
tremendously helpful for us.

Original comment by battre@chromium.org on 21 May 2012 at 4:39

GoogleCodeExporter commented 9 years ago
I am not sure what the status here is. I think RE2 is in Chrome.

Original comment by rsc@golang.org on 10 Jan 2014 at 3:23

GoogleCodeExporter commented 9 years ago
RE2 is in Chrome but we needed to apply this patch: 
http://src.chromium.org/viewvc/chrome/trunk/src/third_party/re2/patches/re2-msvc
9-chrome.patch - It would be nice to upstream that.

Original comment by battre@chromium.org on 10 Jan 2014 at 1:16

GoogleCodeExporter commented 9 years ago
RE2 has moved to GitHub. I have not moved the issues over. If this issue is 
still important to you, please file a new one at 
https://github.com/google/re2/issues. Thank you.

Original comment by rsc@golang.org on 11 Dec 2014 at 4:45