Hello!

I've been attempting to cross-compile CockroachDB to Windows using
mingw-w64. The compilation strategy used for CockroachDB involves
producing static archives with missing symbols (this is due to how
golang's tooling compiles c/c++ code).

In our linux builds, we pass `-Wl,--unresolved-symbols=ignore-all` to
the compiler to silence these unresolved symbols warnings in our
intermediate static archives - however, it seems that mingw-w64's g++
binary (`x86_64-w64-mingw32-g++-posix` is the one I've tested) doesn't
respect this flag.

Does anyone know why this might be, or where to begin investigating?

More detail is here:
https://github.com/karalabe/xgo/issues/26#issuecomment-214521117

Our build output  ends up with:
```
x86_64-w64-mingw32-g++-posix -I . -m64 -mthreads -fmessage-length=0
-Iinternal -Iinternal/include -Iinternal/db -Iinternal/util
-Iinternal/utilities/merge_operators/string_append
-I../../cockroachdb/c-snappy/internal -DNDEBUG -DSNAPPY -DOS_WIN -I
$WORK/github.com/cockroachdb/c-rocksdb/_obj/ -D_WIN32_WINNT=0x0600
-std=c++11 -fno-omit-frame-pointer -momit-leaf-frame-pointer -o
$WORK/github.com/cockroachdb/c-rocksdb/_obj/port_platform.cc.o -c
./port_platform.cc
x86_64-w64-mingw32-g++-posix -I . -m64 -mthreads -fmessage-length=0 -o
$WORK/github.com/cockroachdb/c-rocksdb/_obj/_cgo_.o
$WORK/github.com/cockroachdb/c-rocksdb/_obj/_cgo_main.o <long list of
input files> -g -O2 -Wl,--unresolved-symbols=ignore-all -lrpcrt4
# github.com/cockroachdb/c-rocksdb
/tmp/go-build123696693/github.com/cockroachdb/c-rocksdb/_obj/internal_table_block_based_table_builder.cc.o:internal_table_block_based_table_builder.cc:(.text$_ZN7rocksdb15Snappy_CompressERKNS_18CompressionOptionsEPKcyPSs[_ZN7rocksdb15Snappy_CompressERKNS_18CompressionOptionsEPKcyPSs]+0x20):
undefined reference to `snappy::MaxCompressedLength(unsigned long
long)'
/tmp/go-build123696693/github.com/cockroachdb/c-rocksdb/_obj/internal_table_block_based_table_builder.cc.o:internal_table_block_based_table_builder.cc:(.text$_ZN7rocksdb15Snappy_CompressERKNS_18CompressionOptionsEPKcyPSs[_ZN7rocksdb15Snappy_CompressERKNS_18CompressionOptionsEPKcyPSs]+0x5a):
undefined reference to `snappy::RawCompress(char const*, unsigned long
long, char*, unsigned long long*)'
/tmp/go-build123696693/github.com/cockroachdb/c-rocksdb/_obj/internal_table_format.cc.o:internal_table_format.cc:(.text$_ZN7rocksdb28Snappy_GetUncompressedLengthEPKcyPy[_ZN7rocksdb28Snappy_GetUncompressedLengthEPKcyPy]+0x27):
undefined reference to `snappy::GetUncompressedLength(char const*,
unsigned long long, unsigned long long*)'
/tmp/go-build123696693/github.com/cockroachdb/c-rocksdb/_obj/internal_table_format.cc.o:internal_table_format.cc:(.text$_ZN7rocksdb17Snappy_UncompressEPKcyPc[_ZN7rocksdb17Snappy_UncompressEPKcyPc]+0x27):
undefined reference to `snappy::RawUncompress(char const*, unsigned
long long, char*)'
collect2: error: ld returned 1 exit status
2016/04/25 17:01:39 Failed to cross compile package: exit status 2.
```

Thanks in advance for your help!

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to