Skip to content

Conversation

@qbisi
Copy link
Contributor

@qbisi qbisi commented Jan 9, 2026

This code snippet will fail to compile on loongarch64 (see https://github.com/ampl/asl/blob/master/src/solvers/fpinit.c#L1437-L148)

#if defined(_FPU_IEEE) && defined(_FPU_EXTENDED) && defined(_FPU_DOUBLE)
	__fpu_control = _FPU_IEEE - _FPU_EXTENDED + _FPU_DOUBLE;
	_FPU_SETCW(__fpu_control);
#elif defined(__i386__) || defined(__x86_64__)
	__fpu_control = 0x27f;
	_FPU_SETCW(__fpu_control);
#elif defined(FE_ALL_EXCEPT)
	fedisableexcept(FE_ALL_EXCEPT);
#else
	!!!! How does this system work?
	!!!! Either figure it out (and modify this text),
	!!!! or compile fpinit.c with -DNO_fpu_control .

cause having macro FE_ALL_EXCEPT does not mean we have func fedisableexcept

according to chatgpt

架构 FE_ALL_EXCEPT fedisableexcept()
x86_64
i386
aarch64
armv7
riscv64
loongarch64
musl (any)

cc @wegank should we do the same for riscv and musl? i can only valid this pr on loongarch64.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@nixpkgs-ci nixpkgs-ci bot requested a review from aanderse January 9, 2026 02:07
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. labels Jan 9, 2026
@wegank
Copy link
Member

wegank commented Jan 9, 2026

For riscv64-linux, sure, I've checked that libamplsolver fails to build there without -DNO_fpu_control.

For Musl on exotic platforms (apparently, x86_64-linux and aarch64-linux do not need the flag), I would say it's not worth the effort...

@wegank wegank changed the title libamplsolver: fix build on loongarch64 libamplsolver: fix build on non-trapping FP architectures Jan 9, 2026
@wegank wegank added 6.topic: riscv64 RISC-V is an open standard instruction set architecture 6.topic: loongarch64 LoongArch, a new RISC ISA used on Loongson CPUs labels Jan 9, 2026
@nixpkgs-ci nixpkgs-ci bot added 12.approvals: 1 This PR was reviewed and approved by one person. 2.status: merge-bot eligible This PR can be merged by commenting "@NixOS/nixpkgs-merge-bot merge". labels Jan 9, 2026
@aanderse aanderse added this pull request to the merge queue Jan 9, 2026
Merged via the queue into NixOS:master with commit 42ca2fa Jan 9, 2026
34 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge-bot eligible This PR can be merged by commenting "@NixOS/nixpkgs-merge-bot merge". 6.topic: loongarch64 LoongArch, a new RISC ISA used on Loongson CPUs 6.topic: riscv64 RISC-V is an open standard instruction set architecture 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants