Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

Missing symbols when cross compiling for windows #26

Closed
tamird opened this issue Oct 28, 2015 · 28 comments
Closed

Missing symbols when cross compiling for windows #26

tamird opened this issue Oct 28, 2015 · 28 comments

Comments

@tamird
Copy link
Contributor

tamird commented Oct 28, 2015

Update: there appears to be a bug upstream (in mingw-w64) https://sourceforge.net/p/mingw-w64/bugs/535/.

Currently, it appears that the cgo linker option -Wl,-unresolved-symbols=ignore-all isn't behaving correctly.

@karalabe
Copy link
Owner

I haven't updated the base distro for a while, maybe it's just an older version of the mingw that doesn't contain this feature yet. I'll try to redo the images using a fresh base image and see where it gets me.

@karalabe
Copy link
Owner

I've updated the base images, but my windows compilation now fails with:

Compiling for windows/amd64...
# github.com/cockroachdb/c-snappy
In file included from ../c-snappy/snappy-stubs-internal.cc:32:0:
internal/snappy-stubs-internal.h:45:22: fatal error: sys/mman.h: No such file or directory
 #include <sys/mman.h>

Did you also encounter this, or is this a new error message already past the ones you reported?

@tamird
Copy link
Contributor Author

tamird commented Oct 30, 2015

@karalabe Yeah, I encountered that as well, and it's a separate issue; you should apply this modification: cockroachdb/c-snappy#5

@karalabe
Copy link
Owner

Ah yeah, with those two patches I'm at

Compiling for windows/amd64...
# github.com/cockroachdb/c-rocksdb
In file included from internal/port/port.h:20:0,
                 from ./adaptive_table_factory.cc:9:
internal/port/win/port_win.h:119:20: error: 'mutex' is not a member of 'std'
   std::unique_lock<std::mutex>& getLock() { return lock; }
                    ^
internal/port/win/port_win.h:119:20: error: 'mutex' is not a member of 'std'
internal/port/win/port_win.h:119:30: error: template argument 1 is invalid
   std::unique_lock<std::mutex>& getLock() { return lock; }
                              ^
internal/port/win/port_win.h:123:8: error: 'mutex' in namespace 'std' does not name a type
   std::mutex m_mutex;
        ^
internal/port/win/port_win.h:124:20: error: 'mutex' is not a member of 'std'
   std::unique_lock<std::mutex> lock;
                    ^
internal/port/win/port_win.h:124:20: error: 'mutex' is not a member of 'std'
internal/port/win/port_win.h:124:30: error: template argument 1 is invalid
   std::unique_lock<std::mutex> lock;
                              ^
internal/port/win/port_win.h: In constructor 'rocksdb::port::RWMutex::RWMutex()':
internal/port/win/port_win.h:136:42: error: 'InitializeSRWLock' was not declared in this scope
   RWMutex() { InitializeSRWLock(&srwLock_); }
                                          ^
internal/port/win/port_win.h: In member function 'void rocksdb::port::RWMutex::ReadLock()':
internal/port/win/port_win.h:138:51: error: 'AcquireSRWLockShared' was not declared in this scope
   void ReadLock() { AcquireSRWLockShared(&srwLock_); }
                                                   ^
internal/port/win/port_win.h: In member function 'void rocksdb::port::RWMutex::WriteLock()':
internal/port/win/port_win.h:140:55: error: 'AcquireSRWLockExclusive' was not declared in this scope
   void WriteLock() { AcquireSRWLockExclusive(&srwLock_); }
                                                       ^
internal/port/win/port_win.h: In member function 'void rocksdb::port::RWMutex::ReadUnlock()':
internal/port/win/port_win.h:142:53: error: 'ReleaseSRWLockShared' was not declared in this scope
   void ReadUnlock() { ReleaseSRWLockShared(&srwLock_); }
                                                     ^
internal/port/win/port_win.h: In member function 'void rocksdb::port::RWMutex::WriteUnlock()':
internal/port/win/port_win.h:144:57: error: 'ReleaseSRWLockExclusive' was not declared in this scope
   void WriteUnlock() { ReleaseSRWLockExclusive(&srwLock_); }
                                                         ^
internal/port/win/port_win.h: At global scope:
internal/port/win/port_win.h:166:8: error: 'condition_variable' in namespace 'std' does not name a type
   std::condition_variable cv_;
        ^
internal/port/win/port_win.h:170:14: error: 'once_flag' in namespace 'std' does not name a type
 typedef std::once_flag OnceType;
              ^
internal/port/win/port_win.h:172:22: error: variable or field 'InitOnce' declared void
 extern void InitOnce(OnceType* once, void (*initializer)());
                      ^
internal/port/win/port_win.h:172:22: error: 'OnceType' was not declared in this scope
internal/port/win/port_win.h:172:32: error: 'once' was not declared in this scope
 extern void InitOnce(OnceType* once, void (*initializer)());
                                ^
internal/port/win/port_win.h:172:45: error: 'initializer' was not declared in this scope
 extern void InitOnce(OnceType* once, void (*initializer)());
                                             ^
2015/10/30 19:22:54 Failed to cross compile package: exit status 2.

I'll look into it. Have to run now.

@karalabe
Copy link
Owner

karalabe commented Nov 3, 2015

I've got past these error messages, but after crunching/compiling for 15-30 secs, it fails with

# github.com/cockroachdb/c-rocksdb
./env_posix.cc:19:23: fatal error: sys/ioctl.h: No such file or directory
 #include <sys/ioctl.h>

which is understandable, since there are no posix stuff available. Could you check why this file is getting included on the Windows builds?

@karalabe
Copy link
Owner

karalabe commented Nov 3, 2015

I've pushed out a new version with updates compilers and platform flags. Please allow a few hours for them to build, after which please try this Windows build. The above header issue should be in your code base.

@karalabe
Copy link
Owner

karalabe commented Nov 3, 2015

PS: You need to set --targets=windows-6.0/* to use the Vista APIs.

@tamird
Copy link
Contributor Author

tamird commented Nov 3, 2015

Looks like that file shouldn't be included at all. I've removed it and force-pushed the branch.

@karalabe
Copy link
Owner

karalabe commented Nov 3, 2015

Now it crunched for a lot longer, then hit:

# github.com/cockroachdb/c-rocksdb
In file included from ./port_posix.cc:10:0:
internal/port/port_posix.h:44:22: fatal error: endian.h: No such file or directory
   #include <endian.h>

Edit: i.e. again managed to mingle in some non Windows specific header.

@tamird
Copy link
Contributor Author

tamird commented Nov 3, 2015

This one's a bit trickier; the only way to get cgo to compile c/c++ code in general is to include (or symlink) the c/c++ files in your package's top level directory. In this case, port_posix.cc needs to be compiled when we're on a posix system but not when we're on a windows system.

This boils down to conditional compilation in cgo, which I'm not sure how to do. Do you have any ideas?

EDIT: turns out this is the same story for env_posix.cc; we need to compile it on posix systems or else we get missing symbol errors.

@karalabe
Copy link
Owner

karalabe commented Nov 3, 2015

Not really. Btw, just for the fun of it, I've removed that file for now, and then got till a linker failure:

/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/auto_roll_logger.cc.o:auto_roll_logger.cc:(.text+0x546): undefined reference to `rocksdb::port::Mutex::AssertHeld()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/auto_roll_logger.cc.o:auto_roll_logger.cc:(.text+0x75c): undefined reference to `rocksdb::port::Mutex::AssertHeld()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/auto_roll_logger.cc.o:auto_roll_logger.cc:(.text$_ZN7rocksdb14AutoRollLoggerC1EPNS_3EnvERKSsS4_yyNS_12InfoLogLevelE[_ZN7rocksdb14AutoRollLoggerC1EPNS_3EnvERKSsS4_yyNS_12InfoLogLevelE]+0x1b5): undefined reference to `rocksdb::port::Mutex::Mutex(bool)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/auto_roll_logger.cc.o:auto_roll_logger.cc:(.text$_ZN7rocksdb14AutoRollLoggerC1EPNS_3EnvERKSsS4_yyNS_12InfoLogLevelE[_ZN7rocksdb14AutoRollLoggerC1EPNS_3EnvERKSsS4_yyNS_12InfoLogLevelE]+0x281): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/auto_roll_logger.cc.o:auto_roll_logger.cc:(.text$_ZN7rocksdb14AutoRollLoggerD1Ev[_ZN7rocksdb14AutoRollLoggerD1Ev]+0x28): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/auto_roll_logger.cc.o:auto_roll_logger.cc:(.text$_ZN7rocksdb9MutexLockC1EPNS_4port5MutexE[_ZN7rocksdb9MutexLockC1EPNS_4port5MutexE]+0x26): undefined reference to `rocksdb::port::Mutex::Lock()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/auto_roll_logger.cc.o:auto_roll_logger.cc:(.text$_ZN7rocksdb9MutexLockD1Ev[_ZN7rocksdb9MutexLockD1Ev]+0x17): undefined reference to `rocksdb::port::Mutex::Unlock()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/block.cc.o:block.cc:(.text$_ZN7rocksdb13PerfStepTimerC1EPy[_ZN7rocksdb13PerfStepTimerC1EPy]+0x31): undefined reference to `rocksdb::Env::Default()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/block_based_table_builder.cc.o:block_based_table_builder.cc:(.text$_ZN7rocksdb15Snappy_CompressERKNS_18CompressionOptionsEPKcyPSs[_ZN7rocksdb15Snappy_CompressERKNS_18CompressionOptionsEPKcyPSs]+0x20): undefined reference to `snappy::MaxCompressedLength(unsigned long long)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/block_based_table_builder.cc.o: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-build696393863/github.com/cockroachdb/c-rocksdb/_obj/block_based_table_builder.cc.o:block_based_table_builder.cc:(.text$_ZN7rocksdb12LZ4_CompressERKNS_18CompressionOptionsEjPKcyPSs[_ZN7rocksdb12LZ4_CompressERKNS_18CompressionOptionsEjPKcyPSs]+0x9c): undefined reference to `LZ4_compressBound'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/block_based_table_builder.cc.o:block_based_table_builder.cc:(.text$_ZN7rocksdb12LZ4_CompressERKNS_18CompressionOptionsEjPKcyPSs[_ZN7rocksdb12LZ4_CompressERKNS_18CompressionOptionsEjPKcyPSs]+0xe9): undefined reference to `LZ4_compress_limitedOutput'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/block_based_table_builder.cc.o:block_based_table_builder.cc:(.text$_ZN7rocksdb14LZ4HC_CompressERKNS_18CompressionOptionsEjPKcyPSs[_ZN7rocksdb14LZ4HC_CompressERKNS_18CompressionOptionsEjPKcyPSs]+0x98): undefined reference to `LZ4_compressBound'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/block_based_table_builder.cc.o:block_based_table_builder.cc:(.text$_ZN7rocksdb14LZ4HC_CompressERKNS_18CompressionOptionsEjPKcyPSs[_ZN7rocksdb14LZ4HC_CompressERKNS_18CompressionOptionsEjPKcyPSs]+0xf0): undefined reference to `LZ4_compressHC2_limitedOutput'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/c.cc.o:c.cc:(.text+0x6074): undefined reference to `rocksdb::Env::Default()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/cache.cc.o:cache.cc:(.text+0x6cb): undefined reference to `rocksdb::port::Mutex::Mutex(bool)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/cache.cc.o:cache.cc:(.text+0x710): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/cache.cc.o:cache.cc:(.text+0x750): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/cache.cc.o:cache.cc:(.text+0x7e0): undefined reference to `rocksdb::port::Mutex::Lock()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/cache.cc.o:cache.cc:(.text+0x80a): undefined reference to `rocksdb::port::Mutex::Unlock()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/cache.cc.o:cache.cc:(.text+0x11a5): undefined reference to `rocksdb::port::Mutex::Mutex(bool)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/cache.cc.o:cache.cc:(.text+0x11ba): undefined reference to `rocksdb::port::Mutex::Mutex(bool)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/cache.cc.o:cache.cc:(.text+0x132d): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/cache.cc.o:cache.cc:(.text+0x1342): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/cache.cc.o:cache.cc:(.text+0x1404): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/cache.cc.o:cache.cc:(.text+0x1414): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/column_family.cc.o:column_family.cc:(.text$_ZN7rocksdb17InstrumentedMutex6UnlockEv[_ZN7rocksdb17InstrumentedMutex6UnlockEv]+0x14): undefined reference to `rocksdb::port::Mutex::Unlock()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/column_family.cc.o:column_family.cc:(.text$_ZN7rocksdb17InstrumentedMutex10AssertHeldEv[_ZN7rocksdb17InstrumentedMutex10AssertHeldEv]+0x14): undefined reference to `rocksdb::port::Mutex::AssertHeld()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/db_impl.cc.o:db_impl.cc:(.text+0x314): undefined reference to `rocksdb::port::GetMaxOpenFiles()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/db_impl.cc.o:db_impl.cc:(.text$_ZN7rocksdb17InstrumentedMutexC1EPNS_10StatisticsEPNS_3EnvEib[_ZN7rocksdb17InstrumentedMutexC1EPNS_10StatisticsEPNS_3EnvEib]+0x2a): undefined reference to `rocksdb::port::Mutex::Mutex(bool)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/db_impl.cc.o:db_impl.cc:(.text$_ZN7rocksdb19InstrumentedCondVarC1EPNS_17InstrumentedMutexE[_ZN7rocksdb19InstrumentedCondVarC1EPNS_17InstrumentedMutexE]+0x1c): undefined reference to `rocksdb::port::CondVar::CondVar(rocksdb::port::Mutex*)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/db_impl.cc.o:db_impl.cc:(.text$_ZN7rocksdb19InstrumentedCondVar9SignalAllEv[_ZN7rocksdb19InstrumentedCondVar9SignalAllEv]+0x14): undefined reference to `rocksdb::port::CondVar::SignalAll()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/db_impl.cc.o:db_impl.cc:(.text$_ZN7rocksdb10WalManagerC1ERKNS_9DBOptionsERKNS_10EnvOptionsE[_ZN7rocksdb10WalManagerC1ERKNS_9DBOptionsERKNS_10EnvOptionsE]+0x93): undefined reference to `rocksdb::port::Mutex::Mutex(bool)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/db_impl.cc.o:db_impl.cc:(.text$_ZN7rocksdb17InstrumentedMutexD1Ev[_ZN7rocksdb17InstrumentedMutexD1Ev]+0x14): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/db_impl.cc.o:db_impl.cc:(.text$_ZN7rocksdb19InstrumentedCondVarD1Ev[_ZN7rocksdb19InstrumentedCondVarD1Ev]+0x14): undefined reference to `rocksdb::port::CondVar::~CondVar()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/db_impl.cc.o:db_impl.cc:(.text$_ZN7rocksdb10WalManagerD1Ev[_ZN7rocksdb10WalManagerD1Ev]+0x18): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/db_ttl_impl.cc.o:db_ttl_impl.cc:(.text+0x724): undefined reference to `rocksdb::Env::Default()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0x1ac): undefined reference to `rocksdb::port::Mutex::Mutex(bool)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0x21d): undefined reference to `rocksdb::port::CondVar::CondVar(rocksdb::port::Mutex*)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0x246): undefined reference to `rocksdb::port::Mutex::Mutex(bool)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0x32a): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0x353): undefined reference to `rocksdb::port::CondVar::~CondVar()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0x394): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0x41d): undefined reference to `rocksdb::port::CondVar::SignalAll()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0x47d): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0x4a1): undefined reference to `rocksdb::port::CondVar::~CondVar()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0x4d3): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0x689): undefined reference to `rocksdb::port::CondVar::SignalAll()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0xb78): undefined reference to `rocksdb::port::CondVar::Wait()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0xc38): undefined reference to `rocksdb::port::Mutex::Unlock()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0xc76): undefined reference to `rocksdb::port::Mutex::Lock()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0xd01): undefined reference to `rocksdb::port::CondVar::TimedWait(unsigned long long)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0xd4f): undefined reference to `rocksdb::port::CondVar::SignalAll()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/delete_scheduler_impl.cc.o:delete_scheduler_impl.cc:(.text+0xfa2): undefined reference to `rocksdb::port::CondVar::Wait()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/document_db.cc.o:document_db.cc:(.text$_ZN7rocksdb14DocumentDBImplC1EPNS_2DBEPNS_18ColumnFamilyHandleERKSt6vectorISt4pairIPNS_5IndexES4_ESaIS9_EERKNS_7OptionsE[_ZN7rocksdb14DocumentDBImplC1EPNS_2DBEPNS_18ColumnFamilyHandleERKSt6vectorISt4pairIPNS_5IndexES4_ESaIS9_EERKNS_7OptionsE]+0x50): undefined reference to `rocksdb::port::Mutex::Mutex(bool)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/document_db.cc.o:document_db.cc:(.text$_ZN7rocksdb14DocumentDBImplC1EPNS_2DBEPNS_18ColumnFamilyHandleERKSt6vectorISt4pairIPNS_5IndexES4_ESaIS9_EERKNS_7OptionsE[_ZN7rocksdb14DocumentDBImplC1EPNS_2DBEPNS_18ColumnFamilyHandleERKSt6vectorISt4pairIPNS_5IndexES4_ESaIS9_EERKNS_7OptionsE]+0x65): undefined reference to `rocksdb::port::Mutex::Mutex(bool)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/document_db.cc.o:document_db.cc:(.text$_ZN7rocksdb14DocumentDBImplC1EPNS_2DBEPNS_18ColumnFamilyHandleERKSt6vectorISt4pairIPNS_5IndexES4_ESaIS9_EERKNS_7OptionsE[_ZN7rocksdb14DocumentDBImplC1EPNS_2DBEPNS_18ColumnFamilyHandleERKSt6vectorISt4pairIPNS_5IndexES4_ESaIS9_EERKNS_7OptionsE]+0x218): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/document_db.cc.o:document_db.cc:(.text$_ZN7rocksdb14DocumentDBImplC1EPNS_2DBEPNS_18ColumnFamilyHandleERKSt6vectorISt4pairIPNS_5IndexES4_ESaIS9_EERKNS_7OptionsE[_ZN7rocksdb14DocumentDBImplC1EPNS_2DBEPNS_18ColumnFamilyHandleERKSt6vectorISt4pairIPNS_5IndexES4_ESaIS9_EERKNS_7OptionsE]+0x22d): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/document_db.cc.o:document_db.cc:(.text$_ZN7rocksdb14DocumentDBImplD1Ev[_ZN7rocksdb14DocumentDBImplD1Ev]+0x137): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/document_db.cc.o:document_db.cc:(.text$_ZN7rocksdb14DocumentDBImplD1Ev[_ZN7rocksdb14DocumentDBImplD1Ev]+0x147): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/env.cc.o:env.cc:(.rdata$_ZTVN7rocksdb10EnvWrapperE[_ZTVN7rocksdb10EnvWrapperE]+0x128): undefined reference to `rocksdb::Env::GenerateUniqueId()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/env.cc.o:env.cc:(.rdata$_ZTVN7rocksdb3EnvE[_ZTVN7rocksdb3EnvE]+0x128): undefined reference to `rocksdb::Env::GenerateUniqueId()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/env_hdfs.cc.o:env_hdfs.cc:(.rdata$_ZTVN7rocksdb7HdfsEnvE[_ZTVN7rocksdb7HdfsEnvE]+0x128): undefined reference to `rocksdb::Env::GenerateUniqueId()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/format.cc.o:format.cc:(.text$_ZN7rocksdb28Snappy_GetUncompressedLengthEPKcyPy[_ZN7rocksdb28Snappy_GetUncompressedLengthEPKcyPy]+0x27): undefined reference to `snappy::GetUncompressedLength(char const*, unsigned long long, unsigned long long*)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/format.cc.o:format.cc:(.text$_ZN7rocksdb17Snappy_UncompressEPKcyPc[_ZN7rocksdb17Snappy_UncompressEPKcyPc]+0x27): undefined reference to `snappy::RawUncompress(char const*, unsigned long long, char*)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/format.cc.o:format.cc:(.text$_ZN7rocksdb14LZ4_UncompressEPKcyPij[_ZN7rocksdb14LZ4_UncompressEPKcyPij]+0xb1): undefined reference to `LZ4_decompress_safe'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/instrumented_mutex.cc.o:instrumented_mutex.cc:(.text+0x120): undefined reference to `rocksdb::port::Mutex::Lock()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/instrumented_mutex.cc.o:instrumented_mutex.cc:(.text+0x24c): undefined reference to `rocksdb::port::CondVar::Wait()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/instrumented_mutex.cc.o:instrumented_mutex.cc:(.text+0x3a0): undefined reference to `rocksdb::port::CondVar::TimedWait(unsigned long long)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/leveldb_options.cc.o:leveldb_options.cc:(.text+0xca): undefined reference to `rocksdb::Env::Default()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/memenv.cc.o:memenv.cc:(.text+0x18f): undefined reference to `rocksdb::port::Mutex::Mutex(bool)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/memenv.cc.o:memenv.cc:(.text+0x622): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/memenv.cc.o:memenv.cc:(.text+0xbd1): undefined reference to `rocksdb::port::Mutex::Mutex(bool)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/memenv.cc.o:memenv.cc:(.text+0xbf6): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/memenv.cc.o:memenv.cc:(.text+0xcb6): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/memenv.cc.o:memenv.cc:(.rdata+0x1e8): undefined reference to `rocksdb::Env::GenerateUniqueId()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/options.cc.o:options.cc:(.text+0xf4a): undefined reference to `rocksdb::Env::Default()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text+0x4b): undefined reference to `rocksdb::port::Mutex::Mutex(bool)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text+0x7f): undefined reference to `rocksdb::Env::Default()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text+0xaa): undefined reference to `rocksdb::port::CondVar::CondVar(rocksdb::port::Mutex*)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text+0x1e6): undefined reference to `rocksdb::port::CondVar::~CondVar()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text+0x1fb): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text+0x2e5): undefined reference to `rocksdb::port::CondVar::Signal()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text+0x358): undefined reference to `rocksdb::port::CondVar::Signal()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text+0x38a): undefined reference to `rocksdb::port::CondVar::Wait()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text+0x3e8): undefined reference to `rocksdb::port::CondVar::~CondVar()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text+0x3f8): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text+0x682): undefined reference to `rocksdb::port::CondVar::TimedWait(unsigned long long)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text+0x697): undefined reference to `rocksdb::port::CondVar::Wait()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text+0x6c4): undefined reference to `rocksdb::port::CondVar::Signal()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text+0x74e): undefined reference to `rocksdb::port::CondVar::Signal()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text+0x78a): undefined reference to `rocksdb::port::CondVar::Signal()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text+0x9d6): undefined reference to `rocksdb::port::CondVar::Signal()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text$_ZN7rocksdb18GenericRateLimiter3ReqC1ExPNS_4port5MutexE[_ZN7rocksdb18GenericRateLimiter3ReqC1ExPNS_4port5MutexE]+0x2f): undefined reference to `rocksdb::port::CondVar::CondVar(rocksdb::port::Mutex*)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/rate_limiter.cc.o:rate_limiter.cc:(.text$_ZN7rocksdb18GenericRateLimiter3ReqD1Ev[_ZN7rocksdb18GenericRateLimiter3ReqD1Ev]+0x18): undefined reference to `rocksdb::port::CondVar::~CondVar()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/thread_local.cc.o:thread_local.cc:(.text+0x3a8): undefined reference to `rocksdb::port::Mutex::AssertHeld()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/thread_local.cc.o:thread_local.cc:(.text+0x406): undefined reference to `rocksdb::port::Mutex::AssertHeld()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/thread_local.cc.o:thread_local.cc:(.text+0x9b1): undefined reference to `rocksdb::port::Mutex::AssertHeld()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/thread_local.cc.o:thread_local.cc:(.text+0xe1f): undefined reference to `rocksdb::port::Mutex::~Mutex()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/thread_local.cc.o:thread_local.cc:(.text+0xe54): undefined reference to `rocksdb::port::Mutex::Mutex(bool)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/thread_status_updater.cc.o:thread_status_updater.cc:(.text+0x690): undefined reference to `rocksdb::Env::Default()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/thread_status_util.cc.o:thread_status_util.cc:(.text+0x138): undefined reference to `rocksdb::Env::Default()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/transaction_db_impl.cc.o:transaction_db_impl.cc:(.text$_ZN7rocksdb17InstrumentedMutexC1Eb[_ZN7rocksdb17InstrumentedMutexC1Eb]+0x1d): undefined reference to `rocksdb::port::Mutex::Mutex(bool)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/version_set.cc.o:version_set.cc:(.text$_ZN7rocksdb19InstrumentedCondVar6SignalEv[_ZN7rocksdb19InstrumentedCondVar6SignalEv]+0x14): undefined reference to `rocksdb::port::CondVar::Signal()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/write_batch.cc.o:write_batch.cc:(.text+0x1d14): undefined reference to `rocksdb::Env::Default()'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/write_batch_base.cc.o:write_batch_base.cc:(.text+0x49): undefined reference to `rocksdb::Slice::Slice(rocksdb::SliceParts const&, std::string*)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/write_batch_base.cc.o:write_batch_base.cc:(.text+0x60): undefined reference to `rocksdb::Slice::Slice(rocksdb::SliceParts const&, std::string*)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/write_batch_base.cc.o:write_batch_base.cc:(.text+0x11d): undefined reference to `rocksdb::Slice::Slice(rocksdb::SliceParts const&, std::string*)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/write_batch_base.cc.o:write_batch_base.cc:(.text+0x134): undefined reference to `rocksdb::Slice::Slice(rocksdb::SliceParts const&, std::string*)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/write_batch_base.cc.o:write_batch_base.cc:(.text+0x1dd): undefined reference to `rocksdb::Slice::Slice(rocksdb::SliceParts const&, std::string*)'
/tmp/go-build696393863/github.com/cockroachdb/c-rocksdb/_obj/write_batch_base.cc.o:write_batch_base.cc:(.text+0x265): more undefined references to `rocksdb::Slice::Slice(rocksdb::SliceParts const&, std::string*)' follow
collect2: error: ld returned 1 exit status

@tamird
Copy link
Contributor Author

tamird commented Nov 3, 2015

Yeah, that's not surprising since we're not compiling any of the windows stuff. I think I have a solution though, stay tuned.

@karalabe
Copy link
Owner

karalabe commented Nov 3, 2015

Ah, ok. That was my second question. That if posix ports have been in there, where are the win ones :)). I have to run now, will only have time to look again tomorrow morning. Docker hub brilliantly crashed with a 500 internal server error while building the new images, so had to restart. Dunno if it'll survive this time.

@tamird
Copy link
Contributor Author

tamird commented Nov 3, 2015

OK, I dropped another update; give it a try when you get some time.

@karalabe
Copy link
Owner

karalabe commented Nov 3, 2015

Will try it tomorrow. In the mean time the new images rolled out on docker hub, so you can also play with it (and the osx fixes). Just pull a fresh image via docker pull karalabe/xgo-latest

@tamird
Copy link
Contributor Author

tamird commented Nov 3, 2015

Got a lot further now, but failed on:

# github.com/cockroachdb/c-rocksdb
In file included from ../c-rocksdb/env_platform.cc:4:0:
internal/port/win/env_win.cc:37:41: fatal error: Rpc.h: No such file or directory
 #include <Rpc.h>  // For UUID generation

FWIW: https://msdn.microsoft.com/en-us/library/windows/desktop/aa379205(v=vs.85).aspx
Not sure why that guy is missing, I ran: xgo --go=1.5.1 --targets=windows-6.0/amd64 .

@karalabe
Copy link
Owner

karalabe commented Nov 3, 2015

Out of curiosity, could you try the header with lowercase? Opposed to Windows the Linux cross compiler is case sensitive, and I'm almost certain all include files are lowercase in mingw.

@tamird
Copy link
Contributor Author

tamird commented Nov 3, 2015

Bingo, that worked. Any way to bake this in so that it doesn't have to be repeated for every project? I had to make two such edits in this case:

diff --git a/internal/port/win/env_win.cc b/internal/port/win/env_win.cc
index 70c68b8..600f7a9 100644
--- a/internal/port/win/env_win.cc
+++ b/internal/port/win/env_win.cc
@@ -34,8 +34,8 @@
 #include "util/thread_status_updater.h"
 #include "util/thread_status_util.h"

-#include <Rpc.h>  // For UUID generation
-#include <Windows.h>
+#include <rpc.h>  // For UUID generation
+#include <windows.h>

 namespace rocksdb {

Meanwhile, we're on to the next error:

internal/port/win/env_win.cc: In member function 'virtual uint64_t rocksdb::{anonymous}::WinEnv::NowMicros()':
internal/port/win/env_win.cc:1821:43: error: unable to find numeric literal operator 'operator""i64'
     const int64_t c_UnixEpochStartTicks = 116444736000000000i64;

EDIT: from http://stackoverflow.com/a/28904550/1261323:

The literal suffix I64 is a Visual C++ extension that specifies a 64-bit signed integer type.

No idea what to do about this one.


By the way, separately from the above, the bit of cockroach that depends on c-snappy still fails with a linking error:

# github.com/cockroachdb/cockroach/rpc/codec
/tmp/go-build214432974/github.com/cockroachdb/cockroach/rpc/codec/_obj/lz4.cgo2.o:lz4.cgo2.c:(.text+0x19): undefined reference to `LZ4_compressBound'
/tmp/go-build214432974/github.com/cockroachdb/cockroach/rpc/codec/_obj/lz4.cgo2.o:lz4.cgo2.c:(.text+0x52): undefined reference to `LZ4_compress_limitedOutput'
/tmp/go-build214432974/github.com/cockroachdb/cockroach/rpc/codec/_obj/lz4.cgo2.o:lz4.cgo2.c:(.text+0xc8): undefined reference to `LZ4_decompress_safe'
/tmp/go-build214432974/github.com/cockroachdb/cockroach/rpc/codec/_obj/snappy.cgo2.o:snappy.cgo2.c:(.text+0x20): undefined reference to `snappy_max_compressed_length'
/tmp/go-build214432974/github.com/cockroachdb/cockroach/rpc/codec/_obj/snappy.cgo2.o:snappy.cgo2.c:(.text+0x64): undefined reference to `snappy_compress'
/tmp/go-build214432974/github.com/cockroachdb/cockroach/rpc/codec/_obj/snappy.cgo2.o:snappy.cgo2.c:(.text+0xb4): undefined reference to `snappy_uncompressed_length'
/tmp/go-build214432974/github.com/cockroachdb/cockroach/rpc/codec/_obj/snappy.cgo2.o:snappy.cgo2.c:(.text+0xfc): undefined reference to `snappy_uncompress'
collect2: error: ld returned 1 exit status

@karalabe
Copy link
Owner

karalabe commented Nov 4, 2015

Regarding the i64 thing, the standard notation is LL instead of i64. The former is part of the C++ spec, while the latter is a Microsoft "spec".

However, the next error is:

In file included from ./port_platform.cc:4:0:
internal/port/win/port_win.cc: In function 'rocksdb::port::DIR* rocksdb::port::opendir(const char*)':
internal/port/win/port_win.cc:157:73: error: invalid conversion from 'char*' to 'size_t {aka long long unsigned int}' [-fpermissive]
   strncpy_s(dir->entry_.d_name, dir->data_.name, strlen(dir->data_.name));
                                                                         ^
internal/port/win/port_win.cc:157:72: error: invalid conversion from 'size_t {aka long long unsigned int}' to 'const char*' [-fpermissive]
   strncpy_s(dir->entry_.d_name, dir->data_.name, strlen(dir->data_.name));
                                                                        ^
internal/port/win/port_win.cc:157:73: error: too few arguments to function 'errno_t strncpy_s(char*, size_t, const char*, size_t)'
   strncpy_s(dir->entry_.d_name, dir->data_.name, strlen(dir->data_.name));

Which according to MSDN too has too few parameters: https://msdn.microsoft.com/en-us/library/5dae5d43.aspx.

@tamird
Copy link
Contributor Author

tamird commented Nov 4, 2015

Actually, it appears it has a 3-parameter overload:

template <size_t size>
errno_t strncpy_s(
   char (&strDest)[size],
   const char *strSource,
   size_t count
); // C++ only

This is in the same MSDN article you linked.

@karalabe
Copy link
Owner

karalabe commented Nov 4, 2015

Isn't that a template function that requires the size to be resolved?

Edit: I.e. the line above your snippet in MSDN.

@tamird
Copy link
Contributor Author

tamird commented Nov 4, 2015

Sure, and in this case I believe it is. Here's our caller:

strncpy_s(dir->entry_.d_name, dir->data_.name, strlen(dir->data_.name));

dir->entry_ is a dirent:

struct dirent {
  char d_name[_MAX_PATH]; /* filename */
};

@tamird
Copy link
Contributor Author

tamird commented Nov 20, 2015

@karalabe now that the OSX issues are behind us, any thoughts on this?

@tamird tamird changed the title windows apis are not available when cross compiling for windows Secure Template Overloads not present when cross compiling for windows Apr 25, 2016
@tamird
Copy link
Contributor Author

tamird commented Apr 25, 2016

Updated the description and subject to indicate that this seems to be a problem with Secure Template Overloads.

@tamird
Copy link
Contributor Author

tamird commented Apr 25, 2016

Looks like a bug in mingw-w64! https://sourceforge.net/p/mingw-w64/bugs/535/

I've sent a patch to their mailing list.

After applying the patch, we're back to something that might be an xgo problem:

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 $WORK/github.com/cockroachdb/c-rocksdb/_obj/_cgo_export.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/cgo_flags.cgo2.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/env_platform.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_builder.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_c.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_column_family.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_compacted_db_impl.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_compaction.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_compaction_iterator.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_compaction_job.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_compaction_picker.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_convenience.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_db_filesnapshot.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_db_impl.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_db_impl_debug.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_db_impl_experimental.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_db_impl_readonly.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_db_iter.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_dbformat.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_event_helpers.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_experimental.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_file_indexer.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_filename.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_flush_job.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_flush_scheduler.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_forward_iterator.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_internal_stats.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_log_reader.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_log_writer.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_managed_iterator.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_memtable.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_memtable_allocator.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_memtable_list.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_merge_helper.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_merge_operator.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_repair.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_slice.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_snapshot_impl.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_table_cache.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_table_properties_collector.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_transaction_log_impl.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_version_builder.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_version_edit.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_version_set.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_wal_manager.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_write_batch.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_write_batch_base.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_write_controller.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_db_write_thread.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_memtable_hash_cuckoo_rep.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_memtable_hash_linklist_rep.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_memtable_hash_skiplist_rep.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_port_stack_trace.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_adaptive_table_factory.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_block.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_block_based_filter_block.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_block_based_table_builder.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_block_based_table_factory.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_block_based_table_reader.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_block_builder.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_block_hash_index.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_block_prefix_index.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_bloom_block.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_cuckoo_table_builder.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_cuckoo_table_factory.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_cuckoo_table_reader.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_flush_block_policy.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_format.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_full_filter_block.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_get_context.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_iterator.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_merger.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_meta_blocks.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_plain_table_builder.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_plain_table_factory.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_plain_table_index.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_plain_table_key_coding.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_plain_table_reader.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_sst_file_writer.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_table_properties.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_table_two_level_iterator.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_arena.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_auto_roll_logger.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_bloom.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_build_version.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_cache.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_coding.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_compaction_job_stats_impl.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_comparator.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_crc32c.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_db_info_dumper.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_delete_scheduler_impl.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_dynamic_bloom.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_env.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_event_logger.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_file_reader_writer.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_file_util.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_filter_policy.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_hash.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_histogram.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_instrumented_mutex.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_io_posix.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_iostats_context.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_log_buffer.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_logging.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_memenv.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_murmurhash.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_mutable_cf_options.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_options.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_options_builder.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_options_helper.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_options_parser.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_options_sanity_check.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_perf_context.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_perf_level.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_random.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_rate_limiter.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_skiplistrep.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_slice.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_statistics.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_status.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_status_message.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_string_util.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_sync_point.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_thread_local.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_thread_status_impl.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_thread_status_updater.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_thread_status_updater_debug.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_thread_status_util.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_thread_status_util_debug.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_vectorrep.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_xfunc.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_util_xxhash.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_backupable_backupable_db.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_checkpoint_checkpoint.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_compaction_filters_remove_emptyvalue_compactionfilter.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_convenience_info_log_finder.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_document_document_db.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_document_json_document.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_document_json_document_builder.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_flashcache_flashcache.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_geodb_geodb_impl.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_leveldb_options_leveldb_options.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_memory_memory_util.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_merge_operators_put.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_merge_operators_string_append_stringappend.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_merge_operators_string_append_stringappend2.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_merge_operators_uint64add.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_options_options_util.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_spatialdb_spatial_db.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_table_properties_collectors_compact_on_deletion_collector.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_transactions_optimistic_transaction_db_impl.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_transactions_optimistic_transaction_impl.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_transactions_transaction_base.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_transactions_transaction_db_impl.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_transactions_transaction_db_mutex_impl.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_transactions_transaction_impl.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_transactions_transaction_lock_mgr.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_transactions_transaction_util.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_ttl_db_ttl_impl.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_write_batch_with_index_write_batch_with_index.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/internal_utilities_write_batch_with_index_write_batch_with_index_internal.cc.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/logger_platform.cpp.o $WORK/github.com/cockroachdb/c-rocksdb/_obj/port_platform.cc.o -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.

Note that x86_64-w64-mingw32-g++-posix is being invoked with -Wl,--unresolved-symbols=ignore-all, yet that directive seems to be ignored.

@tamird tamird changed the title Secure Template Overloads not present when cross compiling for windows Missing symbols when cross compiling for windows Apr 25, 2016
@tamird
Copy link
Contributor Author

tamird commented May 10, 2016

The missing overloads patch has been accepted into mingw-w64: https://sourceforge.net/p/mingw-w64/mingw-w64/ci/6ec4fb2d8c1b1abfd5aca69c382c24feb6961342/

@karalabe
Copy link
Owner

Ah awesome. We (Ethereum) were doing our big release for a while now, just went out a few hours ago so hopefully I'll find a bit more time to address xgo issues too. I'm a bit afraid of the overhead required to build mingw within xgo. I'll look into as to what it would entail.

@tamird
Copy link
Contributor Author

tamird commented May 20, 2016

OK, so folks on the mingw-w64 mailing list have suggested that windows' portable executables don't support undefined symbols after link-time, so xgo is probably not at fault here any more. The rest of this is tracked in golang/go#14985.

It'd be nice to package a more recent mingw-w64 release in xgo, but I'm going to close this thread all the same.

@tamird tamird closed this as completed May 20, 2016
kolaente added a commit to kolaente/xgo that referenced this issue Jun 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants