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

Add Cocoa to propagatedBuildInputs for tk #96267

Closed
wants to merge 1 commit into from

Conversation

hannesweisbach
Copy link
Contributor

Otherwise packages using tk will not link correctly

Motivation for this change

I am trying to compile KiCad for macOS. Both tk and opencascade-occt are dependencies. opencascade-occt was not linking correctly for me because Cocoa was missing. So I added Cocoa to opencascade-occt buildInputs via an overlay. Upon closer inspection I found that opencascade-occt does not depend on Cocoa, but only tk. tk in turn depends on Cocoa on macOS and has Cocoa as buildInput set.

I believe the correct thing is to set Cocoa in propagatedBuildInputs of tk to allow packages depending on tk (such as opencascade-occt) to link correctly.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Otherwise packages using tk will not link correctly
@SuperSandro2000
Copy link
Member

I am currently building this PR and got two unrelated build failures so far and this one:

builder for '/nix/store/ij3lr4jhc67zbmh3h7ni1plm21lhbsk2-pypy-7.3.1.drv' failed with exit code 1; last 10 log lines:
  [Timer] ===========================================
  [Timer] Total:                         --- 8311.6 s
  installing
  Traceback (most recent call last):
    File "<module>", line 1, in <module>
    File "/nix/store/4iq67wyg2pb1s1zy6j6ny9qrvphmmhpn-pypy-7.3.1/pypy-c/lib-python/2.7/lib-tk/Tkinter.py", line 39, in <module>
      import _tkinter # If this fails your Python may not be configured for Tk
    File "/nix/store/4iq67wyg2pb1s1zy6j6ny9qrvphmmhpn-pypy-7.3.1/pypy-c/lib_pypy/_tkinter/__init__.py", line 13, in <module>
      from .tklib_cffi import ffi as tkffi, lib as tklib
  ImportError: No module named _tkinter.tklib_cffi`

I am not sure if this is related to this PR or not. Do you have any idea?

@hannesweisbach
Copy link
Contributor Author

Hey,

I don't know but I'm not sure how it could? How causes adding Cocoa to propagatedBuildInputs a missing/not found tkinter ffi? (Cocoa was a dependency before, I just moved it from buildInputs to propagatedBuildInputs for it to be available in the public link interface.)

Does it compile without the patch?

tkinter is optional for the python packages (tkinter ? null) and I think the default on macOS is a minimal python version where stripTkinter = true and:

[…]
optionalString stripTkinter ''
    rm -R $out/lib/python*/tkinter
" […]

which could definitely cause your issue. I think. Maybe. Likely.

@SuperSandro2000
Copy link
Member

SuperSandro2000 commented Oct 26, 2020

I don't know but I'm not sure how it could?

No clue either.

Does it compile without the patch?

Currently compiling... (Note to myself: only compile over night. PyPy takes forever to compile.)

After over 150 minutes:

installing
Traceback (most recent call last):
  File "<module>", line 1, in <module>
  File "/nix/store/cnidc5cq20f6p144i3yx8d9mlni99nax-pypy-7.3.1/pypy-c/lib-python/2.7/lib-tk/Tkinter.py", line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
  File "/nix/store/cnidc5cq20f6p144i3yx8d9mlni99nax-pypy-7.3.1/pypy-c/lib_pypy/_tkinter/__init__.py", line 13, in <module>
    from .tklib_cffi import ffi as tkffi, lib as tklib
ImportError: No module named _tkinter.tklib_cffi
builder for '/nix/store/jmm16c1f1666p5i7v8xy22kdi29q0y03-pypy-7.3.1.drv' failed with exit code 1
error: build of '/nix/store/jmm16c1f1666p5i7v8xy22kdi29q0y03-pypy-7.3.1.drv' failed

@stale
Copy link

stale bot commented Apr 26, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Apr 26, 2021
@wegank wegank closed this Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 11-100 10.rebuild-linux: 0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants