Rust - Production Adventure
Glibc and Musl..
Hi everyone,
I'm developing a project for a while with Rust for a special company. When i finished the project, i prepared the server to deploy app.
I have compiled the project on Windows for Linux. ( i know it's wrong, but i tried :) ) I encountered many problems while compiling Rust for Linux on Windows.
First:
I compiled with basic target parameter.
cargo build --release --target x86_64-unknown-linux-gnu
I got this error
= note: the `x86_64-unknown-linux-gnu` target may not be installed
OK :(
I installed target with rustup
rustup target add x86_64-unknown-linux-gnu
Fine, continue..
We compile once more
cargo build --release --target x86_64-unknown-linux-gnu
aaanddd..
error: linker `cc` not found
😥
loading headcache..
Without trying more on Windows, i installed Ubuntu Subsystem for Windows.
I found my project by accessing the main folder on subsystem; like this
cd /mnt/c/Users/#user_name#/Desktop/Project
We compile one more time
cargo build --release --target x86_64-unknown-linux-gnu
oohh, come on. where is the error ?
ok calm, it's here
version `GLIBC_2.18' not found
GLIBC, the implementation of Standart C Library.
I researched for a long time for glibc problem.
I have worked with musl before. I installed musl without dealing with glibc. Musl, is a libc. An implementation of standart library.
What are the differences between glibc and musl?
glibc faster than musl but musl uses less space and it has been written in a more secure way and it has less security pitfalls.
ok, continue..
Install musl,
apt-get install musl-tools
change the target for musl
rustup target add x86_64-unknown-linux-musl
and compile
cargo build --release --target x86_64-unknown-linux-musl
I finally compiled without any problems.