Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure: libiconv-darwin (static) #320448

Closed
pupbrained opened this issue Jun 17, 2024 · 12 comments
Closed

Build failure: libiconv-darwin (static) #320448

pupbrained opened this issue Jun 17, 2024 · 12 comments
Labels
0.kind: build failure 6.topic: darwin Running or building packages on Darwin

Comments

@pupbrained
Copy link
Member

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, #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.

  • system: "aarch64-darwin"
  • host os: Darwin 24.0.0, macOS 15.0
  • multi-user?: yes
  • sandbox: no
  • version: nix-env (Nix) 2.18.2
  • nixpkgs: /Users/marshall/.nix-defexpr/channels/nixpkgs

Add a 👍 reaction to issues you find important.

@eclairevoyant eclairevoyant added the 6.topic: darwin Running or building packages on Darwin label Jun 17, 2024
@toonn
Copy link
Contributor

toonn commented Jun 17, 2024

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
Copy link
Member Author

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
Copy link
Contributor

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
Copy link
Member Author

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
Copy link
Contributor

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 #307880.

@reckenrode
Copy link
Contributor

This should be fixed by #322388.

@reckenrode
Copy link
Contributor

Also requires #322497.

@meetmangukiya
Copy link

meetmangukiya commented Jul 8, 2024

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
Copy link
Contributor

It also depends on #322497, which hasn’t hit master yet.

@shivaraj-bh
Copy link
Member

As #322497 has landed in master (

_accumFlagsArray mesonFlags mesonFlagsArray
), 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
Copy link
Contributor

Thanks for the report. That ld64 failure should be fixed by #330949.

@shivaraj-bh
Copy link
Member

@reckenrode I just built pkgsStatic.libiconv on the branch in your PR and it builds successfully. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: build failure 6.topic: darwin Running or building packages on Darwin
Projects
None yet
Development

No branches or pull requests

6 participants