So I compile my binary for target x86_64-unknown-linux-gnu and the text size (as shown by 'size ') is like 500KB, and I compile the same thing for x86_64-linux-android target and now the size is suddenly 3Mb !! Why is the difference, even the architecture is not changing !
Also note that this is my setting - trying to see if that helps in anyway - but the 500K Vs 3Mb difference is with all this setting on
opt-level = "z"
lto = true
Do your dependencies use any C libraries like OpenSSL that might be linked differently on different platforms?
cargo-bloat might help determine what is taking up space in the binary.
Based on your previous question, your binary includes a statically-linked copy of OpenSSL on Android but not on other platforms.
Sorry I forgot to answer to this one, yes the reason was that native-tls ends up compiling openssl on Android and statically linking it (can't believe android refuses to provide a tls lib!!!) whereas on apple they provide a linkable tls lib. Sorry about the false alarm