serenity
serenity copied to clipboard
Ports: Building "file" fails due to version mismatch
Steps to reproduce:
- Install Debian stable (or anything else that uses
file
in a version different from5.44
; Debian stable uses5.39
at the time of writing) - Install the package
file
(which pulls in dependencies likelibmagic1
andlibmagic-mgc
), take care to install version5.39
(or any version other than 5.44) - Build serenity
- In
$SERENITY_ROOT/Ports/file
, run./package.sh
Expected behavior: Builds and installs just fine
Actual behavior: Fails to install, apparently it tries to use some host files; presumably the host magic files?
[file/build] CC dprintf.lo
<SNIP some warnings in funcs.c and der.c>
[file/build] CCLD libmagic.la
[file/build] CCLD file
[file/build] make.real[3]: Leaving directory '/home/user/serenity/Build/x86_64/Ports/file/file-5.44/src'
[file/build] make.real[2]: Leaving directory '/home/user/serenity/Build/x86_64/Ports/file/file-5.44/src'
[file/build] Making all in magic
[file/build] make.real[2]: Entering directory '/home/user/serenity/Build/x86_64/Ports/file/file-5.44/magic'
[file/build] Cannot use the installed version of file (5.39) to
[file/build] cross-compile file 5.44
[file/build] Please install file 5.44 locally first
[file/build] make.real[2]: *** [Makefile:862: magic.mgc] Error 1
[file/build] make.real[2]: Leaving directory '/home/user/serenity/Build/x86_64/Ports/file/file-5.44/magic'
[file/build] make.real[1]: *** [Makefile:462: all-recursive] Error 1
[file/build] make.real[1]: Leaving directory '/home/user/serenity/Build/x86_64/Ports/file/file-5.44'
[file/build] make.real: *** [Makefile:371: all] Error 2
Error in step file/build (status=2)
CC @supercomputer7, you seemed interested in this.
See also #18238.
So I looked at this again today, we basically have 2 options:
- Build
file
with the host compiler and use it for bootstrapping a cross-compiled version. - Remove this port if we don't want it anymore, as we have our own implementation (albeit it is lacking in the features' aspect).
I'd suggest trying the first option, but it's quite silly to require a natively-compiled version to do bootstrapping of a cross-compiled version (but then it's not doing that automatically).
The ports for Python3 and Ruby also have this requirement, but we have scripts in Toolchain to build the host version from source. Requiring it for a utility like file does seem kinda silly though. Not sure what the best approach is. @timschumi What do you think? Toolchain/BuildFile.sh, or yeet the port?
We only rarely yeet ports, so of those two options I'd rather have a BuildFile.sh
(or just some host_env
trickery?).
We only rarely yeet ports, so of those two options I'd rather have a
BuildFile.sh
(or just somehost_env
trickery?).
I rather not add another build script (that is counter intuitive in my opinion, because this port is quite somewhat niche) just because some port requires a matched-version of the software it will compile. Maybe we could bootstrap it when we actually build the port package, so it's done automatically in the port package script?