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

pythonPackages.tkinter: fix darwin build #37141

Merged
merged 1 commit into from Mar 18, 2018

Conversation

knedlsepp
Copy link
Member

Motivation for this change

18.03 ZHF darwin edition: #36454 (Please backport to 18.03!)
I looked over to homebrew for how they build their python and took the lovely patch:
https://github.com/Homebrew/homebrew-core/blob/8d530a70f8fcf02129d924090d73efbe12ff438d/Formula/python.rb#L378-L425
Fixes #10667

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@LnL7
Copy link
Member

LnL7 commented Mar 16, 2018

@GrahamcOfBorg build stabber profanity

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: profanity

The following builds were skipped because they don't evaluate on x86_64-linux: stabber

Partial log (click to expand)

copying path '/nix/store/zl45w1h1lfywyz4b9ffnsc8988ydhprl-libgcrypt-1.8.2-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/pjw5r8xfxsf90qa6jl8zxcm837hvif7r-npth-1.5' from 'https://cache.nixos.org'...
copying path '/nix/store/37vyr6djvgbs52mqjn98s766570dcj2x-openldap-2.4.45' from 'https://cache.nixos.org'...
copying path '/nix/store/9b1d0xha9224x6qwpp9xpp7gn46wr54g-libotr-4.1.1' from 'https://cache.nixos.org'...
copying path '/nix/store/4sdim6njsvmfbmqxl24vlszawg9c51ac-pcsclite-1.8.23' from 'https://cache.nixos.org'...
copying path '/nix/store/cxsk92wxsyfna2pgrrxg6g7vwaxraz0x-pinentry-1.1.0' from 'https://cache.nixos.org'...
copying path '/nix/store/wif21wdw8ac243dkijmm2h5aazl3wdsc-gnupg-2.2.5' from 'https://cache.nixos.org'...
copying path '/nix/store/gb8wrlb0fjak7apqwldic0q9b3gzb3cd-gpgme-1.10.0' from 'https://cache.nixos.org'...
copying path '/nix/store/n8g03cag1pyhb5awkcy75znqhfx6gp2f-profanity-0.5.1' from 'https://cache.nixos.org'...
/nix/store/n8g03cag1pyhb5awkcy75znqhfx6gp2f-profanity-0.5.1

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: profanity

The following builds were skipped because they don't evaluate on aarch64-linux: stabber

Partial log (click to expand)

these paths will be fetched (0.34 MiB download, 1.76 MiB unpacked):
  /nix/store/8dndjh87a6193aa05p1vqx0xl6w5qrxr-libmesode-0.9.1
  /nix/store/ijp17f5wq7kkxv64isi1cicxq607px83-profanity-0.5.1
  /nix/store/n1d0hvf7azc35zigv6m32if74i3z0n7l-libotr-4.1.1
copying path '/nix/store/8dndjh87a6193aa05p1vqx0xl6w5qrxr-libmesode-0.9.1' from 'https://cache.nixos.org'...
copying path '/nix/store/n1d0hvf7azc35zigv6m32if74i3z0n7l-libotr-4.1.1' from 'https://cache.nixos.org'...
copying path '/nix/store/ijp17f5wq7kkxv64isi1cicxq607px83-profanity-0.5.1' from 'https://cache.nixos.org'...
/nix/store/ijp17f5wq7kkxv64isi1cicxq607px83-profanity-0.5.1

@GrahamcOfBorg
Copy link

Failure on x86_64-darwin (full log)

Attempted: profanity

The following builds were skipped because they don't evaluate on x86_64-darwin: stabber

Partial log (click to expand)

checking for libmesode... yes
checking for ncursesw... yes
checking for wget_wch support in ncursesw... yes
checking for glib... yes
checking for curl... yes
checking for GTK... yes
checking for /usr/local/opt/readline/lib... no
configure: error: libreadline is required for profanity
builder for '/nix/store/k32p3ralizj3j20byv60qn57gzwi0kf9-profanity-0.5.1.drv' failed with exit code 1
error: build of '/nix/store/k32p3ralizj3j20byv60qn57gzwi0kf9-profanity-0.5.1.drv' failed

@LnL7
Copy link
Member

LnL7 commented Mar 16, 2018

@GrahamcOfBorg build pythonPackages.tkinter

@GrahamcOfBorg
Copy link

No attempt on x86_64-darwin

The following builds were skipped because they don't evaluate on x86_64-darwin: pythonPackages.tkinter

No log is available.

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: pythonPackages.tkinter

Partial log (click to expand)

these paths will be fetched (0.02 MiB download, 0.07 MiB unpacked):
  /nix/store/vj8f2kawq5jxw7kn3ss4w79kz9092kk7-python2.7-tkinter-2.7.14
fetching path ‘/nix/store/vj8f2kawq5jxw7kn3ss4w79kz9092kk7-python2.7-tkinter-2.7.14’...

