Systemd
編譯 Systemd 獨立二進製文件時遇到問題
來源:systemd-stable-251:https ://github.com/systemd/systemd-stable
wget https://github.com/systemd/systemd-stable/archive/refs/heads/v251-stable.zip unzip v251-stable.zip cd systemd-stable-251-stable/
使用命令:
./configure --auto-features=disabled \ --default-library=static \ -D standalone-binaries=true \ -D static-libsystemd=true \ -D static-libudev=true \ -D link-udev-shared=false \ -D link-systemctl-shared=false \ -D link-networkd-shared=false \ -D link-timesyncd-shared=false \ -D link-boot-shared=false && make
還嘗試僅使用靜態庫並僅啟用獨立選項。
配置:
Features enabled : IMA, SELinux, SMACK, blkid, gcrypt, gnutls, libidn2, openssl, p11kit, xkbcommon, xz, zlib, bzip2, backlight, binfmt, coredump, environment.d, efi, firstboot, hibernate, hostnamed, hwdb, initrd, kernel-install, localed, logind, machined, networkd, nss-myhostname, nss-mymachines, nss-resolve, nss-systemd, oomd, portabled, pstore, quotacheck, randomseed, resolve, rfkill, sysext, systemd-analyze, sysusers, timedated, timesyncd, tmpfiles, userdb, vconsole, xdg-autostart, idn, polkit, nscd, dbus, glib, tpm, SysV compat, utmp, ldconfig, adm group, wheel group, gshadow, standalone-binaries, static-libsystemd(true), static-libudev(true), cryptolib(gcrypt), DNS-over-TLS(openssl) disabled : ACL, AUDIT, AppArmor, PAM, SECCOMP, elfutils, libbpf, libcryptsetup, libcryptsetup-plugins, libcurl, libfdisk, libfido2, libidn, libiptc, microhttpd, pcre2, pwquality, qrencode, tpm2, zstd, lz4, bpf-framework, gnu-efi, homed, importd, repart, sysupdate, legacy-pkla, kmod, man pages, html pages, man page indices, compat-mutable-uid-boundaries, debug hashmap, debug mmap cache, debug siphash, valgrind, trace logging, install tests, link-udev-shared, link-systemctl-shared, link-networkd-shared, link-timesyncd-shared, link-boot-shared, fexecve, coverage
使用者定義選項 auto_features : 禁用 default_library : 靜態 link-boot-shared : false link-networkd-shared : false link-systemctl-shared : false link-timesyncd-shared : false link-udev-shared : false 獨立二進製文件 : true static -libsystemd:真靜態libdev:真
共享對象:
# file build/udevadm build/udevadm: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=f6b7c1a3509d45ebcafda9b49f4dd2332e786738, with debug_info, not stripped
我期待看到一個 ELF 執行檔而不是共享對象文件。
選項的文件
standalone-binaries
說:還建構支持的二進製文件的獨立版本
這似乎充其量是模棱兩可的。查看
meson_build
文件,我們發現:if have_standalone_binaries exe = executable( 'systemd-sysusers.standalone', [...] if have_standalone_binaries exe = executable( 'systemd-tmpfiles.standalone', [...]
這似乎表明該選項僅影響
systemd-sysusers
andsystemd-tmpfiles
,實際上,當建構完成時,我們看到:$ ls build/*.standalone build/systemd-sysusers.standalone build/systemd-tmpfiles.standalone
看起來事情正在按設計執行。