FS#75179 - [devtools] makechrootpkg Doesn't Respect Non-Default CARCH Values

Attached to Project: Arch Linux
Opened by Neko-san (Neko-san) - Tuesday, 28 June 2022, 16:23 GMT
Last edited by Levente Polyak (anthraxx) - Tuesday, 28 June 2022, 20:33 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
Changing the default CARCH value in makepkg.conf for makechrootpkg usage is not respected and displays a message about unsupported architectures despite being told in the relevant configuration files that any/the specified architecture *is* supported.
This shouldn't be the case; as long as the CPU supports it, makechrootpkg shouldn't bar the user from building their packages the way they specify.

Additional info:
* package version(s): 20220207-2
* config and/or log files etc.: https://gist.github.com/ThisNekoGuy/eb50f80cd6d99bcc349f35e5fe168dfc
* link to upstream bug report, if any: https://bbs.archlinux.org/viewtopic.php?pid=2043230#p2043230

Steps to reproduce:
1) Create a local repo for building packages
2) Initialize the repo and build any package via makechrootpkg
3) Change the chroot's makepkg.conf CARCH value with any compiler-accepted architecture value (optionally, do so on the host as well; it shouldn't make a difference[?], but I did do this)
4) Append this architecture value to pacman.conf's "Architecture" variable and additionally replace its "auto" value with x86_64, in case "auto" interferes
5) Run makechrootpkg to build any package again; this should fail, complaining that the system doesn't support the specified architecture despite being explicitly told that it does
This task depends upon

Closed by  Levente Polyak (anthraxx)
Tuesday, 28 June 2022, 20:33 GMT
Reason for closing:  Not a bug
Comment by Morten Linderud (Foxboron) - Tuesday, 28 June 2022, 16:37 GMT
You need to provide full error messages.

Is this because `setarch` is failing? Did you create the proper config files in `/usr/share/devtools/`?

Reading this bugreport it mostly seems like you are using devtools wrong, but it's hard to tell.
Comment by Levente Polyak (anthraxx) - Tuesday, 28 June 2022, 17:15 GMT
I second what Morten pointed out. My most likely guess matches: You may have forgotten the mapping in `setarch-aliases.d/znver2` to x86_64 by adding a single ascii line `x86_64` to that file.
Comment by Neko-san (Neko-san) - Tuesday, 28 June 2022, 17:20 GMT
It does seem to be because setarch is failing:
setarch: znver2: Unrecognized architecture

I've not read anything about needing config files in /usr/share/devtools for the wiki page about makepkg, so I hadn't known/don't know its significance to the problem, to be clear
Comment by Levente Polyak (anthraxx) - Tuesday, 28 June 2022, 17:21 GMT
@Jose: That confirms the expectation. If you follow my steps and make sure that setarch-aliases.d gets distributed into /usr/share/devtools/ you should be fine.
Comment by Neko-san (Neko-san) - Tuesday, 28 June 2022, 17:28 GMT
Interesting; I'll try that
Honestly though... would be great if this was automated via arch detection like: /lib/ld-linux-x86-64.so.2 --help | grep -w "^ x86-64" | cut -d "," -f 1
or something akin to it if a non-default value is detected...

I don't mean to sound like a bother but it would make this cleaner from a usage standpoint, at least from my perspective :/
I'm quite surprised something like it didn't already already exist to determine the requested architecture association to x64
Comment by Levente Polyak (anthraxx) - Tuesday, 28 June 2022, 17:36 GMT
This flexibility is specifically to allow fine grained architecture mapping, providing sets for `i686` and `pentium4` as an example on the very same system. Using detection like relying on the ld soname is fragile at best. Requiring explicit mapping to host architectures is the safest way to ensure no unexpected implicit mapping happens just because we tried to magically guess a non system architecture to something that potentially leads to more surprises than a failing `setarch` call.
Comment by Morten Linderud (Foxboron) - Tuesday, 28 June 2022, 17:39 GMT
It should also be noted that devtools is packaged and written to support the development of Arch Linux. It doesn't make a lot of sense to include a bunch of architectures Arch doesn't support.
Comment by Neko-san (Neko-san) - Tuesday, 28 June 2022, 17:49 GMT
@Levente
I did say explicitly "something like it," I'm not trying to suggest something flimsy, I'm just referencing the concept. Obviously, if one would attempt such, it should be done right and in a predictable and verifiable manner.
@Morten
Regardless, we're still talking about x64 architectures here, so that's honestly kind of off-base... We're still using the same instruction sets...
Unless you mean to say anything that isn't explicitly x64, from which point I'd refer you to the mailing lists discussing implementing x86-64-v3 repos officially, making that train of thought kind of a moot point...
Variations of x64 are the future, sorry to say
Comment by Morten Linderud (Foxboron) - Tuesday, 28 June 2022, 17:58 GMT
We support x86_64 and -v3 is being planned, yes? znver2 nor any other architectures are supported, discussed nor planned. Supporting them doesn't make sense for the developer tooling. Don't just jump to conclusions please.
Comment by Neko-san (Neko-san) - Tuesday, 28 June 2022, 18:30 GMT
I wasn't blanketing that statement over Arch specifically; all I was saying is that, if the instruction sets exist, they're going to be used by people regardless of what's officially supported. That's the reality.
One could say that this topic is relevant to building packages locally via makepkg with v3 because it's just as susceptible to the problem, since it's not "x86-64," but I know the response I'll get is "then we'll just add v3" -- I'm not jumping to conclusions, I'm just saying it's stupid to inhibit the tools to do what people already do just for the sake of what Arch supports on paper.
The reality is, a user's system will support what it does: it's their computer.
Comment by Levente Polyak (anthraxx) - Tuesday, 28 June 2022, 18:34 GMT
back to the main topic: does the suggestion work for you or not?
Comment by Neko-san (Neko-san) - Tuesday, 28 June 2022, 18:47 GMT
Yeah, it technically does; except this naturally gets blocked by normal `makepkg` whenever a PKGBUILD "arch" variable doesn't include the specified CARCH, of course. And modifying makepkg.conf to attempt to override it doesn't work.
But yes, makechrootpkg doesn't have a problem with it.
Comment by Levente Polyak (anthraxx) - Tuesday, 28 June 2022, 19:32 GMT
devtools is designed to work independently of host configurations if you set the wrappers up properly, the makepkg.conf will be like @pkgdatadir@/makepkg-${arch}.conf or even @pkgdatadir@/makepkg-${repo}-${arch}.conf so a host invocation of normal `makepkg` will never pick up any of those variables.
Comment by Neko-san (Neko-san) - Tuesday, 28 June 2022, 20:22 GMT
So what method then how would be applicable to makepkg?
As it stands, there isn't really an alternative for achieving this automically besides a solution akin to what devtools has, until that changes otherwise.

Loading...