Skip to content

GNUmakefile: Support CARGO_BUILD_TARGET#9223

Merged
Ecordonnier merged 13 commits intouutils:mainfrom
oech3:cargo-build-target
Jan 12, 2026
Merged

GNUmakefile: Support CARGO_BUILD_TARGET#9223
Ecordonnier merged 13 commits intouutils:mainfrom
oech3:cargo-build-target

Conversation

@oech3
Copy link
Contributor

@oech3 oech3 commented Nov 11, 2025

Fixes #9206 . Removes RUSTC_ARCH variable.

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)

@oech3
Copy link
Contributor Author

oech3 commented Nov 11, 2025

@XhstormR Would you review this? Tests are failing with

env --unset CARGO_BUILD_TARGET cargo build  ...
env: CARGO_BUILD_TARGET: No such file or directory
make: *** [build-uudoc] Error 127

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

@XhstormR
Copy link

XhstormR commented Nov 11, 2025

@oech3 MacOS' env dont support --unset flag, if you use --unset=CARGO_BUILD_TARGET, you will get a clearer error message.

└──❯ /usr/bin/env --unset CARGO_BUILD_TARGET
env: CARGO_BUILD_TARGET: No such file or directory
└──❯ /usr/bin/env --unset=CARGO_BUILD_TARGET
env: unsetenv nset=CARGO_BUILD_TARGET: Invalid argument

should use env CARGO_BUILD_TARGET= cargo build ...

user@c02fldw5md6m ~ %  /usr/bin/env USER=  sh -c 'echo "$USER"'

user@c02fldw5md6m ~ %  sh -c 'echo "$USER"'       
user

@oech3

This comment was marked as resolved.

@oech3 oech3 force-pushed the cargo-build-target branch from 6134f2a to c83f76d Compare November 11, 2025 08:04
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

@oech3 oech3 requested a review from XhstormR November 11, 2025 09:11
@oech3
Copy link
Contributor Author

oech3 commented Nov 11, 2025

@Ecordonnier You will prefer this approarch instread of adding srange variable.

@XhstormR
Copy link

@oech3 Doesn't @unset CARGO_BUILD_TARGET simply mean clearing the CARGO_BUILD_TARGET environment variable?

I also think it's unnecessary to clear the CARGO_BUILD_TARGET variable. Instead, we should check the CARGO_BUILD_TARGET variable, and if it's set, add it to BUILDDIR, then we don't need to change the uudoc path, as I mentioned before:

ifdef CARGO_TARGET_DIR
BUILDDIR      := $(CARGO_TARGET_DIR)/${PROFILE}
else ifdef CARGO_BUILD_TARGET  
BUILDDIR      := $(BASEDIR)/target/$(CARGO_BUILD_TARGET)/${PROFILE}
else
BUILDDIR      := $(BASEDIR)/target/${PROFILE}
endif

@oech3
Copy link
Contributor Author

oech3 commented Nov 11, 2025

For simplity, does BUILDDIR := $(BASEDIR)/target/$(CARGO_BUILD_TARGET)/${PROFILE} cover the case CARGO_BUILD_TARGET is undefined?

@oech3 oech3 force-pushed the cargo-build-target branch from a9571ed to 2dda1fd Compare November 11, 2025 09:53
@XhstormR
Copy link

@oech3 add else if check

ifdef CARGO_TARGET_DIR
BUILDDIR      := $(CARGO_TARGET_DIR)/${PROFILE}
+ else ifdef CARGO_BUILD_TARGET  
+ BUILDDIR      := $(BASEDIR)/target/$(CARGO_BUILD_TARGET)/${PROFILE}
else
BUILDDIR      := $(BASEDIR)/target/${PROFILE}
endif```

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

@oech3
Copy link
Contributor Author

oech3 commented Nov 11, 2025 via email

@oech3
Copy link
Contributor Author

oech3 commented Nov 11, 2025

Doesn't unset CARGO_BUILD_TARGET simply mean clearing the CARGO_BUILD_TARGET environment variable?

We need it since we use native uudoc.

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

@oech3 oech3 force-pushed the cargo-build-target branch from ef38ab4 to 88f1dd9 Compare November 14, 2025 04:22
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

@oech3 oech3 force-pushed the cargo-build-target branch from 384c335 to a0c64c2 Compare November 17, 2025 01:33
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 17, 2025

Merging this PR will not alter performance

✅ 141 untouched benchmarks
⏩ 38 skipped benchmarks1


Comparing oech3:cargo-build-target (967a428) with main (0d403a4)

Open in CodSpeed

Footnotes

  1. 38 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

@oech3
Copy link
Contributor Author

oech3 commented Nov 23, 2025

@sylvestre Is this OK to merge? 0 change for 1 week.

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/mv/hardlink-case is now passing!

@oech3
Copy link
Contributor Author

oech3 commented Dec 22, 2025

ok?

@oech3
Copy link
Contributor Author

oech3 commented Jan 10, 2026

I'm not hyper interested in this PR. But ping.

# CARGO_BUILD_TARGET should be undefined for native (non-cross) build.
BASEDIR ?= $(shell pwd)
ifdef CARGO_TARGET_DIR
BUILDDIR := $(CARGO_TARGET_DIR)/${PROFILE}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should define BUILDDIR_UUDOC at lines 49 and 51 and take CARGO_TARGET_DIR into account. The problem with current state of the PR is that:

  1. "$(BASEDIR)/target/$(PROFILE)/uudoc" is duplicated 4 times
  2. it doesn't work with CARGO_TARGET_DIR:
env CARGO_TARGET_DIR=foobar CARGO_BUILD_TARGET=aarch64-unknown-linux-gnu make install-manpages PREFIX=/tmp/usr UTILS=true
mkdir -p /tmp/usr/share/man/man1
/home/asteba/dev/coreutils/target/debug/uudoc manpage true > /tmp/usr/share/man/man1/true.1 
/bin/sh: 1: /home/asteba/dev/coreutils/target/debug/uudoc: not found
make: *** [GNUmakefile:389: install-manpages] Error 127
...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ifdef CARGO_TARGET_DIR
BUILDDIR := $(CARGO_TARGET_DIR)/${PROFILE}
BUILDDIR_UUDOC := $(CARGO_TARGET_DIR)/${PROFILE}
else
BUILDDIR := $(BASEDIR)/target/$(CARGO_BUILD_TARGET)/${PROFILE}
BUILDDIR_UUDOC := $(BASEDIR)/target/${PROFILE}
endif

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have @unset CARGO_BUILD_TARGET && ${CARGO} build ${CARGOFLAGS} --bin uudoc .... Not enough?
I add BUILDDIR_UUDOC in any case.

Copy link
Collaborator

@Ecordonnier Ecordonnier Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not enough, setting @unset CARGO_BUILD_TARGET does not have an impact on CARGO_TARGET_DIR. The issue is that the build directory is not under BASEDIR when setting CARGO_TARGET_DIR to another directory.

@Ecordonnier
Copy link
Collaborator

I'm not hyper interested in this PR. But ping.

The PR is a good change. Please fix the one issue I mentioned and I'll merge it.

@Ecordonnier Ecordonnier self-requested a review January 12, 2026 07:38
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/shuf/shuf-reservoir (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/sort/sort-stale-thread-mem (fails in this run but passes in the 'main' branch)

@Ecordonnier Ecordonnier merged commit 40e50ba into uutils:main Jan 12, 2026
135 of 136 checks passed
@oech3 oech3 deleted the cargo-build-target branch January 12, 2026 13:03
@Ecordonnier
Copy link
Collaborator

@oech3 btw can you please correct your git email configuration? Your commits have no email configured for the Author, but they have an email for the Committer. This makes github show two different people for the commits ( see 97f8a08 for instance ):

Author: oech3 <>  2026-01-10 16:43:26
Committer: oech3 <79379754+oech3@users.noreply.github.com>  2026-01-12 09:13:08

@oech3
Copy link
Contributor Author

oech3 commented Jan 12, 2026

Can I set both empty?

@Ecordonnier
Copy link
Collaborator

Ecordonnier commented Jan 12, 2026

Can I set both empty?

I would set both to 79379754+oech3@users.noreply.github.com , I think having an empty email is quite uncommon.

@oech3
Copy link
Contributor Author

oech3 commented Jan 12, 2026

Is @.noreply.* not auto-generated one at each commit?

@Ecordonnier
Copy link
Collaborator

Is @.noreply.* not auto-generated one at each commit?

No, if you go to https://github.com/settings/emails , at the bottom of the page you see your "public profile email". This email is permanent.

@oech3
Copy link
Contributor Author

oech3 commented Jan 12, 2026

This email is permanent.

OK.

oech3 added a commit to oech3/coreutils that referenced this pull request Jan 13, 2026
mattsu2020 pushed a commit to mattsu2020/coreutils that referenced this pull request Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

uudoc: No such file or directory

4 participants