Hello, today for a special need, I need to build my crystal program statically.
But I have this error, and I don’t know how to fix it.
I have this error in my manjaro virtual machine:
~/ism1 master !2 ?5 crystal build Main.cr --static -o ism ✔
/usr/bin/ld: cannot find -lgc (this usually means you need to install the development package for libgc): No such file or directory
/usr/bin/ld: cannot find -levent (this usually means you need to install the development package for libevent): No such file or directory
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc "${@}" -o /home/zohran/ism1/ism -rdynamic -static -L/usr/bin/../lib/crystal -lm -lgc -lpthread -levent -lrt -lpthread -ldl`
The problem is, there isn’t any dev package for that, or I didn’t found it.
I have a similar error on my main system, gentoo:
zohran@alienware-m17-r3 ~/Documents/Programmation/ISM $ crystal build Main.cr --static -o ism
/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lpcre (this usually means you need to install the development package for libpcre): No such file or directory
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc "${@}" -o /home/zohran/Documents/Programmation/ISM/ism -rdynamic -static -L/usr/bin/../lib/crystal -lpcre -lm -lgc -lpthread -levent -lrt -lpthread -ldl`
[ble: exit 1]