I am trying to cross compile a an application that interacts with the bitcoin ecosystem from my ubuntu server to windows using cross-rs.
This application compiles fine up until it reaches a crate called "bitcoinconsensus" (which is a feature of the bitcoin crate).
This is the output I got:
Warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:
warning: [email protected]+26.0: In file included from depend/bitcoin/src/util/strencodings.cpp:7:0:
warning: [email protected]+26.0: depend/bitcoin/src/util/strencodings.h:15:10: fatal error: charconv: No such file or directory
warning: [email protected]+26.0: #include <charconv>
warning: [email protected]+26.0: ^~~~~~~~~~
warning: [email protected]+26.0: compilation terminated.
error: failed to run custom build command for bitcoinconsensus v0.106.0+26.0
My initial thought was to try editing this line out by copying the crate and just using a local copy, but after this I still get an error:
warning: [email protected]+25.1: In file included from depend/bitcoin/src/util/strencodings.cpp:7:0:
warning: [email protected]+25.1: depend/bitcoin/src/util/strencodings.h: In function 'T LocaleIndependentAtoi(std::string_view)':
warning: [email protected]+25.1: depend/bitcoin/src/util/strencodings.h:132:38: error: 'from_chars' is not a member of 'std'
warning: [email protected]+25.1: auto [_, error_condition] = std::from_chars(s.data(), s.data() + s.size(), result);
warning: [email protected]+25.1: ^~~~~~~~~~
warning: [email protected]+25.1: depend/bitcoin/src/util/strencodings.h:132:38: note: suggested alternative: '__is_char'
warning: [email protected]+25.1: auto [_, error_condition] = std::from_chars(s.data(), s.data() + s.size(), result);
warning: [email protected]+25.1: ^~~~~~~~~~
warning: [email protected]+25.1: __is_char
warning: [email protected]+25.1: depend/bitcoin/src/util/strencodings.h: In function 'std::optional<_Tp> ToIntegral(std::string_view)':
warning: [email protected]+25.1: depend/bitcoin/src/util/strencodings.h:185:60: error: 'from_chars' is not a member of 'std'
warning: [email protected]+25.1: const auto [first_nonmatching, error_condition] = std::from_chars(str.data(), str.data() + str.size(), result);
warning: [email protected]+25.1: ^~~~~~~~~~
warning: [email protected]+25.1: depend/bitcoin/src/util/strencodings.h:185:60: note: suggested alternative: '__is_char'
warning: [email protected]+25.1: const auto [first_nonmatching, error_condition] = std::from_chars(str.data(), str.data() + str.size(), result);
warning: [email protected]+25.1: ^~~~~~~~~~
warning: [email protected]+25.1: __is_char
error: failed to run custom build command for `bitcoinconsensus v0.105.0+25.1 (/var/www/x/bitcoin/bitcoinconsensus)`
I use the following to try to compile:
cross build --target x86_64-pc-windows-gnu
I do not have any issues when compiling on windows. The crate doesnt seem to have a Cross.toml file. Does anyone have any idea on what I can do to get around this or fix it? My last case resort is to just compile my application on an RDP on windows but I really dont want to have to do that.
Thanks guys!