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.watchdog 2.0.0 is broken on darwin #113777

Closed
dhess opened this issue Feb 20, 2021 · 18 comments · Fixed by #171388
Closed

pythonPackages.watchdog 2.0.0 is broken on darwin #113777

dhess opened this issue Feb 20, 2021 · 18 comments · Fixed by #171388
Assignees
Labels
0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin

Comments

@dhess
Copy link
Contributor

dhess commented Feb 20, 2021

Describe the bug

963299d upgraded pythonPackages.watchdog to 2.0.0, but this version is broken on darwin:

...
creating build/temp.macosx-10.6-x86_64-3.8
creating build/temp.macosx-10.6-x86_64-3.8/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -DWATCHDOG_VERSION_STRING="2.0.0" -DWATCHDOG_VERSION_MAJOR=2 -DWATCHDOG_VERSION_MINOR=0 -DWATCHDOG_VERSION_BUILD=0 -I/nix/store/5vn5f6slfg1nw8q0bhapd3vgk9j7559i-python3-3.8.7/include/python3.8 -c src/watchdog_fsevents.c -o build/temp.macosx-10.6-x86_64-3.8/src/watchdog_fsevents.o -std=c99 -pedantic -Wall -Wextra -fPIC -Wno-nullability-completeness -Wno-nullability-extension -Wno-newline-eof -Wno-error=unused-command-line-argument
clang-7: warning: argument unused during compilation: '-fno-strict-overflow' [-Wunused-command-line-argument]
src/watchdog_fsevents.c:191:25: error: use of undeclared identifier 'kFSEventStreamEventFlagItemCloned'
FLAG_PROPERTY(IsCloned, kFSEventStreamEventFlagItemCloned)
                        ^
src/watchdog_fsevents.c:404:56: error: use of undeclared identifier 'kFSEventStreamEventExtendedDataPathKey'
        cf_path = CFDictionaryGetValue(path_info_dict, kFSEventStreamEventExtendedDataPathKey);
                                                       ^
src/watchdog_fsevents.c:405:57: error: use of undeclared identifier 'kFSEventStreamEventExtendedFileIDKey'
        cf_inode = CFDictionaryGetValue(path_info_dict, kFSEventStreamEventExtendedFileIDKey);
                                                        ^
src/watchdog_fsevents.c:585:40: error: use of undeclared identifier 'kFSEventStreamCreateFlagUseExtendedData'
                                     | kFSEventStreamCreateFlagUseExtendedData
                                       ^
4 errors generated.
error: command 'clang' failed with exit status 1

It appears this is because nixpkgs' macOS SDK is 10.12, but the symbols that cause problems in 2.0.0 are only available in 10.13+:

https://developer.apple.com/documentation/coreservices/kfseventstreameventextendeddatapathkey

@dhess dhess added the 0.kind: bug Something is broken label Feb 20, 2021
dhess pushed a commit to hackworthltd/hacknix that referenced this issue Feb 20, 2021
@veprbl veprbl added the 6.topic: darwin Running or building packages on Darwin label Feb 20, 2021
@FRidh
Copy link
Member

FRidh commented Feb 21, 2021

Issue regarding newer SDK #101229.

@ldeck
Copy link
Contributor

ldeck commented May 5, 2021

I'm also seeing watchdog as a blocker for installing some packages.

e.g., installing was-sam-cli is broken:

% nix-env -i aws-sam-cli --show-trace
installing 'aws-sam-cli-1.23.0'
error: while evaluating the attribute 'drvPath' at /nix/store/39lgkp36x5qqpbi6rjcwg85lrc791ymc-nixpkgs-21.05pre287067.0d337eb6b77/nixpkgs/lib/customisation.nix:163:7:
while evaluating the attribute 'propagatedBuildInputs' of the derivation 'aws-sam-cli-1.23.0' at /nix/store/39lgkp36x5qqpbi6rjcwg85lrc791ymc-nixpkgs-21.05pre287067.0d337eb6b77/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating the attribute 'out.outPath' at /nix/store/39lgkp36x5qqpbi6rjcwg85lrc791ymc-nixpkgs-21.05pre287067.0d337eb6b77/nixpkgs/lib/customisation.nix:156:13:
while evaluating the attribute 'handled' at /nix/store/39lgkp36x5qqpbi6rjcwg85lrc791ymc-nixpkgs-21.05pre287067.0d337eb6b77/nixpkgs/pkgs/stdenv/generic/check-meta.nix:301:7:
while evaluating 'handleEvalIssue' at /nix/store/39lgkp36x5qqpbi6rjcwg85lrc791ymc-nixpkgs-21.05pre287067.0d337eb6b77/nixpkgs/pkgs/stdenv/generic/check-meta.nix:188:38, called from /nix/store/39lgkp36x5qqpbi6rjcwg85lrc791ymc-nixpkgs-21.05pre287067.0d337eb6b77/nixpkgs/pkgs/stdenv/generic/check-meta.nix:302:14:
Package ‘python3.8-watchdog-2.0.3’ in /nix/store/39lgkp36x5qqpbi6rjcwg85lrc791ymc-nixpkgs-21.05pre287067.0d337eb6b77/nixpkgs/pkgs/development/python-modules/watchdog/default.nix:42 is marked as broken, refusing to evaluate.

a) To temporarily allow broken packages, you can use an environment variable
   for a single invocation of the nix tools.

     $ export NIXPKGS_ALLOW_BROKEN=1

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

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

Any work-around or fix? @lo1tuma, @cillianderoiste.

 % nix-shell -p nix-info --run "nix-info -m"
these paths will be fetched (1.46 MiB download, 7.88 MiB unpacked):
  /nix/store/3kz8p0rh7h260ky00ysjsg7q07jn41i2-bash-interactive-4.4-p23-dev
  /nix/store/6v47rygwaahny2wsmn9avnczf0sd2dn3-DarwinTools-1
  /nix/store/8c94id8pana0v7wq5ipvam6sfjwg8w1w-bash-interactive-4.4-p23-doc
  /nix/store/ff1d4zkny91w0cg8jdzfm6rlvcmpldwf-bash-interactive-4.4-p23-info
  /nix/store/gqvdmb1q5llvhccqm8ap7fxidhxfh67b-bash-interactive-4.4-p23-man
  /nix/store/i8dxjfdkf4ipnbnqr7ws4q4hjqxmiszq-bash-interactive-4.4-p23
  /nix/store/mcj5lk0cqds210nnspppynfwxnqf9ilw-readline-7.0p5
  /nix/store/sbazpkxvzplf2yfxcvq7q0f1v6qmfiva-nix-info
copying path '/nix/store/8c94id8pana0v7wq5ipvam6sfjwg8w1w-bash-interactive-4.4-p23-doc' from 'https://cache.nixos.org'...
copying path '/nix/store/6v47rygwaahny2wsmn9avnczf0sd2dn3-DarwinTools-1' from 'https://cache.nixos.org'...
copying path '/nix/store/ff1d4zkny91w0cg8jdzfm6rlvcmpldwf-bash-interactive-4.4-p23-info' from 'https://cache.nixos.org'...
copying path '/nix/store/gqvdmb1q5llvhccqm8ap7fxidhxfh67b-bash-interactive-4.4-p23-man' from 'https://cache.nixos.org'...
copying path '/nix/store/sbazpkxvzplf2yfxcvq7q0f1v6qmfiva-nix-info' from 'https://cache.nixos.org'...
copying path '/nix/store/mcj5lk0cqds210nnspppynfwxnqf9ilw-readline-7.0p5' from 'https://cache.nixos.org'...
copying path '/nix/store/i8dxjfdkf4ipnbnqr7ws4q4hjqxmiszq-bash-interactive-4.4-p23' from 'https://cache.nixos.org'...
copying path '/nix/store/3kz8p0rh7h260ky00ysjsg7q07jn41i2-bash-interactive-4.4-p23-dev' from 'https://cache.nixos.org'...
 - system: `"x86_64-darwin"`
 - host os: `Darwin 20.3.0, macOS 10.16`
 - multi-user?: `no`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.3.10`
 - channels(ldeck): `"nixpkgs-21.05pre287067.0d337eb6b77"`
 - nixpkgs: `/Users/ldeck/.nix-defexpr/channels/nixpkgs`

dhess added a commit to hackworthltd/hacknix that referenced this issue May 21, 2021
This reverts commit 9c64303.

Upstream aws-sam-cli doesn't build on macOS due to a python-watchdog
issue. See NixOS/nixpkgs#113777
@kutyel
Copy link

kutyel commented Jun 7, 2021

Still happens with [email protected]:

error: Package ‘python3.8-watchdog-2.1.1’ in /nix/store/p6wjywj33a1nj7lnbsb43kar52d6dmvy-nixpkgs-src/pkgs/development/python-modules/watchdog/default.nix:42 is marked as broken, refusing to evaluate.

a) To temporarily allow broken packages, you can use an environment variable
   for a single invocation of the nix tools.

     $ export NIXPKGS_ALLOW_BROKEN=1

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

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

(use '--show-trace' to show detailed location information)
make: *** [nix-shell] Error 1

@dhess
Copy link
Contributor Author

dhess commented Jun 7, 2021

Yeah, unfortunately, I think nothing is going to change on this issue until someone has time to upgrade the macOS SDK (#101229)

@domenkozar
Copy link
Member

That's happening at #121055 as part of https://opencollective.com/nix-macos

@domenkozar
Copy link
Member

What if the package uses sdk_11 for now?

@mweinelt
Copy link
Member

mweinelt commented Jun 8, 2021

@toonn
Copy link
Contributor

toonn commented Jun 8, 2021

Talking to @LnL7, this doesn't seem so simple. The 11 SDK is only available through the Aarch64 stdenv IIUC. So maybe this package doesn't need to be marked broken for Aarch64 Darwin, could someone using native Nix on an M1 mac confirm this?

Making it available on x86_64 properly would entail as much work as bumping the SDK to 10.13 does because we have as much as possible depend on the Apple source releases rather than the SDK. So I don't think this'd be an easy workaround.

@thefloweringash would be better able to judge how practical the idea is though.

@toonn
Copy link
Contributor

toonn commented Jun 9, 2021

Here's what I tried, from a checkout of master:
> NIXPKGS_ALLOW_BROKEN=1 nix-build --no-out-link -E 'let pkgs = import ./. {}; apple_sdk_11_0 = pkgs.callPackage pkgs/os-specific/darwin/apple-sdk-11.0 {}; in pkgs.python3Packages.watchdog.override {inherit (apple_sdk_11_0.frameworks) CoreServices; }'
... [Elided]
The following paths did not match any rewrite rule
  /usr/lib/libobjc.A.dylib
... [Elided]
Errors occurred during rewrite of /nix/store/30f0jc58f542qlli3zachx2ncx17jgfa-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation.tbd                                                   
Rewrite config:
Exact mappings:                                                                 
Errors occurred during rewrite of /nix/store/6dax4h9wc21h0a2h5bmqwkpyr4sgxx25-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation.tbd
Rewrite config:                                                                 
Exact mappings:                                                                 
Prefix mappings:                                                                
  - /System/Library/Frameworks/CoreFoundation.framework/ -> /nix/store/6dax4h9wc21h0a2h5bmqwkpyr4sgxx25-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/              
Required prefix: /nix/store             
Check existence of resulting paths: yes

Prefix mappings:
  - /System/Library/Frameworks/CoreFoundation.framework/ -> /nix/store/30f0jc58f542qlli3zachx2ncx17jgfa-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/
Required prefix: /nix/store
Check existence of resulting paths: yes

The following paths did not match any rewrite rule
  /usr/lib/libobjc.A.dylib
The following paths did not match any rewrite rule
  /usr/lib/libobjc.A.dylib
libc++abi.dylib: terminating with uncaught exception of type rewrite_errors: Rewriting failed
libc++abi.dylib: terminating with uncaught exception of type rewrite_errors: Rewriting failed
/nix/store/vnazyva3nawmvmhsxl8d2698wqg3743l-stdenv-darwin/setup: line 1329: 4818
3 Abort trap: 6           rewrite-tbd -p /System/Library/Frameworks/CoreFoundation.framework/:$out/Library/Frameworks/CoreFoundation.framework/ -r /nix/store "$tbd"
/nix/store/vnazyva3nawmvmhsxl8d2698wqg3743l-stdenv-darwin/setup: line 1329: 4818
2 Abort trap: 6           rewrite-tbd -p /System/Library/Frameworks/CoreFoundation.framework/:$out/Library/Frameworks/CoreFoundation.framework/ -r /nix/store "$tbd"
post-installation fixup
builder for '/nix/store/y8kvzqx49krhb8mvas81y5kb8d4m5fpq-apple-framework-CoreFoundation-11.0.0.drv' failed with exit code 134

I suspect the problem is trying to rewrite-tbd with the 10.12 darwin-stubs, which could explain missing dylibs. The usual 10.12 apple_sdk expression explicitly depends on darwin-stubs but apple_sdk_11_0 does not so I'm not able to override it. I'm not sure why this is, @thefloweringash?

@toonn
Copy link
Contributor

toonn commented Jun 9, 2021

Maybe it's using impure stubs from the host? Would be cool if someone running Big Sur could confirm or deny whether the above works for them.

@davegallant
Copy link
Member

Maybe it's using impure stubs from the host? Would be cool if someone running Big Sur could confirm or deny whether the above works for them.

I ran into the same issue on Big Sur.

@AlexMoutonNoble
Copy link

That's happening at #121055 as part of https://opencollective.com/nix-macos

Just coming into this but I see this has been merged? Is there anything to be done here?

Thanks
A

@toonn
Copy link
Contributor

toonn commented Jul 3, 2021

@AlexMoutonNoble, sorry for causing confusion. That PR became just a bump of LLVM and the bit that was merged is just the small bootstrap-tools bump the work depends on. So this has no impact on this issue.
I continue to work on both getting LLVM updated and the Apple SDK.

You can keep an eye on #116341 or the Nix ❤️ macOS Monthly Discourse thread for updates.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nix-macos-monthly/12330/8

smancill added a commit to smancill/nixpkgs that referenced this issue Aug 2, 2021
This also makes the application ready to work on Darwin (but still not
working until NixOS#113777 is fixed).

Version 1.5.1 did not build on Darwin because libcanberra-gtk3 is
broken, and python-vlc is required but only works on Linux.

Version 1.6.x fixed the python-vlc requirement to make it optional, so
now both libcanberra-gtk3 and python-vlc inputs can be made optional,
and enabled by default on Linux. This means that on Darwin there is no
support for media, but it is still better than not having the
application at all.

Unfortunately, until watchdog 2.x is fixed, the Darwin build will be
still broken.

-----

The setup.py file now parses the setuptools version, so it needs to be
patched to fix an error with the 'post0' suffix in the version.

Also, setuptools is needed in propagatedBuildInputs to fix the
`ModuleNotFoundError: No module named 'pkg_resources'` error.
cpcloud added a commit to cpcloud/ibis that referenced this issue Jan 3, 2022
@stale
Copy link

stale bot commented Jan 3, 2022

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 Jan 3, 2022
cpcloud added a commit to cpcloud/ibis that referenced this issue Jan 5, 2022
@amitavaghosh1
Copy link

Package ‘python3.9-watchdog-2.1.6’ in /nix/store/16znkxs25xghynrdrrcf3asczxh3hdm3-nixpkgs-22.05pre346850.9789ed45b75/nixpkgs/pkgs/development/python-modules/watchdog/default.nix:52 is marked as broken, refusing to evaluate.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Feb 16, 2022
@kubukoz
Copy link
Member

kubukoz commented Mar 24, 2022

Hi all, is there a recommended workaround for this?

@yipengsun
Copy link
Contributor

I used to create a Python virtualenv with my flake.nix/shell.nix, then just install watchdog directly with pip inside that virtualenv:

I mainly use this for mkdocs, and it WAS working correctly.

          buildInputs = with pythonPackages; [
            # Python requirements (enough to get a virtualenv going).
            virtualenvwrapper
            numpy 
          ];

          shellHook = ''
            # Allow the use of wheels.
            SOURCE_DATE_EPOCH=$(date +%s)
            VENV=./.virtualenv

            if test ! -d $VENV; then
              virtualenv $VENV
            fi
            source $VENV/bin/activate

            # Allow for the environment to pick up packages installed with virtualenv
            export PYTHONPATH=$VENV/${python.sitePackages}/:$PYTHONPATH
        '';

I don't have a mac currently, so can't say if it still works, but you can give it a try.

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

Successfully merging a pull request may close this issue.