NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.76k stars 13.18k forks source link

Build failure: libiconv-darwin (static) #320448

Open pupbrained opened 1 month ago

pupbrained commented 1 month ago

Steps To Reproduce

Steps to reproduce the behavior:

  1. build libiconv-darwin using pkgsStatic

Build log

structuredAttrs is enabled
@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/3p05yxp4ad18j42azj16fqz56cbn9g1f-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
applying patch /nix/store/ga5bpmxb255s9vv86jbxx9ysj6qja9av-0001-Support-static-module-loading.patch
patching file citrus/citrus_module.c
applying patch /nix/store/sw2bfbv9jfz2b99c8qk178xx06qf1x5i-0002-Fix-ISO-2022-out-of-bounds-write-with-encoded-charac.patch
patching file libiconv_modules/ISO2022/citrus_iso2022.c
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
Running phase: configurePhase
mesonConfigurePhase flags: --prefix=/nix/store/hjxqkapx23av9f09hyayjybs0j6fx1iw-libiconv-static-aarch64-apple-darwin-99 --libdir=/nix/store/hjxqkapx23av9f09hyayjybs0j6fx1iw-libiconv-static-aarch64-apple-darwin-99/lib --libexecdir=/nix/store/hjxqkapx23av9f09hyayjybs0j6fx1iw-libiconv-static-aarch64-apple-darwin-99/libexec --bindir=/nix/store/hjxqkapx23av9f09hyayjybs0j6fx1iw-libiconv-static-aarch64-apple-darwin-99/bin --sbindir=/nix/store/hjxqkapx23av9f09hyayjybs0j6fx1iw-libiconv-static-aarch64-apple-darwin-99/sbin --includedir=/nix/store/i2rd50kax5h5nzqks03djszvnyd8ad7g-libiconv-static-aarch64-apple-darwin-99-dev/include --mandir=/nix/store/hjxqkapx23av9f09hyayjybs0j6fx1iw-libiconv-static-aarch64-apple-darwin-99/share/man --infodir=/nix/store/hjxqkapx23av9f09hyayjybs0j6fx1iw-libiconv-static-aarch64-apple-darwin-99/share/info --localedir=/nix/store/hjxqkapx23av9f09hyayjybs0j6fx1iw-libiconv-static-aarch64-apple-darwin-99/share/locale -Dauto_features=enabled -Dwrap_mode=nodownload --buildtype=release --cross-file=/nix/store/x0qfrc04lqvk97b9zd2hf38mzypyw37c-cross-file.conf
The Meson build system
Version: 1.4.0
Source dir: /private/tmp/nix-build-libiconv-static-aarch64-apple-darwin-99.drv-0/source
Build dir: /private/tmp/nix-build-libiconv-static-aarch64-apple-darwin-99.drv-0/source/build
Build type: cross build
Project name: libiconv
Project version: 99
C compiler for the host machine: aarch64-apple-darwin-clang (clang 16.0.6 "clang version 16.0.6")
C linker for the host machine: aarch64-apple-darwin-clang ld64 609
Compiler for language c for the build machine not found.
Build machine cpu family: aarch64
Build machine cpu: aarch64
Host machine cpu family: aarch64
Host machine cpu: aarch64
Target machine cpu family: aarch64
Target machine cpu: aarch64
Found pkg-config: YES (/nix/store/m7rpqv2vrx7d42bqj285vns9pv697jyq-aarch64-apple-darwin-pkg-config-wrapper-0.29.2/bin/aarch64-apple-darwin-pkg-config) 0.29.2
Traceback (most recent call last):
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/mesonmain.py", line 186, in run
    return options.run_func(options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/msetup.py", line 363, in run
    app.generate()
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/msetup.py", line 187, in generate
    return self._generate(env, capture, vslite_ctx)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/msetup.py", line 226, in _generate
    intr.run()
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreter/interpreter.py", line 3007, in run
    super().run()
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 162, in run
    self.evaluate_codeblock(self.ast, start=1)
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 188, in evaluate_codeblock
    raise e
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 180, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 211, in evaluate_statement
    return self.evaluate_if(cur)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 301, in evaluate_if
    self.evaluate_codeblock(i.block)
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 188, in evaluate_codeblock
    raise e
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 180, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 198, in evaluate_statement
    self.assignment(cur)
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 634, in assignment
    value = self.evaluate_statement(node.value)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 194, in evaluate_statement
    return self.function_call(cur)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 520, in function_call
    res = func(node, func_args, kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/decorators.py", line 799, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/decorators.py", line 799, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/decorators.py", line 799, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  [Previous line repeated 4 more times]
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/decorators.py", line 98, in wrapped
    ret = f(*wrapped_args, **wrapped_kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/decorators.py", line 116, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/decorators.py", line 250, in wrapper
    return f(*nargs, **wrapped_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreterbase/decorators.py", line 569, in wrapper
    return f(*wrapped_args, **wrapped_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreter/interpreter.py", line 1787, in func_dependency
    d = df.lookup(kwargs)
        ^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreter/dependencyfallbacks.py", line 355, in lookup
    dep = func(kwargs, func_args, func_kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/interpreter/dependencyfallbacks.py", line 87, in _do_dependency
    dep = dependencies.find_external_dependency(name, self.environment, kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/dependencies/detect.py", line 114, in find_external_dependency
    d = c()
        ^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/dependencies/pkgconfig.py", line 300, in __init__
    self._set_libs()
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/dependencies/pkgconfig.py", line 516, in _set_libs
    self.link_args, self.raw_link_args = self._search_libs(libs, raw_libs)
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/dependencies/pkgconfig.py", line 455, in _search_libs
    args = self.clib_compiler.find_library(lib[2:], self.env,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/compilers/mixins/clike.py", line 1194, in find_library
    return self._find_library_impl(libname, env, extra_dirs, code, libtype, lib_prefix_warning)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/compilers/mixins/clike.py", line 1183, in _find_library_impl
    value = self._find_library_real(libname, env, extra_dirs, code, libtype, lib_prefix_warning)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/compilers/mixins/clike.py", line 1166, in _find_library_real
    trial = self._get_file_from_list(env, trials)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/compilers/mixins/clike.py", line 1114, in _get_file_from_list
    archs = mesonlib.darwin_get_object_archs(str(p))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/utils/universal.py", line 697, in darwin_get_object_archs
    _, stdo, stderr = Popen_safe(['lipo', '-info', objpath])
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8sp5ijam2lc1sj4y9djghg2rh06qizfx-meson-1.4.0/lib/python3.11/site-packages/mesonbuild/utils/universal.py", line 1518, in Popen_safe
    p = subprocess.Popen(args, universal_newlines=True, encoding=encoding, close_fds=False,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/327bf08j5b7l9cnzink3g4vp32y5352j-python3-3.11.9/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/nix/store/327bf08j5b7l9cnzink3g4vp32y5352j-python3-3.11.9/lib/python3.11/subprocess.py", line 1955, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'lipo'

ERROR: Unhandled python OSError. This is probably not a Meson bug, but an issue with your build environment.

Additional context

From what I can tell, https://github.com/NixOS/nixpkgs/pull/315180 is supposed to fix this issue but it doesn't seem to have changed anything (I have ensured my flake is using the latest version of nixpkgs-unstable, which has this PR merged).

Notify maintainers

@NixOS/darwin-maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.


Add a :+1: reaction to issues you find important.

toonn commented 1 month ago

That PR enables static builds with a flag and such but it doesn't mention lipo anywhere. I think this is just a missing nativeBuildInput.

pupbrained commented 1 month ago

That PR enables static builds with a flag and such but it doesn't mention lipo anywhere. I think this is just a missing nativeBuildInput.

That was my guess too. I seem to get that same error whether I'm using a version of nixpkgs with the PR merged or not. I tried just overriding the package on my end to add bintools but it led to infinite recursion errors.

reckenrode commented 1 month ago

Meson expects to invoke lipo instead of ${targetPrefix}lipo. This should be fixed on my ld64 branch, which provides a couple of tools unprefixed that build systems expect to call that way even when cross-compiling.

pupbrained commented 1 month ago

Meson expects to invoke lipo instead of ${targetPrefix}lipo. This should be fixed on my ld64 branch, which provides a couple of tools unprefixed that build systems expect to call that way even when cross-compiling.

Do you have a link to that branch so I can test it? All good if not.

reckenrode commented 1 month ago

Meson expects to invoke lipo instead of ${targetPrefix}lipo. This should be fixed on my ld64 branch, which provides a couple of tools unprefixed that build systems expect to call that way even when cross-compiling.

Do you have a link to that branch so I can test it? All good if not.

I’m pretty sure it’s been pushed publicly to https://github.com/NixOS/nixpkgs/pull/307880.

reckenrode commented 1 month ago

This should be fixed by https://github.com/NixOS/nixpkgs/pull/322388.

reckenrode commented 1 month ago

Also requires https://github.com/NixOS/nixpkgs/pull/322497.

meetmangukiya commented 3 weeks ago

i tried staging-next, it seems to fail in installCheckPhase with a bunch of failing tests. also looks like staging-next is already in master. the command i tried nix-shell -p pkgsStatic.libiconv --pure -I nixpkgs=https://github.com/nixos/nixpkgs/archive/master.tar.gz

Ok:                 2   
Expected Fail:      0   
Fail:               33  
Unexpected Pass:    0   
Skipped:            0   
Timeout:            0   
reckenrode commented 3 weeks ago

It also depends on https://github.com/NixOS/nixpkgs/pull/322497, which hasn’t hit master yet.

shivaraj-bh commented 8 hours ago

As #322497 has landed in master (https://github.com/NixOS/nixpkgs/blob/12044caded73d743a15f046af5d2967bf8f3192f/pkgs/by-name/me/meson/setup-hook.sh#L28), I tried building pkgsStatic.libiconv. It fails while building ld64-951.9:

@nix { "action": "setPhase", "phase": "installCheckPhase" }
Running phase: installCheckPhase
The Meson build system
Version: 1.4.1
Source dir: /private/tmp/nix-build-ld64-951.9.drv-0/source
Build dir: /private/tmp/nix-build-ld64-951.9.drv-0/source/build-install-check
Build type: native build
Project name: ld64
Project version: 951.9
C compiler for the host machine: clang (clang 16.0.6 "clang version 16.0.6")
C linker for the host machine: clang ld64 951.9
C++ compiler for the host machine: clang++ (clang 16.0.6 "clang version 16.0.6")
C++ linker for the host machine: clang++ ld64 951.9
Host machine cpu family: aarch64
Host machine cpu: aarch64
Program python3 found: YES (/nix/store/1sgajx2r3bkriyxzwsahhva63p08pmac-python3-3.12.4/bin/python3)
Library tapi found: YES
Found pkg-config: YES (/nix/store/hb6wmiz0yrwi0rnhf4xvz6lx616m43xb-pkg-config-wrapper-0.29.2/bin/pkg-config) 0.29.2
Run-time dependency openssl found: YES 3.0.14
Library xar found: YES
Checking if "supports DISPATCH_APPLY_AUTO" compiles: YES
Checking if "supports dispatch_queue_global_t" compiles: YES
Build targets in project: 9

ld64 951.9

  User defined options
    buildtype: release
    b_lto    : true

Found ninja-1.12.1 at /nix/store/9vzvg3xc0nwm8dmmn18fnw784d9h8d9v-ninja-1.12.1/bin/ninja
ninja: error: unknown target 'aarch64-apple-darwin-ld'
reckenrode commented 6 hours ago

Thanks for the report. That ld64 failure should be fixed by https://github.com/NixOS/nixpkgs/pull/330949.