*** Downloading ‘https://cache.nixos.org/nar/132l6xhi4l0rd1vvr5b9q48arqqd2xqg4hflbkbmln9p82c01460.nar.xz’ (signed by ‘cache.nixos.org-1’) to ‘/nix/store/vj8f2kawq5jxw7kn3ss4w79kz9092kk7-python2.7-tkinter-2.7.14’...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 21848  100 21848    0     0  21848      0  0:00:01 --:--:--  0:00:01 42755

/nix/store/vj8f2kawq5jxw7kn3ss4w79kz9092kk7-python2.7-tkinter-2.7.14

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: pythonPackages.tkinter

Partial log (click to expand)

these paths will be fetched (0.84 MiB download, 2.94 MiB unpacked):
  /nix/store/0f466ffbzhjpfg9hajhizk6rbl5ava9w-python2.7-tkinter-2.7.14
  /nix/store/53rz28y922vjjzipbn0iw1pyygvpfmvq-tk-8.6.6
copying path '/nix/store/53rz28y922vjjzipbn0iw1pyygvpfmvq-tk-8.6.6' from 'https://cache.nixos.org'...
copying path '/nix/store/0f466ffbzhjpfg9hajhizk6rbl5ava9w-python2.7-tkinter-2.7.14' from 'https://cache.nixos.org'...
/nix/store/0f466ffbzhjpfg9hajhizk6rbl5ava9w-python2.7-tkinter-2.7.14

@knedlsepp
Copy link
Member Author

@LnL7 did I miss anything? Why doesn't the darwin build evaluate?

@LnL7
Copy link
Member

LnL7 commented Mar 17, 2018

You can't reproduce it? It's either meta.platforms or an evaluation error that ofborg somehow didn't catch.

@FRidh
Copy link
Member

FRidh commented Mar 17, 2018

I've seen this before with Borg. Does this build work for both of you?

@LnL7
Copy link
Member

LnL7 commented Mar 17, 2018

This happened before because of an issue with @grahamc's builder, I'm not aware of any other case that would cause false negatives.

Copy link
Member

@LnL7 LnL7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unpacking sources
unpacking source archive /nix/store/fm0d4jibbgsi3dpr0s685m5h254pdhsq-python-2.7.14
source root is python-2.7.14
setting SOURCE_DATE_EPOCH to timestamp 315619200 of file python-2.7.14/share/man/man1/python2.7.1.gz
patching sources
configuring
no configure script, doing nothing
building
no Makefile, doing nothing
installing
/nix/store/0igxxngigjgfkgg3cw547n92b8bpg6b1-stdenv-darwin/setup: line 1233: patchelf: command not found
builder for '/nix/store/6agv8zz900y5v6kah1nhllrx9pgjy10z-python2.7-tkinter-2.7.14.drv' failed with exit code 127
error: build of '/nix/store/6agv8zz900y5v6kah1nhllrx9pgjy10z-python2.7-tkinter-2.7.14.drv' on 'ssh://mac1' failed: builder for '/nix/store/6agv8zz900y5v6kah1nhllrx9pgjy10z-python2.7-tkinter-2.7.14.drv' failed with exit code 127
builder for '/nix/store/6agv8zz900y5v6kah1nhllrx9pgjy10z-python2.7-tkinter-2.7.14.drv' failed with exit code 1
error: build of '/nix/store/6agv8zz900y5v6kah1nhllrx9pgjy10z-python2.7-tkinter-2.7.14.drv' failed

@knedlsepp
Copy link
Member Author

Hm. That's odd. I'll try to figure out why it's not working. I didn't have that issue when creating the PR.

@LnL7
Copy link
Member

LnL7 commented Mar 17, 2018

Ofborg tests the merge, maybe something else broke it.

@Mic92
Copy link
Member

Mic92 commented Mar 18, 2018

if something else broke a rebase should help.

@grahamc
Copy link
Member

grahamc commented Mar 18, 2018

It doesn't evaluate on Darwin because it is not supported on Darwin:

grahamc@Morbo> HOME=/homeless-shelter NIX_PATH=nixpkgs=$(pwd) nix-instantiate ./default.nix -A pythonPackages.tkinter --option restrict-eval true --option build-timeout 1800 --argstr system x86_64-darwin --show-trace
error: while evaluating the attribute ‘handled’ at /home/grahamc/projects/nixpkgs/pkgs/stdenv/generic/check-meta.nix:203:3:
while evaluating ‘handleEvalIssue’ at /home/grahamc/projects/nixpkgs/pkgs/stdenv/generic/check-meta.nix:126:21, called from /home/grahamc/projects/nixpkgs/pkgs/stdenv/generic/check-meta.nix:204:10:
Package ‘python2.7-tkinter-2.7.14’ in /home/grahamc/projects/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix:245 is not supported on ‘x86_64-darwin’, refusing to evaluate.

a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowBroken = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowBroken = true; }
to ~/.config/nixpkgs/config.nix.

@grahamc
Copy link
Member

grahamc commented Mar 18, 2018

For more clarity:

  # Tkinter/tkinter is part of the Python standard library.
  # The Python interpreters in Nixpkgs come without tkinter by default.
  # To make the module available, we make it available as any other
  # Python package.
  tkinter = let
    py = python.override{x11Support=true;};
  in buildPythonPackage rec {

...

    meta = py.meta // {
      platforms = platforms.linux;
    };
  };

@FRidh
Copy link
Member

FRidh commented Mar 18, 2018

Ah, right, in python-packages.nix we have for tkinter

    meta = py.meta // {
      platforms = platforms.linux;
    };

In any case, one could test here the derivation pythonFull

@grahamc
Copy link
Member

grahamc commented Mar 18, 2018

I'm working to add evaluation outputs to these messages, but it is a bit complicated. For now, if the evaluator gives you confusing results, you might try testing yourself via the same command, also documented here: https://github.com/nixos/ofborg#how-does-ofborg-call-nix-instantiate

@LnL7
Copy link
Member

LnL7 commented Mar 18, 2018

@GrahamcOfBorg eval

@knedlsepp
Copy link
Member Author

Oh. My bad. I must have mixed something up when building this on my machine.

@knedlsepp knedlsepp force-pushed the fix-python-tkinter-on-darwin branch from 69f299e to af0f9fa Compare March 18, 2018 21:29
@knedlsepp
Copy link
Member Author

knedlsepp commented Mar 18, 2018

This should fix it now. When I tested this originally, I just built python.override{x11Support=true;} instead of python.withPackages(ps: [ps.tkinter]). Sorry for that. The solitaire game nix-build -A pysolfc && ./result/bin/pysol, which depends on tkinter also runs fine now.

@LnL7
Copy link
Member

LnL7 commented Mar 18, 2018

@GrahamcOfBorg build pythonPackages.tkinter

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: pythonPackages.tkinter

Partial log (click to expand)

these paths will be fetched (0.91 MiB download, 3.06 MiB unpacked):
  /nix/store/2w2gkjycksz1gfiwf2gwc6iv26fbcq5y-tk-8.6.6
  /nix/store/vj8f2kawq5jxw7kn3ss4w79kz9092kk7-python2.7-tkinter-2.7.14
copying path '/nix/store/2w2gkjycksz1gfiwf2gwc6iv26fbcq5y-tk-8.6.6' from 'https://cache.nixos.org'...
copying path '/nix/store/vj8f2kawq5jxw7kn3ss4w79kz9092kk7-python2.7-tkinter-2.7.14' from 'https://cache.nixos.org'...
/nix/store/vj8f2kawq5jxw7kn3ss4w79kz9092kk7-python2.7-tkinter-2.7.14

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: pythonPackages.tkinter

Partial log (click to expand)

these paths will be fetched (2.31 MiB download, 9.09 MiB unpacked):
  /nix/store/0f466ffbzhjpfg9hajhizk6rbl5ava9w-python2.7-tkinter-2.7.14
  /nix/store/4fdpv4a3fgnzm8wni8i8cl9hl15ysx8q-tcl-8.6.6
  /nix/store/53rz28y922vjjzipbn0iw1pyygvpfmvq-tk-8.6.6
copying path '/nix/store/4fdpv4a3fgnzm8wni8i8cl9hl15ysx8q-tcl-8.6.6' from 'https://cache.nixos.org'...
copying path '/nix/store/53rz28y922vjjzipbn0iw1pyygvpfmvq-tk-8.6.6' from 'https://cache.nixos.org'...
copying path '/nix/store/0f466ffbzhjpfg9hajhizk6rbl5ava9w-python2.7-tkinter-2.7.14' from 'https://cache.nixos.org'...
/nix/store/0f466ffbzhjpfg9hajhizk6rbl5ava9w-python2.7-tkinter-2.7.14

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: pythonPackages.tkinter

Partial log (click to expand)

configuring
no configure script, doing nothing
building
no Makefile, doing nothing
installing
post-installation fixup
strip is /nix/store/vb6mgjqgd9h11nbv60fvrp1ls9nxck2y-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/df1a7v3pllwimlnb3inqbnhk7ycanzaw-python2.7-tkinter-2.7.14/lib
patching script interpreter paths in /nix/store/df1a7v3pllwimlnb3inqbnhk7ycanzaw-python2.7-tkinter-2.7.14
/nix/store/df1a7v3pllwimlnb3inqbnhk7ycanzaw-python2.7-tkinter-2.7.14

@LnL7
Copy link
Member

LnL7 commented Mar 18, 2018

There we go 😄

@LnL7 LnL7 merged commit b3c6cb6 into NixOS:master Mar 18, 2018
@csawyerYumaed
Copy link

csawyerYumaed commented Mar 27, 2018

For nix morons like me, that get here and don't have tkinter and use nix-darwin:

environment.systemPackages =
[
pkgs.python36Full
pkgs.python36Packages.tkinter
]

worked for me:

$ /run/current-system/sw/bin/python3
Python 3.6.4 (default, Mar 21 2018, 14:15:32)
[GCC 4.2.1 Compatible Clang 5.0.1 (tags/RELEASE_501/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants