GeniusVentures / GeniusWallet

MIT License
9 stars 2 forks source link

Fix Windows host build with FFI #42

Open henriqueaklein opened 2 months ago

henriqueaklein commented 2 months ago

For GeniusWallet to be able to run with FFI the C++ library has to be compiled with the same configuration as the windows build on flutter.

On a Windows 10 VM I was able to build wallet-core on thirdparty and link it to GeniusWallet using FFI, however needed to configure runtime library otherwise some linker errors appears.

@matthewhoman tried it with his Windows 11 Home (10.0, Build 22631) and GeniusWallet wasn't able to link the libraries:

TrustWalletCore.lib(Actor.obj) : error LNK2001: unresolved external symbol __std_find_trivial_1 [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(utility.obj) : error LNK2001: unresolved external symbol __std_find_trivial_1 [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
TrustWalletCore.lib(Address.cpp.obj) : error LNK2001: unresolved external symbol __std_find_trivial_1 [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
TrustWalletCore.lib(Account.cpp.obj) : error LNK2001: unresolved external symbol __std_find_trivial_1 [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
TrustWalletCore.lib(Address.cpp.obj) : error LNK2001: unresolved external symbol __std_find_trivial_1 [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
TrustWalletCore.lib(Address.cpp.obj) : error LNK2001: unresolved external symbol __std_find_trivial_1 [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(dynamic_message.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(utility.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(type_resolver_util.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(extension_set_heavy.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(reflection_ops.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(text_format.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(descriptor.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(map_field.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(protostream_objectsource.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(protostream_objectwriter.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(any.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(generated_message_reflection.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(message.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(wire_format.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
TrustWalletCore.lib(Bitcoin.pb.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(arenastring.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(message_lite.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(json_util.obj) : error LNK2001: unresolved external symbol __std_init_once_link_alternate_names_and_abort [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
libprotobuf.lib(descriptor.obj) : error LNK2019: unresolved external symbol __std_count_trivial_1 referenced in function "unsigned __int64 __cdecl __std_count_trivial<char const ,char>(char const *,char const *,char)" (??$__std_count_trivial@$$CBDD@@YA_KPEBD0D@Z) [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\Debug\genius_wallet.exe : fatal error LNK1120: 3 unresolved externals [C:\Users\Matth\Documents\Github\GeniusWallet\build\windows\runner\genius_wallet.vcxproj]
Building Windows application...                                    21.9s
Exception: Build process failed.

My guess is that probably some default configuration on my environment matches one of the 2 players involved. Start by investigating the flutter windows build environment and the cmake environment set by thirdparty build on Windows.

henriqueaklein commented 1 month ago

I think this might be fixed. Probably it was some wrong configs