Closed GoogleCodeExporter closed 9 years ago
As far as I know, you can't combine cygwin and MSVC like this reliably. If you
want to build under MSVC, my guess is that you'll need to make a config.h
manually (or define the HAVE_* flags manually) and then make a Visual Studio
project out of it.
Original comment by se...@google.com
on 11 Apr 2011 at 1:38
I think Apache CouchDB for e.g. does this (cygwin + MSVC). If I comment out all
the unit test references in the Makefile.am, then generate a new tarball (via
make dist), extract this tarball into a Windows box, run configure and make
there, it works. So it's something related to the unit tests code or automake
configuration I suspect.
Btw, the attached patch is still needed for someone who wants to build the
project in Visual Studio. Do you think it can be integrated?
I'm not a Windows specialist at all, I just would like to build snappy with
Visual C++, including the tests :)
cheers
Original comment by fdman...@gmail.com
on 11 Apr 2011 at 9:58
I looked at the patch -- where does this code come from? It looks like code
that was cut-and-pasted uncredited from either library or example code, which
would probably not be appropriate for Snappy.
As for whether it works without the unit test, that seems to be mostly by luck
to me. You can see that several invalid flags are being passed to the compiler.
Original comment by se...@google.com
on 11 Apr 2011 at 10:02
Ok, my fault, I forgot to credit the source. The source is at [1].
I've tried to build snappy both with MinGW and Cygwin.
For MinGW I get an infinite loop while building it, seems like the cause is the
Makefile.am rules, however I don't have this issue on Linux or Mac OS X:
$ make
make all-am
make[1]: Entering directory `/c/Users/fdmanana/git/snappy-1.0.1'
/bin/sh ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -g -O2
-MT snappy.lo -MD -MP -MF .deps/snappy.T
po -c -o snappy.lo snappy.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy.lo -MD -MP -MF
.deps/snappy.Tpo -c snappy.cc -DDLL_EXPORT
-DPIC -o .libs/snappy.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy.lo -MD -MP -MF
.deps/snappy.Tpo -c snappy.cc -o snappy.o >/
dev/null 2>&1
mv -f .deps/snappy.Tpo .deps/snappy.Plo
/bin/sh ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -g -O2
-MT snappy-sinksource.lo -MD -MP -MF .de
ps/snappy-sinksource.Tpo -c -o snappy-sinksource.lo snappy-sinksource.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-sinksource.lo -MD
-MP -MF .deps/snappy-sinksource.Tpo -c sn
appy-sinksource.cc -DDLL_EXPORT -DPIC -o .libs/snappy-sinksource.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-sinksource.lo -MD
-MP -MF .deps/snappy-sinksource.Tpo -c sn
appy-sinksource.cc -o snappy-sinksource.o >/dev/null 2>&1
mv -f .deps/snappy-sinksource.Tpo .deps/snappy-sinksource.Plo
/bin/sh ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -g -O2
-MT snappy-stubs-internal.lo -MD -MP -MF
.deps/snappy-stubs-internal.Tpo -c -o snappy-stubs-internal.lo snappy-stubs-internal.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-stubs-internal.lo
-MD -MP -MF .deps/snappy-stubs-internal.T
po -c snappy-stubs-internal.cc -DDLL_EXPORT -DPIC -o
.libs/snappy-stubs-internal.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-stubs-internal.lo
-MD -MP -MF .deps/snappy-stubs-internal.T
po -c snappy-stubs-internal.cc -o snappy-stubs-internal.o >/dev/null 2>&1
mv -f .deps/snappy-stubs-internal.Tpo .deps/snappy-stubs-internal.Plo
/bin/sh ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -g -O2
-MT snappy-c.lo -MD -MP -MF .deps/snappy
-c.Tpo -c -o snappy-c.lo snappy-c.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-c.lo -MD -MP -MF
.deps/snappy-c.Tpo -c snappy-c.cc -DDLL_E
XPORT -DPIC -o .libs/snappy-c.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-c.lo -MD -MP -MF
.deps/snappy-c.Tpo -c snappy-c.cc -o snapp
y-c.o >/dev/null 2>&1
mv -f .deps/snappy-c.Tpo .deps/snappy-c.Plo
/bin/sh ./libtool --tag=CXX --mode=link g++ -g -O2 -version-info 1:1:0 -o
libsnappy.la -rpath /usr/local/lib snappy.
lo snappy-sinksource.lo snappy-stubs-internal.lo snappy-c.lo -lz
libtool: link: warning: undefined symbols not allowed in i686-pc-mingw32 shared
libraries
libtool: link: ar cru .libs/libsnappy.a snappy.o snappy-sinksource.o
snappy-stubs-internal.o snappy-c.o
libtool: link: ranlib .libs/libsnappy.a
libtool: link: ( cd ".libs" && rm -f "libsnappy.la" && cp -p "../libsnappy.la"
"libsnappy.la" )
g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy_unittest-snappy_unittest.o -MD
-MP -MF .deps/snappy_unittest-snappy_unitt
est.Tpo -c -o snappy_unittest-snappy_unittest.o `test -f 'snappy_unittest.cc'
|| echo './'`snappy_unittest.cc
mv -f .deps/snappy_unittest-snappy_unittest.Tpo
.deps/snappy_unittest-snappy_unittest.Po
g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy_unittest-snappy-test.o -MD -MP
-MF .deps/snappy_unittest-snappy-test.Tpo
-c -o snappy_unittest-snappy-test.o `test -f 'snappy-test.cc' || echo
'./'`snappy-test.cc
mv -f .deps/snappy_unittest-snappy-test.Tpo .deps/snappy_unittest-snappy-test.Po
/bin/sh ./libtool --tag=CXX --mode=link g++ -g -O2 -o snappy_unittest.exe
snappy_unittest-snappy_unittest.o snappy_
unittest-snappy-test.o libsnappy.la -lz
libtool: link: g++ -g -O2 -o .libs/snappy_unittest.exe
snappy_unittest-snappy_unittest.o snappy_unittest-snappy-test.o
./.libs/libsnappy.a -lz
make[1]: Circular install-am <- all-am dependency dropped.
make[2]: Entering directory `/c/Users/fdmanana/git/snappy-1.0.1'
test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib"
/bin/sh ./libtool --mode=install /bin/install -c libsnappy.la '/usr/local/lib'
libtool: install: /bin/install -c .libs/libsnappy.lai
/usr/local/lib/libsnappy.la
libtool: install: /bin/install -c .libs/libsnappy.a /usr/local/lib/libsnappy.a
libtool: install: chmod 644 /usr/local/lib/libsnappy.a
libtool: install: ranlib /usr/local/lib/libsnappy.a
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-LLIBDIR' linker flag
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[2]: Circular all-am <- install dependency dropped.
make[3]: Entering directory `/c/Users/fdmanana/git/snappy-1.0.1'
test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib"
/bin/sh ./libtool --mode=install /bin/install -c libsnappy.la '/usr/local/lib'
libtool: install: /bin/install -c .libs/libsnappy.lai
/usr/local/lib/libsnappy.la
libtool: install: /bin/install -c .libs/libsnappy.a /usr/local/lib/libsnappy.a
libtool: install: chmod 644 /usr/local/lib/libsnappy.a
libtool: install: ranlib /usr/local/lib/libsnappy.a
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-LLIBDIR' linker flag
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[3]: Circular all-am <- install dependency dropped.
make[4]: Entering directory `/c/Users/fdmanana/git/snappy-1.0.1'
test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib"
/bin/sh ./libtool --mode=install /bin/install -c libsnappy.la '/usr/local/lib'
libtool: install: /bin/install -c .libs/libsnappy.lai
/usr/local/lib/libsnappy.la
libtool: install: /bin/install -c .libs/libsnappy.a /usr/local/lib/libsnappy.a
libtool: install: chmod 644 /usr/local/lib/libsnappy.a
libtool: install: ranlib /usr/local/lib/libsnappy.a
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-LLIBDIR' linker flag
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[4]: Circular all-am <- install dependency dropped.
make[5]: Entering directory `/c/Users/fdmanana/git/snappy-1.0.1'
test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib"
/bin/sh ./libtool --mode=install /bin/install -c libsnappy.la '/usr/local/lib'
libtool: install: /bin/install -c .libs/libsnappy.lai
/usr/local/lib/libsnappy.la
libtool: install: /bin/install -c .libs/libsnappy.a /usr/local/lib/libsnappy.a
libtool: install: chmod 644 /usr/local/lib/libsnappy.a
libtool: install: ranlib /usr/local/lib/libsnappy.a
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-LLIBDIR' linker flag
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[5]: Circular all-am <- install dependency dropped.
make[6]: Entering directory `/c/Users/fdmanana/git/snappy-1.0.1'
test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib"
/bin/sh ./libtool --mode=install /bin/install -c libsnappy.la '/usr/local/lib'
libtool: install: /bin/install -c .libs/libsnappy.lai
/usr/local/lib/libsnappy.la
libtool: install: /bin/install -c .libs/libsnappy.a /usr/local/lib/libsnappy.a
libtool: install: chmod 644 /usr/local/lib/libsnappy.a
libtool: install: ranlib /usr/local/lib/libsnappy.a
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-LLIBDIR' linker flag
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[6]: Circular all-am <- install dependency dropped.
make[7]: Entering directory `/c/Users/fdmanana/git/snappy-1.0.1'
test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib"
/bin/sh ./libtool --mode=install /bin/install -c libsnappy.la '/usr/local/lib'
libtool: install: /bin/install -c .libs/libsnappy.lai
/usr/local/lib/libsnappy.la
libtool: install: /bin/install -c .libs/libsnappy.a /usr/local/lib/libsnappy.a
libtool: install: chmod 644 /usr/local/lib/libsnappy.a
libtool: install: ranlib /usr/local/lib/libsnappy.a
If I abort the build, snappy_unittest.exe exists but doesn't work properly.
After a few tests are ran I get a Windows popup telling me the application
stopped working and asking me whether I want to stop it or debug it:
$ ./snappy_unittest.exe
Running microbenchmarks.
WARNING: Compiled with assertions enabled, will be slow.
Benchmark Time(ns) CPU(ns) Iterations
---------------------------------------------------
BM_UFlat/0 150517 150517 998 648.8MB/s html
BM_UFlat/1 1365600 1365600 110 490.3MB/s urls
BM_UFlat/2 90265 90264 1997 1.3GB/s jpg
BM_UFlat/3 110378 110378 998 815.0MB/s pdf
BM_UFlat/4 542951 542948 332 719.5MB/s html4
(it blocks after this)
On Cygwin I get:
fdmanana ~/snappy/snappy-1.0.1 > make
make all-am
make[1]: Entering directory `/home/fdmanana/snappy/snappy-1.0.1'
/bin/sh ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -g -O2
-MT snappy.lo -MD -MP -MF .deps/snappy.Tpo -c -o snappy.lo snappy.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy.lo -MD -MP -MF
.deps/snappy.Tpo -c snappy.cc -DDLL_EXPORT
-DPIC -o .libs/snappy.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy.lo -MD -MP -MF
.deps/snappy.Tpo -c snappy.cc -o snappy.o >/dev/null 2>&1
mv -f .deps/snappy.Tpo .deps/snappy.Plo
/bin/sh ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -g -O2
-MT snappy-sinksource.lo -MD -MP -MF .deps/snappy-sinksource.Tpo -c -o
snappy-sinksource.lo snappy-sinksource.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-sinksource.lo -MD
-MP -MF .deps/snappy-sinksource.Tpo -c snappy-sinksource.cc -DDLL_EXPORT -DPIC
-o .libs/snappy-sinksource.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-sinksource.lo -MD
-MP -MF .deps/snappy-sinksource.Tpo -c snappy-sinksource.cc -o
snappy-sinksource.o >/dev/null 2>&1
mv -f .deps/snappy-sinksource.Tpo .deps/snappy-sinksource.Plo
/bin/sh ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -g -O2
-MT snappy-stubs-internal.lo -MD -MP -MF .deps/snappy-stubs-internal.Tpo -c -o
snappy-stubs-internal.lo snappy-stubs-internal.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-stubs-internal.lo
-MD -MP -MF .deps/snappy-stubs-internal.Tpo -c snappy-stubs-internal.cc
-DDLL_EXPORT -DPIC -o .libs/snappy-stubs-internal.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-stubs-internal.lo
-MD -MP -MF .deps/snappy-stubs-internal.Tpo -c snappy-stubs-internal.cc -o
snappy-stubs-internal.o >/dev/null 2>&1
mv -f .deps/snappy-stubs-internal.Tpo .deps/snappy-stubs-internal.Plo
/bin/sh ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -g -O2
-MT snappy-c.lo -MD -MP -MF .deps/snappy-c.Tpo -c -o snappy-c.lo snappy-c.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-c.lo -MD -MP -MF
.deps/snappy-c.Tpo -c snappy-c.cc -DDLL_EXPORT -DPIC -o .libs/snappy-c.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-c.lo -MD -MP -MF
.deps/snappy-c.Tpo -c snappy-c.cc -o snappy-c.o >/dev/null 2>&1
mv -f .deps/snappy-c.Tpo .deps/snappy-c.Plo
/bin/sh ./libtool --tag=CXX --mode=link g++ -g -O2 -version-info 1:1:0 -o
libsnappy.la -rpath /usr/local/lib snappy.lo snappy-sinksource.lo
snappy-stubs-internal.lo snappy-c.lo -llzo2 -lz
libtool: link: warning: undefined symbols not allowed in i686-pc-cygwin shared
libraries
libtool: link: ar cru .libs/libsnappy.a snappy.o snappy-sinksource.o
snappy-stubs-internal.o snappy-c.o
libtool: link: ranlib .libs/libsnappy.a
libtool: link: ( cd ".libs" && rm -f "libsnappy.la" && ln -s "../libsnappy.la"
"libsnappy.la" )
g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy_unittest-snappy_unittest.o -MD
-MP -MF .deps/snappy_unittest-snappy_unittest.Tpo -c -o
snappy_unittest-snappy_unittest.o `test -f 'snappy_unittest.cc' || echo
'./'`snappy_unittest.cc
mv -f .deps/snappy_unittest-snappy_unittest.Tpo
.deps/snappy_unittest-snappy_unittest.Po
g++ -DHAVE_CONFIG_H -I. -g -O2 -MT snappy_unittest-snappy-test.o -MD -MP
-MF .deps/snappy_unittest-snappy-test.Tpo
-c -o snappy_unittest-snappy-test.o `test -f 'snappy-test.cc' || echo
'./'`snappy-test.cc
In file included from
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/stl_algo.h:66,
from /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/algorithm:67,
from snappy-test.cc:37:
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/algorithmfwd.h:248:41:
error: macro "max" passed 3 arguments, but takes just 2
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/algorithmfwd.h:259:41:
error: macro "min" passed 3 arguments, but takes just 2
In file included from
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/stl_algo.h:66,
from /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/algorithm:67,
from snappy-test.cc:37:
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/algorithmfwd.h:244: error:
expected unqualified-id before 'const'
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/algorithmfwd.h:244: error:
expected `)' before 'const'
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/algorithmfwd.h:244: error:
expected `)' before 'const'
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/algorithmfwd.h:244: error:
expected initializer before 'const'
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/algorithmfwd.h:248: error:
template declaration of 'const _Tp& std::max'
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/algorithmfwd.h:255: error:
expected unqualified-id before 'const'
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/algorithmfwd.h:255: error:
expected `)' before 'const'
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/algorithmfwd.h:255: error:
expected `)' before 'const'
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/algorithmfwd.h:255: error:
expected initializer before 'const'
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/algorithmfwd.h:259: error:
template declaration of 'const _Tp& std::min'
In file included from
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/algorithm:67,
from snappy-test.cc:37:
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/stl_algo.h: In function
'void std::__merge_sort_loop(_RandomAccessIterator1, _RandomAccessIterator1,
_RandomAccessIterator2, _Distance)':
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/stl_algo.h:2884: error:
expected unqualified-id before '(' token
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/stl_algo.h: In function
'void std::__merge_sort_loop(_RandomAccessIterator1, _RandomAccessIterator1,
_RandomAccessIterator2, _Distance, _Compare)':
/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/stl_algo.h:2908: error:
expected unqualified-id before '(' token
make[1]: *** [snappy_unittest-snappy-test.o] Error 1
make[1]: Leaving directory `/home/fdmanana/snappy/snappy-1.0.1'
make: *** [all] Error 2
fdmanana ~/snappy/snappy-1.0.1 >
Basically I can't seem to build snappy, including the unit tests, on Windows at
all.
Do you known of anyone (some open source project for e.g.) using snappy on
Windows?
thanks
[1] - http://suacommunity.com/dictionary/gettimeofday-entry.php
Original comment by fdman...@gmail.com
on 12 Apr 2011 at 1:25
Forgot to mention, this is on Windows 7 ultimate, 32bits edition.
Original comment by fdman...@gmail.com
on 12 Apr 2011 at 1:29
That page doesn't contain any licensing information, so it wouldn't be
applicable as far as I can see. In any case, it's probably better to make
snappy_unittest use some sort of native Windows timing function instead of
trying to emulate the semantics of gettimeofday() exactly.
I've cross-compiled Snappy from Linux using MinGW:
CC=i586-mingw32msvc-gcc CXX=i586-mingw32msvc-g++ ./configure
--host=i586-mingw32msvc
make
Others on e.g. the encode.ru forum have also reported success, but I'm not sure
if they've compiled the unit test or not.
I don't know where the MinGW unit test crash comes from (I guess that's what
you mean by “block”?); if you can track it down somehow, it would be great.
Same with the infinite loop during building, but that's most likely an automake
bug, nothing we can do much about.
The Cygwin issue is different; it's probably a case of the Windows macros doing
spurious defines of min() and max() etc.. Perhaps WIN32_LEAN_AND_MEAN would be
a good idea to avoid that kind of issue, or including the C++ headers before
windows.h.
Original comment by se...@google.com
on 12 Apr 2011 at 1:48
r29 includes #define WIN32_LEAN_AND_MEAN; see if it helps for Cygwin. (It
shouldn't make any change for missing gettimeofday under MSVC.)
Original comment by se...@google.com
on 15 Apr 2011 at 10:56
I'm also having a bit of trouble running the unit test under Windows.
I tried compiling on Windows using MSVC 2008 and can build a working library
with both 32 or 64 bit builds. I tested it by compressing and immediately
uncompressing a large stream of texture data as it is loading from disk.
As for the unit test, I substituted native Win32 QueryPerformanceCounter() for
gettimeofday() and __rdtsc() to replace getrusage(), and appropriate
calculations of time passed. However it fails while running the test
application. Debugging shows a divide by zero error:
Unhandled exception at 0x0145249b in snappy-test.exe: 0xC0000094: Integer
division by zero.
snappy-test.exe!_alldiv() Line 120 Asm
snappy-test.exe!RunSpecifiedBenchmarks() Line 432 C++
snappy-test.exe!main(int argc=1, char * * argv=0x00702918) Line 1139 C++
snappy-test.exe!__tmainCRTStartup() Line 266 + 0x19 bytes C
snappy-test.exe!mainCRTStartup() Line 182 C
I don't know if this information helps or not.
I'd be happy to help provide visual studio project files, and to help unify a
Windows alternative for timing in lieu of gettimeofday().
Original comment by rende...@gmail.com
on 16 Apr 2011 at 2:48
I don't see why you'd need to replace getrusage(); there's already code in
there to use GetProcessTimes() instead if WIN32 is set. (Using RDTSC is not
suitable for this.) QueryPerformanceCounter() is probably the simplest
replacement for gettimeofday() here, but if you get a division by zero, most
likely that's a bug in the timing code somehow.
Original comment by se...@google.com
on 16 Apr 2011 at 12:50
r30 should compile with MSVC.
Original comment by se...@google.com
on 26 Apr 2011 at 12:39
I was able to build snappy 1.0.5 in Cygwin environment and run tests
successfully after making these two changes: 1) Besides WIN32_LEAN_AND_MEAN,
#define NOMINMAX is required before including windows.h in snappy-test.h 2)For
printing benchmark results in Benchmark::Run() the format string does not need
to be special cased using #ifdef WIN32. The special cased format string does
not work for Cygwin environment, and in fact causes core dump. The standard
format string works.
Original comment by prakash....@gmail.com
on 29 Mar 2012 at 10:44
For anyone reading this and looking to build Snappy in MSVC: I have what's
probably the most current and most complete Snappy port for Windows. It's all
MSVC based and includes .NET wrapper and NuGet packaging. Tests pass and
performance is great. If you need source code mods, try to fork my project.
It's most likely the easiest way to get started.
http://snappy.angeloflogic.com/
Original comment by robert.v...@gmail.com
on 6 Mar 2014 at 10:04
Original issue reported on code.google.com by
fil...@couchone.com
on 11 Apr 2011 at 12:53Attachments: