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

macOS wheels don't work on macOS 10.12 #1026

Closed
RazerM opened this issue Aug 5, 2020 · 5 comments · Fixed by #1027
Closed

macOS wheels don't work on macOS 10.12 #1026

RazerM opened this issue Aug 5, 2020 · 5 comments · Fixed by #1027

Comments

@RazerM
Copy link
Contributor

RazerM commented Aug 5, 2020

The wheels report 10.9+ compatibility but don't work on 10.12. The same error happens for the 1.2.0 and 1.2.1 wheels:

Python 3.7.1 (default, Apr  7 2020, 18:00:22)
[Clang 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygit2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "...lib/python3.7/site-packages/pygit2/__init__.py", line 30, in <module>
    from ._pygit2 import *
ImportError: dlopen(...lib/python3.7/site-packages/pygit2/_pygit2.cpython-37m-darwin.so, 2): Symbol not found: ____chkstk_darwin
  Referenced from: ...lib/python3.7/site-packages/pygit2/.dylibs/libgit2.1.0.0.dylib
  Expected in: /usr/lib/libSystem.B.dylib
 in ...lib/python3.7/site-packages/pygit2/.dylibs/libgit2.1.0.0.dylib

I guess they use a symbol from a newer libSystem.

(I know the workaround is to do pip install --no-binary pygit2 pygit2).

In case it's related, see pyca/cryptography#5215 and pyca/infra#275

@jdavid
Copy link
Member

jdavid commented Aug 6, 2020

ping @rcoup

rcoup added a commit to rcoup/pygit2 that referenced this issue Aug 6, 2020
Add some tracing of libgit2 dependencies.

re libgit2#1026
@rcoup
Copy link
Contributor

rcoup commented Aug 6, 2020

@RazerM I'm a little out of my depth here, but can you have a quick try of the wheels produced from 2833dc1?

And can you run some diagnostics under macos10.9 for me?

$ otool -L /path/to/pygit2/_pygit2.cpython-37m-darwin.so
$ otool -l /path/to/pygit2/_pygit2.cpython-37m-darwin.so | grep -A4 VER
$ otool -L /path/to/pygit2/.dylibs/libgit2.1.0.0.dylib
$ otool -l /path/to/pygit2/.dylibs/libgit2.1.0.0.dylib | grep -A4 VER

@RazerM
Copy link
Contributor Author

RazerM commented Aug 6, 2020

The wheel you linked to works!

I assume you want the diagnostics from the pygit2 I compiled from source (?):

$ otool -L _pygit2.cpython-37m-darwin.so
_pygit2.cpython-37m-darwin.so:
  /usr/local/opt/libgit2/lib/libgit2.1.0.dylib (compatibility version 1.0.0, current version 1.0.1)
  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)

$ otool -l _pygit2.cpython-37m-darwin.so | grep -A4 VER
      cmd LC_VERSION_MIN_MACOSX
  cmdsize 16
  version 10.12
      sdk 10.12
Load command 8
--
      cmd LC_SOURCE_VERSION
  cmdsize 16
  version 0.0
Load command 9
          cmd LC_LOAD_DYLIB

$ otool -L .dylibs/libgit2.1.0.1.dylib
.dylibs/libgit2.1.0.1.dylib:
	/DLC/pygit2/libgit2.1.0.1.dylib (compatibility version 1.0.0, current version 1.0.1)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1677.104.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 59306.140.5)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)

$ otool -l .dylibs/libgit2.1.0.1.dylib | grep -A4 VER
      cmd LC_VERSION_MIN_MACOSX
  cmdsize 16
  version 10.9
      sdk 10.15.6
Load command 9
--
      cmd LC_SOURCE_VERSION
  cmdsize 16
  version 0.0
Load command 10
          cmd LC_LOAD_DYLIB

@rcoup
Copy link
Contributor

rcoup commented Aug 6, 2020

The wheel you linked to works!

That seems suspiciously easy... 🕵️

There are some warnings during the libgit2 compilation:

/Users/runner/work/pygit2/pygit2/libgit2/src/unix/posix.h:86:9: warning: 'futimens' is only available on macOS 10.13 or newer [-Wunguarded-availability-new]
        return futimens(f, s);
               ^~~~~~~~
/Applications/Xcode_11.6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/sys/stat.h:396:9: note: 'futimens' has been marked as being introduced in macOS 10.13 here, but the deployment target is macOS 10.9.0
int     futimens(int __fd, const struct timespec __times[2]) __API_AVAILABLE(macosx(10.13), ios(11.0), tvos(11.0), watchos(4.0));
        ^
/Users/runner/work/pygit2/pygit2/libgit2/src/unix/posix.h:86:9: note: enclose 'futimens' in a __builtin_available check to silence this warning
        return futimens(f, s);
               ^~~~~~~~
1 warning generated.

Seems like futimens() is only used in win32 though, so might be safe enough to ignore.

Libgit2 cmake actually checks for it explicitly:

-- Looking for futimens
-- Looking for futimens - found

though https://gitlab.kitware.com/cmake/cmake/-/issues/17101#note_297983 suggests the CheckFunctionExists test in cmake doesn't actually respect macOS deployment targets.

@jdavid happy to commit this change anyway?

@jdavid
Copy link
Member

jdavid commented Aug 6, 2020

@jdavid happy to commit this change anyway?

@rcoup yes, will you do a PR?

@jdavid jdavid closed this as completed in a66245d Aug 6, 2020
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Oct 22, 2020
Includes a build fix for the updated libgit2 1.1.x, figured it may as well
be updated at the same time.

1.3.0 (2020-09-18)
-------------------------

- New ``Repository.add_submodule(...)``
  `#1011 <https://github.com/libgit2/pygit2/pull/1011>`_

- New ``Repository.applies(...)``
  `#1019 <https://github.com/libgit2/pygit2/pull/1019>`_

- New ``Repository.revparse(...)`` and ``Repository.revparse_ext(...)``
  `#1022 <https://github.com/libgit2/pygit2/pull/1022>`_

- New optional ``flags`` and ``file_flags`` arguments in
  ``Repository.merge_commits`` and ``Repository.merge_trees``
  `#1008 <https://github.com/libgit2/pygit2/pull/1008>`_

- New ``Reference.raw_target``, ``Repository.raw_listall_branches(...)`` and
  ``Repository.raw_listall_references()``; allow bytes in
  ``Repository.lookup_branch(...)`` and ``Repository.diff(...)``
  `#1029 <https://github.com/libgit2/pygit2/pull/1029>`_

- New ``GIT_BLAME_FIRST_PARENT`` and ``GIT_BLAME_USE_MAILMAP`` constants
  `#1031 <https://github.com/libgit2/pygit2/pull/1031>`_

- New ``IndexEntry`` supports ``repr()``, ``str()``, ``==`` and ``!=``
  `#1009 <https://github.com/libgit2/pygit2/pull/1009>`_

- New ``Object`` supports ``repr()``
  `#1022 <https://github.com/libgit2/pygit2/pull/1022>`_

- New accept tuples of strings (not only lists) in a number of places
  `#1025 <https://github.com/libgit2/pygit2/pull/1025>`_

- Fix compatibility with old macOS 10.9
  `#1026 <https://github.com/libgit2/pygit2/issues/1026>`_
  `#1027 <https://github.com/libgit2/pygit2/pull/1027>`_

- Fix check argument type in ``Repository.apply(...)``
  `#1033 <https://github.com/libgit2/pygit2/issues/1033>`_

- Fix raise exception if error in ``Repository.listall_submodules()`` commit 32133974

- Fix a couple of refcount errors in ``OdbBackend.refresh()`` and
  ``Worktree_is_prunable`` commit fed0c19c

- Unit tests
  `#800 <https://github.com/libgit2/pygit2/issues/800>`_
  `#1015 <https://github.com/libgit2/pygit2/pull/1015>`_

- Documentation
  `#705 <https://github.com/libgit2/pygit2/pull/705>`_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants