serenity icon indicating copy to clipboard operation
serenity copied to clipboard

Ports: Building "file" fails due to version mismatch

Open BenWiederhake opened this issue 1 year ago • 4 comments

Steps to reproduce:

  • Install Debian stable (or anything else that uses file in a version different from 5.44; Debian stable uses 5.39 at the time of writing)
  • Install the package file (which pulls in dependencies like libmagic1 and libmagic-mgc), take care to install version 5.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.

BenWiederhake avatar Apr 17 '23 17:04 BenWiederhake

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).

supercomputer7 avatar May 11 '24 17:05 supercomputer7

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?

ADKaster avatar May 11 '24 23:05 ADKaster

We only rarely yeet ports, so of those two options I'd rather have a BuildFile.sh (or just some host_env trickery?).

timschumi avatar May 11 '24 23:05 timschumi

We only rarely yeet ports, so of those two options I'd rather have a BuildFile.sh (or just some host_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?

supercomputer7 avatar May 14 '24 07:05 supercomputer7