OpenRC / openrc

The OpenRC init system
BSD 2-Clause "Simplified" License
1.47k stars 247 forks source link

Really need a comprehensive guide on building #736

Open Kiwifuit opened 2 months ago

Kiwifuit commented 2 months ago

Just started making my own linux from scratch and I cant seem to build a static binary for it

I have set the following options:

  User defined options
    backend        : ninja
    buildtype      : release
    default_library: static
    strip          : True
    branding       : openlinux
    pam            : false
    rootprefix     : /tmp/final/initramfs/

but when i do file initramfs/sbin/openrc i get a dynamically compiled binary:

initramfs/sbin/openrc: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=e252c588c31d05a1e85f359253fb26e9d5eada81, for GNU/Linux 3.2.0, stripped

Is it possible to create a comprehensive guide on how to build openrc statically?

sertonix commented 1 month ago

To build statically linked with meson I recommend to always use all of these options: -Dc_link_args=-static -Ddefault_library=static -Dprefer_static=true.

Also meson will silently use dynamically linked libraries when it can't find statically linked ones. So check that all the *.a files are there.