Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working on MSVC support #144

Merged
merged 15 commits into from
Oct 24, 2015
Merged

Working on MSVC support #144

merged 15 commits into from
Oct 24, 2015

Conversation

jibsen
Copy link
Collaborator

@jibsen jibsen commented Oct 22, 2015

As discussed in #86.

The goal so far is just to get it to compile and run, here are some notes:

  • Most of the plugins included strings.h, but only zpaq appeared to use it. I removed it, and added a define to zpaq to use the equivalent MSVC function.
  • I put defines to map functions from strings.h to MSVC functions into internal.h
  • MSVC does not come with getopt, I don't know if you would prefer to include a getopt port, or write your own command line handling. For starters I used a getopt-like parser I wrote a while back called parg.
  • The following plugins did not compile out of the box: gipfeli, brotli, density, pithy, snappy, zling, and zstd.

@nemequ
Copy link
Member

nemequ commented Oct 23, 2015

MSVC does not come with getopt, I don't know if you would prefer to include a getopt port, or write your own command line handling. For starters I used a getopt-like parser I wrote a while back called parg.

I like parg. The only reason I didn't use any long options is portability, but parg solves that issue nicely. I'll probably modify the CLI to take advantage of that soon.

The following plugins did not compile out of the box: gipfeli, brotli, density, pithy, snappy, zling, and zstd.

For gipfeli nemequ/gipfeli@26c15a2 might fix it. I've already filed a PR for that.

For zstd, I just updated the zstd submodule to the latest version, so you may want to rebase. The changes are pretty significant…

@jibsen
Copy link
Collaborator Author

jibsen commented Oct 23, 2015

I like parg. The only reason I didn't use any long options is portability, but parg solves that issue nicely. I'll probably modify the CLI to take advantage of that soon.

Okay, there is some documentation of the differences compared to getopt in the readme at https://github.com/jibsen/parg

For gipfeli nemequ/gipfeli@26c15a2 might fix it. I've already filed a PR for that.

I had that as well, but there are a couple more changes needed:

  • The two defines in config.h need to be undefined (they did not even put a guard around them to check if the build system sets them).
  • std::min and std::max are in the algorithm header, so entropy.cc and sinksource.h need to include it.

For zstd, I just updated the zstd submodule to the latest version, so you may want to rebase. The changes are pretty significant…

It looks like I rebased after you pulled in zstd 0.2.0, it is compiling fine here now.

@nemequ
Copy link
Member

nemequ commented Oct 23, 2015

The two defines in config.h need to be undefined (they did not even put a guard around them to check if the build system sets them).

It would probably be better to do something like

#if defined(__GNUC__)
#  if !defined(HAVE_BUILTIN_CTZ)
#    #define HAVE_BUILTIN_CTZ
#  endif
#  if !defined(HAVE_BUILTIN_EXPECT)
#    #define HAVE_BUILTIN_EXPECT
#  endif
#endif

That would allow it to continue using those builtins on gcc and clang by default, and allow for a check in the build system for other compilers.

FWIW the Windows equivalent of __builtin_ctz is _BitScanForward/_BitScanForward64. AFAIK there is nothing like __builtin_expect.

@jibsen
Copy link
Collaborator Author

jibsen commented Oct 23, 2015

I noticed AppVeyor was up, so I am playing around with it, hope that's okay.

I think it should work, except it's missing Ragel.

The headers unistd.h and strings.h are not available. Remove
inclusion of strings.h from plugins except for zpaq which uses
snprintf. Add macros to internal.h to call MSVC alternatives.
For some reason static inline does not work, but static __inline does.
MSVC does not add lib prefix to library names.
This was causing a crash in yalz77 due to blocksize being 0.
This will possibly take too long time for AppVeyor.
@nemequ nemequ merged commit ffd2c45 into quixdb:master Oct 24, 2015
@jibsen jibsen deleted the msvc-support branch October 31, 2015 10:00
@travisdowns
Copy link

What's the current status of windows support? Does this repo have all of @jibsen's updates to support windows? I'm usually developing on Linux but at the moment I'm traveling without access to a Linux box and am definitely willing to help get the Windows side of things working.

@nemequ
Copy link
Member

nemequ commented Mar 16, 2016

What's the current status of windows support?

@jibsen is in a better position to answer this, but other than a few plugins which will not work with MSVC (see #145) AFAIK MSVC support works pretty well. Other compilers are a bit harder to judge since we don't have an AppVeyor build, but I think GCC should work, clang still has some issues.

Does this repo have all of @jibsen's updates to support windows?

Yes.

I'm usually developing on Linux but at the moment I'm traveling without access to a Linux box and am definitely willing to help get the Windows side of things working.

I'll definitely take all the help I can get. The windows label lists some relevant tasks. If you have any questions please don't hesitate to ask (here, #squash on freenode, mailing list… whatever you prefer).

@nemequ
Copy link
Member

nemequ commented Mar 16, 2016

Sorry, I broke the MSVC build when I got Squash working on Solaris and didn't notice. It should be fixed now.

@jibsen
Copy link
Collaborator Author

jibsen commented Mar 17, 2016

I believe status on Windows is:

  • with plain mingw-w64 or MSYS2 (both GCC 5.3.0) all plugins build and the unit tests run
  • with MSVC 2015 all plugins except density and gipfeli build, and the unit tests run
  • with Clang the situation is a little more complex, see Add clang to AppVeyor #185

I haven't tried any other compilers on Windows.

As @nemequ says, any help is greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants