I've tried to statically link binance-cli so I can compile it using Arch Linux and run it on Ubuntu 20.04. If you use dynamic linking the libraries that Arch Linux uses are newer than what is present on Ubuntu 20.04 so it fails loading. Static linking is one way around the problem, but isn't working (yet). So in the short term I'm going to compile it on a VirtualBox loading with Ubuntu 20.04.
Anyway, for reasons unknown, running cargo test test_convertcommission fails when statically linked:
Note I use --test-threads=1 so the tests aren't run in parallel and you can see which one failed.
$ cargo test -- --test-threads=1
Finished test [unoptimized + debuginfo] target(s) in 0.05s
Running unittests (target/x86_64-unknown-linux-gnu/debug/deps/binance_cli-1a19f6eb748e4ac0)
running 41 tests
test binance_account_info::test::test_account_info ... ok
test binance_exchange_info::test::test_exchange_info ... ok
test binance_history::test::test_history_rec ... ok
test binance_klines::test::test_kline_rec ... ok
test binance_my_trades::test::test_trade_rec ... ok
test binance_my_trades::test::test_trade_rec_is_buyer_factor ... ok
test binance_order_response::test::test_order_response_header_rec_app_rec_versions ... ok
test binance_order_response::test::test_order_response_header_rec_max ... ok
test binance_order_response::test::test_order_response_header_rec_min ... ok
test binance_order_response::test::test_order_response_semver ... ok
test binance_order_response::test::test_order_response_success_ack ... ok
test binance_order_response::test::test_order_response_success_full ... ok
test binance_order_response::test::test_order_response_success_result ... ok
test binance_order_response::test::test_order_response_success_unknown ... ok
test binance_signature::test::test_append_signature ... ok
test binance_signature::test::test_binance_example ... ok
test binance_signature::test::test_binance_signature_body_only ... ok
test binance_signature::test::test_binance_signature_no_query_string_no_body ... ok
test binance_signature::test::test_binance_signature_query_string_and_body ... ok
test binance_signature::test::test_binance_signature_query_string_only ... ok
test binance_signature::test::test_query_vec_u8 ... ok
test binance_signature::test::test_query_vec_u8_no_data ... ok
test binance_trade::test::test_convert ... ok
test binance_trade::test::test_convertcommission ... error: test failed, to rerun pass '--bin binance-cli'
I then added debug println's to `binance-cli` and `cargo` and if you then run the test using the code with debug:
* Note: clone git@github.com:winksaville/rustlang-cargo, checkout [`Add-debug-to-test-binance-cli-with-statically-linked-glibc`](https://github.com/winksaville/rustlang-cargo/commit/97b4e86c15e57f74fd863a8163938a012d38c0b4) and build it with `cargo +nightly --release`
I've tried to statically link binance-cli so I can compile it using Arch Linux and run it on Ubuntu 20.04. If you use dynamic linking the libraries that Arch Linux uses are newer than what is present on Ubuntu 20.04 so it fails loading. Static linking is one way around the problem, but isn't working (yet). So in the short term I'm going to compile it on a VirtualBox loading with Ubuntu 20.04.
Anyway, for reasons unknown, running
cargo test
test_convertcommission fails when statically linked:running 41 tests test binance_account_info::test::test_account_info ... ok test binance_exchange_info::test::test_exchange_info ... ok test binance_history::test::test_history_rec ... ok test binance_klines::test::test_kline_rec ... ok test binance_my_trades::test::test_trade_rec ... ok test binance_my_trades::test::test_trade_rec_is_buyer_factor ... ok test binance_order_response::test::test_order_response_header_rec_app_rec_versions ... ok test binance_order_response::test::test_order_response_header_rec_max ... ok test binance_order_response::test::test_order_response_header_rec_min ... ok test binance_order_response::test::test_order_response_semver ... ok test binance_order_response::test::test_order_response_success_ack ... ok test binance_order_response::test::test_order_response_success_full ... ok test binance_order_response::test::test_order_response_success_result ... ok test binance_order_response::test::test_order_response_success_unknown ... ok test binance_signature::test::test_append_signature ... ok test binance_signature::test::test_binance_example ... ok test binance_signature::test::test_binance_signature_body_only ... ok test binance_signature::test::test_binance_signature_no_query_string_no_body ... ok test binance_signature::test::test_binance_signature_query_string_and_body ... ok test binance_signature::test::test_binance_signature_query_string_only ... ok test binance_signature::test::test_query_vec_u8 ... ok test binance_signature::test::test_query_vec_u8_no_data ... ok test binance_trade::test::test_convert ... ok test binance_trade::test::test_convertcommission ... error: test failed, to rerun pass '--bin binance-cli'
Caused by: process didn't exit successfully:
/home/wink/prgs/rust/myrepos/binance-cli/target/x86_64-unknown-linux-gnu/debug/deps/binance_cli-1a19f6eb748e4ac0 --test-threads=1
(signal: 11, SIGSEGV: invalid memory reference) wink@3900x:~/prgs/rust/myrepos/binance-cli (Statically-link-glibc)wink@3900x:~/prgs/rust/myrepos/binance-cli (Statically-link-glibc) $ ~/prgs/rust/myrepos/rustlang-cargo/target/release/cargo test -- --test-threads=1 --nocapture exec:+ exec: call run_tests Compiling libc v0.2.107 Compiling proc-macro2 v1.0.32 Compiling syn v1.0.81 Compiling memchr v2.4.1 ... Compiling hyper-tls v0.5.0 Compiling reqwest v0.11.6 Finished test [unoptimized + debuginfo] target(s) in 29.26s Running unittests (target/x86_64-unknown-linux-gnu/debug/deps/binance_cli-46cb7d7473531c84)
running 41 tests test binance_account_info::test::test_account_info ... ok test binance_exchange_info::test::test_exchange_info ... ok test binance_history::test::test_history_rec ... ok test binance_klines::test::test_kline_rec ... ok test binance_my_trades::test::test_trade_rec ... ok test binance_my_trades::test::test_trade_rec_is_buyer_factor ... ok test binance_order_response::test::test_order_response_header_rec_app_rec_versions ... hr: HeaderRec { app_version: Version { major: 1, minor: 2, patch: 3, pre: Prerelease("alpha1"), build: BuildMetadata("1234") }, rec_version: Some(Version { major: 3, minor: 2, patch: 1, pre: Prerelease("beta2"), build: BuildMetadata("9e0cec6") }), test: None, query: None, value_usd: None, commission_usd: None, internal_errors: [] } app_version: Version { major: 1, minor: 2, patch: 3, pre: Prerelease("alpha1"), build: BuildMetadata("1234") } expected: Version { major: 1, minor: 2, patch: 3, pre: Prerelease("alpha1"), build: BuildMetadata("1234") } rec_version: Some(Version { major: 3, minor: 2, patch: 1, pre: Prerelease("beta2"), build: BuildMetadata("9e0cec6") }) expected: Some(Version { major: 3, minor: 2, patch: 1, pre: Prerelease("beta2"), build: BuildMetadata("9e0cec6") }) ok test binance_order_response::test::test_order_response_header_rec_max ... hr: HeaderRec { app_version: Version { major: 1, minor: 2, patch: 3, pre: Prerelease("alpha1"), build: BuildMetadata("1234") }, rec_version: Some(Version { major: 3, minor: 2, patch: 1, pre: Prerelease("beta2"), build: BuildMetadata("9e0cec6") }), test: Some(false), query: Some("A query string"), value_usd: Some(123.456), commission_usd: Some(1), internal_errors: ["abc", "def"] } ok test binance_order_response::test::test_order_response_header_rec_min ... hr: HeaderRec { app_version: Version { major: 1, minor: 2, patch: 3, pre: Prerelease("alpha1"), build: BuildMetadata("1234") }, rec_version: None, test: None, query: None, value_usd: None, commission_usd: None, internal_errors: [] } app_version: Version { major: 1, minor: 2, patch: 3, pre: Prerelease("alpha1"), build: BuildMetadata("1234") } expected: Version { major: 1, minor: 2, patch: 3, pre: Prerelease("alpha1"), build: BuildMetadata("1234") } ok test binance_order_response::test::test_order_response_semver ... ver: Version { major: 1, minor: 2, patch: 3, pre: Prerelease("alpha1"), build: BuildMetadata("1234") } ver_json: "\"1.2.3-alpha1+1234\"" ver_json_de: Version { major: 1, minor: 2, patch: 3, pre: Prerelease("alpha1"), build: BuildMetadata("1234") } ok test binance_order_response::test::test_order_response_success_ack ... ok test binance_order_response::test::test_order_response_success_full ... ok test binance_order_response::test::test_order_response_success_result ... ok test binance_order_response::test::test_order_response_success_unknown ... ok test binance_signature::test::test_append_signature ... ok test binance_signature::test::test_binance_example ... ok test binance_signature::test::test_binance_signature_body_only ... ok test binance_signature::test::test_binance_signature_no_query_string_no_body ... ok test binance_signature::test::test_binance_signature_query_string_and_body ... ok test binance_signature::test::test_binance_signature_query_string_only ... ok test binance_signature::test::test_query_vec_u8 ... ok test binance_signature::test::test_query_vec_u8_no_data ... ok test binance_trade::test::test_convert ... convert:+ convert:1 convert:1.1 convert:1.2 convert:- other_value: 1234.5678 convert:+ convert:1 convert:1.3 convert:1.3.1 get_kline:+ get_kline:1 get_klines:+ get_klines:1 get_klines:1.1 get_klines:1.2 get_klines:2 get_klines:3 get_klines:3.1 get_klines:4 get_klines:5 get_klines:6 get_klines:7 get_req_get_response:+ get_req_get_response_ll:+ get_req_get_response_ll:1 get_req_get_response_ll:1.1 get_req_get_response_ll:2 get_req_get_response_ll:- get_req_get_response:- get_klines:8 get_klines:9 get_klines:10 get_klines:10.1 get_klines:11 get_kline:2 get_kline:2.2 get_kline:2.2.1 get_kline:2.2.2 convert:1.3.1 OK convert:- other_value: 634.2953 convert 1 BNBUSB: 634.2953 ok test binance_trade::test::test_convertcommission ... get result of convert_commission convert_commission convert:+ convert:1 convert:1.3 convert:1.3.1 get_kline:+ get_kline:1 get_klines:+ get_klines:1 get_klines:1.1 get_klines:1.1.1 get_klines:1.2 get_klines:2 get_klines:3 get_klines:3.1 get_klines:4 get_klines:5 get_klines:6 get_klines:7 get_req_get_response:+ get_req_get_response_ll:+ get_req_get_response_ll:1 get_req_get_response_ll:1.1 get_req_get_response_ll:2 exec: retf run_tests err: Some( CargoTestError { test: UnitTest { kind: "bin", name: "binance-cli", pkg_name: "binance-cli", }, desc: "process didn't exit successfully:
exec rerun:2
exec rerun:3 e=CliError {
error: Some(
Error {
context: "test failed, to rerun pass \'--bin binance-cli\'",
source: CargoTestError {
test: UnitTest {
kind: "bin",
name: "binance-cli",
pkg_name: "binance-cli",
},
desc: "process didn't exit successfully:
/home/wink/prgs/rust/myrepos/binance-cli/target/x86_64-unknown-linux-gnu/debug/deps/binance_cli-46cb7d7473531c84 --test-threads=1 --nocapture
(signal: 11, SIGSEGV: invalid memory reference)", code: None, causes: [ ProcessError { desc: "process didn't exit successfully:/home/wink/prgs/rust/myrepos/binance-cli/target/x86_64-unknown-linux-gnu/debug/deps/binance_cli-46cb7d7473531c84 --test-threads=1 --nocapture
(signal: 11, SIGSEGV: invalid memory reference)", code: None, stdout: None, stderr: None, }, ], }, ) exec rerun:1 hint:+ hint bt: kind: "bin" name: binance-cli pkg_name: binance-cli/home/wink/prgs/rust/myrepos/binance-cli/target/x86_64-unknown-linux-gnu/debug/deps/binance_cli-46cb7d7473531c84 --test-threads=1 --nocapture
(signal: 11, SIGSEGV: invalid memory reference)", code: None, causes: [ ProcessError { desc: "process didn't exit successfully:/home/wink/prgs/rust/myrepos/binance-cli/target/x86_64-unknown-linux-gnu/debug/deps/binance_cli-46cb7d7473531c84 --test-threads=1 --nocapture
(signal: 11, SIGSEGV: invalid memory reference)", code: None, stdout: None, stderr: None, }, ], }, }, ), exit_code: 101, } error: test failed, to rerun pass '--bin binance-cli'Caused by: process didn't exit successfully:
/home/wink/prgs/rust/myrepos/binance-cli/target/x86_64-unknown-linux-gnu/debug/deps/binance_cli-46cb7d7473531c84 --test-threads=1 --nocapture
(signal: 11, SIGSEGV: invalid memory reference)