xbps-src: Fails to cross compile when -a specified for target only differing in libc

Open
#62,787 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
shell
Domain
build-system

Research direction

Start by reading the referenced xbps-src condition at lines 532–542 and trace how host and target architectures are set when -a is supplied. Reproduce with ./xbps-src pkg -a x86_64 <example_package> on a host with a different libc, then inspect the build output. Done means the package builds without attempting to install an invalid cross toolchain.

Written by the indexing model from the issue text.

Description

bug needs-testing
Is this a new report?

Yes

System Info

Void 6.18.54_1 x86_64-musl AuthenticAMD uptodate rrrFFF

Package(s) Affected

void-packages

Does a report exist for this bug with the project's home (upstream) and/or another distro?

No response

Expected behaviour

xbps-src cross compiles and builds a given package correctly, using a cross toolchain to target a different libc.

Actual behaviour

The following error message is produced and the build process fails:

ERROR: Could not find package 'cross-x86_64-linux-gnu'
=> ERROR: cross-x86_64-linux-gnu-0.37_2: cannot be built, it's currently broken; see the build log:
=> ERROR: cross-x86_64-linux-gnu-0.37_2: Can't build crosstoolchain to itself

I found that this was due to this condition, which changes the host machine to match the target's libc:

https://github.com/void-linux/void-packages/blob/e50262ed1b7052f028112add290235b95bda5137/xbps-src#L532-L542

In cases where the target only differs from the original host in its libc, this makes the host and target architectures identical, which in turn causes an invalid cross toolchain package to be attempted to be installed.

I wasn't sure of the best approach towards fixing this issue, especially as it seems that, in many cases, xbps-src is re-executed during the build process. I thought one possible solution may be to disable cross compilation in all cases when the target architecture matches the host architecture, but I was unsure if this was viable.

Steps to reproduce
  1. Run ./xbps-src pkg -a <arch> <example_package>, where <arch> is the same as the host architecture except for the libc. For example, I would use -a x86_64 on my x86_64-musl machine.
Dominant language
Shell
Stars
3.5k
Forks
2.8k
Avg merge
1d 23h
Merged PRs (30d)
325

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from void-linux/void-packages

All issues in void-linux/void-packages

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.