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 on macOS 10.15 #95

Closed
gnachman opened this issue Oct 7, 2020 · 5 comments
Closed

Build failure on macOS 10.15 #95

gnachman opened this issue Oct 7, 2020 · 5 comments

Comments

@gnachman
Copy link

gnachman commented Oct 7, 2020

There's a signed/unsigned comparison that causes a warning, and warnings are errors.

The user can't hack around it by setting CFLAGS because setup.py has:

if sys.platform.startswith('darwin'):
    macos_sdk_path = subprocess.check_output(['xcrun', '--show-sdk-path']).decode().strip()
    os.environ['CFLAGS'] = '-isysroot "%s" -framework IOKit -framework CoreFoundation' % macos_sdk_path
    os.environ['LDFLAGS'] = ''

This is sad because it keeps people from using an analog bell for their terminals: gnachman/iTerm2#428

I suppose fixing hid.c is hard, but doing disgusting things with CFLAGS is easy :)

The error is:

$ python3 setup.py install
WARNING: The wheel package is not available.
running install
running bdist_egg
running egg_info
writing hidapi.egg-info/PKG-INFO
writing dependency_links to hidapi.egg-info/dependency_links.txt
writing requirements to hidapi.egg-info/requires.txt
writing top-level names to hidapi.egg-info/top_level.txt
reading manifest file 'hidapi.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'hidapi.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.12-x86_64/egg
running install_lib
running build_ext
cythoning hid.pyx to hid.c
/Users/gnachman/Downloads/hidapi-0.9.0.post3/.eggs/Cython-0.29.21-py3.7-macosx-10.12-x86_64.egg/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /Users/gnachman/Downloads/hidapi-0.9.0.post3/hid.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
building 'hid' extension
creating build
creating build/temp.macosx-10.12-x86_64-3.7
creating build/temp.macosx-10.12-x86_64-3.7/hidapi
creating build/temp.macosx-10.12-x86_64-3.7/hidapi/mac
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -mmacosx-version-min=10.12 -mmacosx-version-min=10.12 -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -framework IOKit -framework CoreFoundation -Ihidapi/hidapi -I/Users/gnachman/Library/ApplicationSupport/iTerm2/Scripts/ding/iterm2env/versions/3.7.5/include/python3.7m -c hid.c -o build/temp.macosx-10.12-x86_64-3.7/hid.o
clang: warning: -framework IOKit: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -framework CoreFoundation: 'linker' input unused [-Wunused-command-line-argument]
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -mmacosx-version-min=10.12 -mmacosx-version-min=10.12 -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -framework IOKit -framework CoreFoundation -Ihidapi/hidapi -I/Users/gnachman/Library/ApplicationSupport/iTerm2/Scripts/ding/iterm2env/versions/3.7.5/include/python3.7m -c hidapi/mac/hid.c -o build/temp.macosx-10.12-x86_64-3.7/hidapi/mac/hid.o
clang: warning: -framework IOKit: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -framework CoreFoundation: 'linker' input unused [-Wunused-command-line-argument]
hidapi/mac/hid.c:267:20: warning: comparison of integers of different signs: 'CFIndex' (aka 'long') and 'size_t' (aka 'unsigned long') [-Wsign-compare]
                if (chars_copied == len)
                    ~~~~~~~~~~~~ ^  ~~~
1 warning generated.
creating build/lib.macosx-10.12-x86_64-3.7
clang -bundle -undefined dynamic_lookup -L/Users/gnachman/Library/Application Support/iTerm2/iterm2env-67/versions/3.7.5/readline/lib -L/Users/gnachman/Library/Application Support/iTerm2/iterm2env-67/versions/3.7.5/lib -L/Users/gnachman/Library/Application Support/iTerm2/iterm2env-67/versions/3.7.5/readline/lib -L/Users/gnachman/Library/Application Support/iTerm2/iterm2env-67/versions/3.7.5/lib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -framework IOKit -framework CoreFoundation build/temp.macosx-10.12-x86_64-3.7/hid.o build/temp.macosx-10.12-x86_64-3.7/hidapi/mac/hid.o -o build/lib.macosx-10.12-x86_64-3.7/hid.cpython-37m-darwin.so
clang: error: no such file or directory: 'Support/iTerm2/iterm2env-67/versions/3.7.5/readline/lib'
clang: error: no such file or directory: 'Support/iTerm2/iterm2env-67/versions/3.7.5/lib'
clang: error: no such file or directory: 'Support/iTerm2/iterm2env-67/versions/3.7.5/readline/lib'
clang: error: no such file or directory: 'Support/iTerm2/iterm2env-67/versions/3.7.5/lib'
error: command 'clang' failed with exit status 1
@prusnak
Copy link
Member

prusnak commented Oct 7, 2020

This is an upstream bug in hidapi. Can you please open an issue here? https://github.com/libusb/hidapi

@prusnak prusnak closed this as completed Oct 7, 2020
@todbot
Copy link

todbot commented Oct 7, 2020

I don't think it's an upstream bug in hidapi, it looks more like you don't have readline installed. What happens if you do brew install readline and try it again?

@gnachman
Copy link
Author

FYI this was fixed upstream in libusb/hidapi#198

@prusnak
Copy link
Member

prusnak commented Oct 19, 2020

I bumped hidapi submodule to master in d824d96

Can you please test if that fixes your issue? @gnachman

@gnachman
Copy link
Author

Builds and loads great. I am not actually the end user, so I can't test the functionality. But considering the fix, I'm content to leave it closed. Thank you for your help.

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

No branches or pull requests

3 participants