Does anybody have experience setting up cockroach db dev env on Windows?

298 views
Skip to first unread message

Guruprasad Baskaran

unread,
Jun 22, 2015, 2:42:26 AM6/22/15
to cockro...@googlegroups.com


Unfortunately for most of my working day I am stuck with a windows laptop ( Win 8.1). Before trying a ubuntu VM kind of solution on windows I wanted to see if I could get cockroach compiling on either cygwin or mingw32. 

On Cygwin ,there is no stable version of GO( only experimental) , So I tried using the windows version of Go and cygwin shell + other tools on cygwin ( e.g gcc, make , git etc) but with no luck . I run into weird errors - Example  git complains sync.go has changed in glock and asks me to stash changes before proceeding. But when I do a git diff nothing has changed. I have no clue what is going on.


And Ming32-make can't handle spaces in the names and Git, Hg ,Go etc are all installed in Program Files. I could keep all dependencies in paths with no spaces , but that is too much work since my other projects also need these tools and it is a little difficult to work around every issue the arises because of space in paths.


Any pointers would be appreciated. If not I'll just go the VM route


Thanks
Guru


Bram Gruneir

unread,
Jun 22, 2015, 9:55:49 AM6/22/15
to Guruprasad Baskaran, cockro...@googlegroups.com
Hey Guru,

I've tried a number of times and came fairly close to getting the dev environment working in both cygwin or some of the different  environment installers for mingw out there.  But the last time I tried was about 4 months ago.

An ubuntu VM would work, but it's not a good solution.

I'll give it a another shot and see if I can sort out what's wrong.  But sadly right now it's not a priority right now, so it might take a bit of time.

Cheers,
Bram



--
You received this message because you are subscribed to the Google Groups "Cockroach DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cockroach-db...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Guruprasad Baskaran

unread,
Jun 22, 2015, 11:37:07 AM6/22/15
to Bram Gruneir, cockro...@googlegroups.com
Thanks Bram. I'll keep ploughing through it too and will update this thread if I can get it working

Guruprasad Baskaran

unread,
Jun 23, 2015, 2:04:38 AM6/23/15
to cockro...@googlegroups.com
I got "go get" to download all dependencies on cygwin and when I try to do a make build , I get a couple of category of errors 

1) gcc warnings in various dependencies which get treated as errors ( I assume I can use some flag on gcc to ignore these warnings? ) 
2) Errors like "skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc_s.dll.a when searching for -lgcc_s" . I have bolded them in the below logs

Any pointers? I'll continue to try and find what the issues are and fix them.


PS: I am using Windows Go (not compiled for Cygwin) for running the build from within Cygwin.

My GCC version is 
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-4.9.2-3.x86_64/src/gcc-4.9.2/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-4.9.2-3.x86_64/src/gcc-4.9.2 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --libdir=/usr/lib --datarootdir=/usr/share --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id
Thread model: posix
gcc version 4.9.2 (GCC) 

Build Logs

go build -tags ''  -ldflags '-X github.com/cockroachdb/cockroach/util.buildTag "alpha-3117-g11b198b" -X github.com/cockroachdb/cockroach/util.buildTime "2015/06/23 05:51:49" -X github.com/cockroachdb/cockroach/util.buildDeps "/home/guruprasad.baskaran/go_progs/src/github.com/biogo/store:e1f74b3c58befe661feed7fa4cf52436de753128 /home/guruprasad.baskaran/go_progs/src/github.com/cockroachdb/c-lz4:6e71f140a365017bbe0904710007f8725fd3f809 /home/guruprasad.baskaran/go_progs/src/github.com/cockroachdb/cockroach:11b198b258179d1802fcc224e38df92a641cde0e /home/guruprasad.baskaran/go_progs/src/github.com/cockroachdb/c-protobuf:0f9ab7b988ca7474cf76b9a961ab03c0552abcb3 /home/guruprasad.baskaran/go_progs/src/github.com/cockroachdb/c-rocksdb:e120ce0fb32f86b94188928743270ea11ff016b3 /home/guruprasad.baskaran/go_progs/src/github.com/cockroachdb/c-snappy:618733f9e5bab8463b9049117a335a7a1bfc9fd5 /home/guruprasad.baskaran/go_progs/src/github.com/coreos/etcd:e0d5116683fff864a8452709f4ff30d902ac50df /home/guruprasad.baskaran/go_progs/src/github.com/elazarl/go-bindata-assetfs:bea323321994103859d60197d229f1a94699dde3 /home/guruprasad.baskaran/go_progs/src/github.com/gogo/protobuf:fc8a6f73d3345eeceb47608c782bf9419f567721 /home/guruprasad.baskaran/go_progs/src/github.com/google/btree:cc6329d4279e3f025a53a83c397d2339b5705c45 /home/guruprasad.baskaran/go_progs/src/github.com/inconshreveable/mousetrap:76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 /home/guruprasad.baskaran/go_progs/src/github.com/julienschmidt/httprouter:8c199fb6259ffc1af525cc3ad52ee60ba8359669 /home/guruprasad.baskaran/go_progs/src/github.com/montanaflynn/stats:865cbddaa09b007a576e74ea5b1c2af2e5b52490 /home/guruprasad.baskaran/go_progs/src/github.com/spf13/cobra:312092086bed4968099259622145a0c9ae280064 /home/guruprasad.baskaran/go_progs/src/github.com/spf13/pflag:5644820622454e71517561946e3d94b9f9db6842 /home/guruprasad.baskaran/go_progs/src/golang.org/x/net:dfe268fd2bb5c793f4c083803609fce9806c6f80 /home/guruprasad.baskaran/go_progs/src/gopkg.in/yaml.v1:9f9df34309c04878acc86042b16630b0f696e1de"' -v -i -o cockroach
In file included from internal/src/google/protobuf/any.h:36:0,
                 from ..\c-protobuf\any.cc:31:
internal/src/google/protobuf/stubs/common.h:207:48: warning: overflow in implicit constant conversion [-Woverflow]
 static const int64 kint64max = GOOGLE_LONGLONG(0x7FFFFFFFFFFFFFFF);
                                                ^
internal/src/google/protobuf/stubs/common.h:200:28: note: in definition of macro ‘GOOGLE_LONGLONG’
 #define GOOGLE_LONGLONG(x) x##LL
                            ^
internal/src/google/protobuf/stubs/common.h:210:51: warning: large integer implicitly truncated to unsigned type [-Woverflow]
 static const uint64 kuint64max = GOOGLE_ULONGLONG(0xFFFFFFFFFFFFFFFF);
                                                   ^
internal/src/google/protobuf/stubs/common.h:201:29: note: in definition of macro ‘GOOGLE_ULONGLONG’
 #define GOOGLE_ULONGLONG(x) x##ULL
                             ^
In file included from internal/src/google/protobuf/arena.h:39:0,
                 from internal/src/google/protobuf/arenastring.h:39,
                 from internal/src/google/protobuf/any.h:37,
                 from ..\c-protobuf\any.cc:31:
internal/src/google/protobuf/stubs/atomic_sequence_num.h: In member function ‘google::protobuf::internal::AtomicWord google::protobuf::internal::SequenceNumber::GetNext()’:
internal/src/google/protobuf/stubs/atomic_sequence_num.h:44:47: error: invalid conversion from ‘google::protobuf::internal::AtomicWord* {aka long int*}’ to ‘volatile Atomic32* {aka volatile int*}’ [-fpermissive]
     return NoBarrier_AtomicIncrement(&word_, 1) - 1;
                                               ^
In file included from internal/src/google/protobuf/stubs/atomicops.h:203:0,
                 from internal/src/google/protobuf/stubs/atomic_sequence_num.h:33,
                 from internal/src/google/protobuf/arena.h:39,
                 from internal/src/google/protobuf/arenastring.h:39,
                 from internal/src/google/protobuf/any.h:37,
                 from ..\c-protobuf\any.cc:31:
internal/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h:75:17: note: initializing argument 1 of ‘google::protobuf::internal::Atomic32 google::protobuf::internal::NoBarrier_AtomicIncrement(volatile Atomic32*, google::protobuf::internal::Atomic32)’
 inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
                 ^
In file included from internal/src/google/protobuf/generated_message_util.h:44:0,
                 from internal/src/google/protobuf/arenastring.h:40,
                 from internal/src/google/protobuf/any.h:37,
                 from ..\c-protobuf\any.cc:31:
internal/src/google/protobuf/stubs/once.h: In function ‘void google::protobuf::GoogleOnceInit(google::protobuf::ProtobufOnceType*, void (*)())’:
internal/src/google/protobuf/stubs/once.h:125:34: error: invalid conversion from ‘google::protobuf::ProtobufOnceType* {aka long int*}’ to ‘const volatile Atomic32* {aka const volatile int*}’ [-fpermissive]
   if (internal::Acquire_Load(once) != ONCE_STATE_DONE) {
                                  ^
In file included from internal/src/google/protobuf/stubs/atomicops.h:203:0,
                 from internal/src/google/protobuf/stubs/atomic_sequence_num.h:33,
                 from internal/src/google/protobuf/arena.h:39,
                 from internal/src/google/protobuf/arenastring.h:39,
                 from internal/src/google/protobuf/any.h:37,
                 from ..\c-protobuf\any.cc:31:
internal/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h:163:17: note: initializing argument 1 of ‘google::protobuf::internal::Atomic32 google::protobuf::internal::Acquire_Load(const volatile Atomic32*)’
 inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
                 ^
In file included from internal/include/rocksdb/status.h:21:0,
                 from internal/include/rocksdb/listener.h:11,
                 from internal/include/rocksdb/options.h:22,
                 from internal/table/adaptive_table_factory.h:10,
                 from ..\c-rocksdb\adaptive_table_factory.cc:6:
internal/include/rocksdb/slice.h: In member function ‘std::string rocksdb::Slice::ToString(bool) const’:
internal/include/rocksdb/slice.h:81:58: error: ‘snprintf’ was not declared in this scope
         snprintf(buf, 10, "%02X", (unsigned char)data_[i]);
                                                          ^
In file included from internal/table/adaptive_table_factory.h:10:0,
                 from ..\c-rocksdb\adaptive_table_factory.cc:6:
internal/include/rocksdb/options.h: At global scope:
internal/include/rocksdb/options.h:1189:75: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
                           uint64_t target_db_size = 68719476736 /* 64GB */);
                                                                           ^
In file included from internal/include/rocksdb/table.h:23:0,
                 from internal/table/adaptive_table_factory.h:11,
                 from ..\c-rocksdb\adaptive_table_factory.cc:6:
internal/include/rocksdb/env.h: In member function ‘virtual void rocksdb::Logger::Logv(rocksdb::InfoLogLevel, const char*, va_list)’:
internal/include/rocksdb/env.h:655:53: error: ‘snprintf’ was not declared in this scope
                kInfoLogLevelNames[log_level], format);
                                                     ^
..\c-rocksdb\adaptive_table_factory.cc: In member function ‘virtual std::string rocksdb::AdaptiveTableFactory::GetPrintableTableOptions() const’:
..\c-rocksdb\adaptive_table_factory.cc:86:73: error: ‘snprintf’ was not declared in this scope
              table_factory_to_write_->GetPrintableTableOptions().c_str());
                                                                         ^
..\c-rocksdb\adaptive_table_factory.cc:92:70: error: ‘snprintf’ was not declared in this scope
              plain_table_factory_->GetPrintableTableOptions().c_str());
                                                                      ^
..\c-rocksdb\adaptive_table_factory.cc:98:76: error: ‘snprintf’ was not declared in this scope
              block_based_table_factory_->GetPrintableTableOptions().c_str());
                                                                            ^
..\c-rocksdb\adaptive_table_factory.cc:104:71: error: ‘snprintf’ was not declared in this scope
              cuckoo_table_factory_->GetPrintableTableOptions().c_str());
                                                                       ^
cc1plus: all warnings being treated as errors
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../libcygwin.a when searching for -lcygwin
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../libcygwin.a when searching for -lcygwin
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../libcygwin.a when searching for -lcygwin
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lcygwin
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -ladvapi32
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lshell32
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -luser32
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lkernel32
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status
In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/random:49:0,
                 from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/bits/stl_algo.h:66,
                 from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/algorithm:62,
                 from ..\c-snappy\snappy-stubs-internal.cc:29:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/bits/random.h:106:26: error: expected unqualified-id before ‘__int128’
       { typedef unsigned __int128 type; };
                          ^
Makefile:70: recipe for target 'build' failed
make: *** [build] Error 2

Daniel Theophanes

unread,
Jun 23, 2015, 9:07:41 AM6/23/15
to Guruprasad Baskaran, cockro...@googlegroups.com
Two observations:
 * I've never heard of go running in cygwin correctly. I wouldn't even bother that route.
 * the specific error "skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc_s.dll.a when searching for -lgcc_s" has to do with how you installed gcc. Do you have a windows box? I'd suggest using mingw, perhaps from msys2.

-Daniel


Guruprasad Baskaran

unread,
Jun 23, 2015, 11:38:17 AM6/23/15
to Daniel Theophanes, cockro...@googlegroups.com
Thanks.yes I do have a windows box. I'll proceed with the mingw route.

Anyway meanwhile I got a free tier AWS EC2 instance going and the build works like a charm on linux.

Ben Darnell

unread,
Jun 23, 2015, 12:03:32 PM6/23/15
to Guruprasad Baskaran, cockro...@googlegroups.com
On Tue, Jun 23, 2015 at 2:04 AM, Guruprasad Baskaran <guruprasa...@gmail.com> wrote:
I got "go get" to download all dependencies on cygwin and when I try to do a make build , I get a couple of category of errors 

1) gcc warnings in various dependencies which get treated as errors ( I assume I can use some flag on gcc to ignore these warnings? ) 
2) Errors like "skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc_s.dll.a when searching for -lgcc_s" . I have bolded them in the below logs

Any pointers? I'll continue to try and find what the issues are and fix them.

In our build system we wrap C libraries in a CGO-based build (so we're compatible with `go get`) instead of using their own configure/make scripts (these are the cockroachdb/c-* repos). In each repo there is a cgo_flags.go file which defines the flags that a configure script would use:

To build on windows we'll need to add some `#cgo windows` lines to define the flags that we need there.

-Ben
 

Guruprasad Baskaran

unread,
Jun 24, 2015, 7:47:53 AM6/24/15
to Ben Darnell, cockro...@googlegroups.com
Thanks Ben. I set up msys2 instead of cygwin and git for windows (instead of regular git from the original source because it does not support symlinks) and got go to clone and get all dependencies fine. 

Now I am stuck at cgo part of the build where go is not able to find C / C++ functions , pasting the error message here in case I am doing something obviously wrong.

New to golang , so will play around some more with cgo to see if I can figure it out


The cgo flags for example for c-snappy seem platform independent, so do we still need any  'windows' specific  stuff in there for it to work?

// Package snappy uses the cgo compilation facilities to build the
// Snappy C++ library.
package snappy

// #cgo CXXFLAGS: -std=c++11
// #cgo CPPFLAGS: -DHAVE_CONFIG_H -Iinternal
import "C"


But when I try to do a go build on just c-snappy I get ( error in red below)


WORK=C:\Users\guruprasad.baskaran\programs\mysys\tmp\go-build829063039
mkdir -p $WORK\github.com\cockroachdb\c-snappy\_obj\
mkdir -p $WORK\github.com\cockroachdb\
cd C:\Users\guruprasad.baskaran\programs\mysys\home\guruprasad.baskaran\go_progs\src\github.com\cockroachdb\c-snappy
CGO_LDFLAGS="-g" "-O2" "C:\\Users\\guruprasad.baskaran\\programs\\go\\pkg\\tool\\windows_amd64\\cgo.exe" -objdir "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\" -- -DHAVE_CONFIG_H -Iinternal -I "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\" cgo_flags.go decode.go encode.go
"C:\\Users\\guruprasad.baskaran\\programs\\go\\pkg\\tool\\windows_amd64\\6c.exe" -F -V -w -trimpath "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039" -I "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\" -I "C:\\Users\\guruprasad.baskaran\\programs\\go\\pkg\\windows_amd64" -o "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\_cgo_defun.6" -D GOOS_windows -D GOARCH_amd64 "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\_cgo_defun.c"
gcc -I "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\home\\guruprasad.baskaran\\go_progs\\src\\github.com\\cockroachdb\\c-snappy" -m64 -mthreads -fmessage-length=0 -print-libgcc-file-name
gcc -I "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\home\\guruprasad.baskaran\\go_progs\\src\\github.com\\cockroachdb\\c-snappy" -m64 -mthreads -fmessage-length=0 -DHAVE_CONFIG_H -Iinternal -I "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\" -g -O2 -o "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\_cgo_main.o" -c "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\_cgo_main.c"
gcc -I "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\home\\guruprasad.baskaran\\go_progs\\src\\github.com\\cockroachdb\\c-snappy" -m64 -mthreads -fmessage-length=0 -DHAVE_CONFIG_H -Iinternal -I "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\" -g -O2 -o "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\_cgo_export.o" -c "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\_cgo_export.c"
gcc -I "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\home\\guruprasad.baskaran\\go_progs\\src\\github.com\\cockroachdb\\c-snappy" -m64 -mthreads -fmessage-length=0 -DHAVE_CONFIG_H -Iinternal -I "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\" -g -O2 -o "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\cgo_flags.cgo2.o" -c "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\cgo_flags.cgo2.c"
gcc -I "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\home\\guruprasad.baskaran\\go_progs\\src\\github.com\\cockroachdb\\c-snappy" -m64 -mthreads -fmessage-length=0 -DHAVE_CONFIG_H -Iinternal -I "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\" -g -O2 -o "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\decode.cgo2.o" -c "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\decode.cgo2.c"
gcc -I "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\home\\guruprasad.baskaran\\go_progs\\src\\github.com\\cockroachdb\\c-snappy" -m64 -mthreads -fmessage-length=0 -DHAVE_CONFIG_H -Iinternal -I "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\" -g -O2 -o "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\encode.cgo2.o" -c "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\encode.cgo2.c"
gcc -I "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\home\\guruprasad.baskaran\\go_progs\\src\\github.com\\cockroachdb\\c-snappy" -m64 -mthreads -fmessage-length=0 -o "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\_cgo_.o" "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\_cgo_main.o" "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\_cgo_export.o" "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\cgo_flags.cgo2.o" "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\decode.cgo2.o" "C:\\Users\\guruprasad.baskaran\\programs\\mysys\\tmp\\go-build829063039\\github.com\\cockroachdb\\c-snappy\\_obj\\encode.cgo2.o" -g -O2
C:\Users\guruprasad.baskaran\programs\mysys\tmp\go-build829063039\github.com\cockroachdb\c-snappy\_obj\decode.cgo2.o: In function `_cgo_ec23c7107ae5_Cfunc_snappy_uncompress':
C:/Users/guruprasad.baskaran/programs/mysys/home/guruprasad.baskaran/go_progs/src/github.com/cockroachdb/c-snappy/decode.go:51: undefined reference to `snappy_uncompress'
C:\Users\guruprasad.baskaran\programs\mysys\tmp\go-build829063039\github.com\cockroachdb\c-snappy\_obj\encode.cgo2.o: In function `_cgo_ec23c7107ae5_Cfunc_snappy_compress':
C:/Users/guruprasad.baskaran/programs/mysys/home/guruprasad.baskaran/go_progs/src/github.com/cockroachdb/c-snappy/encode.go:49: undefined reference to `snappy_compress'
collect2.exe: error: ld returned 1 exit status



Ben Darnell

unread,
Jun 24, 2015, 10:02:00 AM6/24/15
to Guruprasad Baskaran, cockro...@googlegroups.com
It looks like it's not even trying to compile snappy-c.cc where snappy_compress and snappy_uncompress are defined. Those files are symlinks; do symlinks work properly on windows with this toolchain?

Guruprasad Baskaran

unread,
Jun 24, 2015, 12:54:16 PM6/24/15
to Ben Darnell, cockro...@googlegroups.com

Looks like symlinks were the problem. On Windows , git just creates a regular text file with the path to the actual file in it. Because of elevated access requirements for creating a ntfs symlinks, git doesn't support it out of the box. There are workarounds .  After I tried the workaround on windows for symlinks and ran configure to regenerate config.h , at least I got c-snappy working. I'll try the rest and see if it all works. 

Thanks

Guruprasad Baskaran

unread,
Jun 25, 2015, 4:48:58 AM6/25/15
to Ben Darnell, cockro...@googlegroups.com
Looks like I have hit a dead end, Rocks DB does not compile on MSYS2(MINGW64_NT) , but does compile on Cygwin. Whereas there is no Golang ( at least stable) for Cywgin. 

Daniel Theophanes

unread,
Jun 25, 2015, 11:03:22 AM6/25/15
to Guruprasad Baskaran, Ben Darnell, cockro...@googlegroups.com

Guruprasad Baskaran

unread,
Jun 26, 2015, 1:10:01 AM6/26/15
to Daniel Theophanes, Ben Darnell, cockro...@googlegroups.com
Thanks. But that is for compiling rocks-db on cygwin ( which is an almost POSIX compliant env using cygwin.dll), so it has stuff like sys/mman.h ( for memory mapping etc). Rocks DB is dependent on such APIs. I am using MINGW/MYSYS environment which provides no POSIX compliance and uses Windows native APIs , so rocks-db build breaks.

Golang for windows is built on MINGW and I did not find any stable golang for Cygwin.

So I guess I'll stop my efforts on this for now , unless somebody knows a way around.

Instead I'll try to build a basic Java client for cockroach.




Reply all
Reply to author
Forward
0 new messages