Skip to content

libedit: manually define __STDC_ISO_10646__ to fix the build issue against musl#270143

Merged
emilytrau merged 1 commit intoNixOS:stagingfrom
lxsameer:libedit-musl
Dec 1, 2023
Merged

libedit: manually define __STDC_ISO_10646__ to fix the build issue against musl#270143
emilytrau merged 1 commit intoNixOS:stagingfrom
lxsameer:libedit-musl

Conversation

@lxsameer
Copy link
Contributor

@lxsameer lxsameer commented Nov 26, 2023

Description of changes

Musl is ISO 10646 compliant but doesn't define STDC_ISO_10646 we need to do it ourselves. Without this change, the following build will fail.

pkgsCross.musl64.libedit.override({ stdenv = pkgs.pkgsCross.musl64.llvmPackages_16.libcxxStdenv; })

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • [] Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

I tested the following snippet with and without this patch:

let
    tmpPkgs = import /path/to/nixpkgs {};
    pkgs = import /path/to/nixpkgs {
        crossSystem = tmpPkgs.lib.systems.examples.musl64; 
in tmpPkgs.pkgsCross.musl64.libedit.override({ stdenv = pkgs.pkgsCross.musl64.llvmPackages_16.libcxxStdenv; })

@NixOSInfra NixOSInfra added the 12.first-time contribution This PR is the author's first one; please be gentle! label Nov 26, 2023
@lxsameer lxsameer marked this pull request as ready for review November 26, 2023 14:14
@trofi
Copy link
Contributor

trofi commented Nov 26, 2023

musl.git says include/stdc-predef.h:#define __STDC_ISO_10646__ 201206L. Thus it feels like it should Just Work.

Do you know why the build for pkgsMusl.libedit does not fail today? Could it be that pkgsCross.musl64.llvmPackages_16.libcxxStdenv wrapper is using wrong path to default musl headers?

@trofi
Copy link
Contributor

trofi commented Nov 26, 2023

gcc does pull stdc-predef.h on musl targets as well:

$ nix develop -f. pkgsMusl.libedit
$ dev>echo "" | gcc -E -x c - -o -
# 0 "<stdin>"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/nix/store/0g45f6dknwhrcdlghs83di91rq5yacq0-musl-1.2.3-dev/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2

I think clang should do the same.

@trofi
Copy link
Contributor

trofi commented Nov 26, 2023

…ainst musl

Musl is ISO 10646 compliant but doesn't define __STDC_ISO_10646__ we need to do it ourselves.
@delroth delroth added the 12.approvals: 1 This PR was reviewed and approved by one person. label Nov 26, 2023
@ofborg ofborg bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 1001-2500 This PR causes many rebuilds on Darwin and should most likely target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. labels Nov 26, 2023
@emilytrau emilytrau merged commit 247775d into NixOS:staging Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 1001-2500 This PR causes many rebuilds on Darwin and should most likely target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. 12.approvals: 1 This PR was reviewed and approved by one person. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants