miurahr / pyppmd

pyppmd provides classes and functions for compressing and decompressing text data, using PPM (Prediction by partial matching) compression algorithm variation H and I.2. It provide an API similar to Python's zlib/bz2/lzma modules.

Home Page:https://pyppmd.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OSX build issues on conda

sarthakpati opened this issue · comments

Describe the bug
Conda is unable to build the OSX version of the new version.

Related issue
(if exist)

To Reproduce
See build here: https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=364581&view=logs&j=15f8dc28-9f6f-5e3a-5b3c-2b169071e5be&t=63fa899e-c160-5185-75c4-c5fd30c90374&l=257

  lib2/threading.c:113:5: warning: implicit declaration of function 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration]
      clock_gettime(CLOCK_REALTIME, &abstime);
      ^
  lib2/threading.c:113:19: error: use of undeclared identifier 'CLOCK_REALTIME'

Expected behavior
The build should succeed.

Environment (please complete the following information):

  • OS: macOS
  • Python 3.6-3.9
  • project version: 1.60.0

Test data(please attach in the report):
N.A.

Additional context
N.A.

@sarthakpati somehow I don't reproduce it locally...

schnee:c tyamada$ pwd
/Users/tyamada/devel/pyppmd/build/lib.macosx-10.14-x86_64-3.9/pyppmd/c
schnee:c tyamada$ DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=/usr/local/opt/python/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib dlsymtest _ppmd.cpython-39-darwin.so clock_gettime
dlopen(_ppmd.cpython-39-darwin.so) ok
filename = /Users/tyamada/devel/pyppmd/build/lib.macosx-10.14-x86_64-3.9/pyppmd/c/_ppmd.cpython-39-darwin.so
dlsym(clock_gettime) ok (/usr/lib/system/libsystem_c.dylib)
schnee:c tyamada$ nm --add-dyldinfo /usr/lib/libSystem.B.dylib|grep gettime
schnee:c tyamada$ nm --add-dyldinfo /usr/lib/system/libsystem_c.dylib|grep gettime
00000000000010fa T _clock_gettime
0000000000000f18 T _clock_gettime_nsec_np
schnee:pyppmd tyamada$ ag CLOCK_REALTIME /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/time.h
153:_CLOCK_REALTIME __CLOCK_AVAILABILITY = 0,
154:#define CLOCK_REALTIME _CLOCK_REALTIME

@cielavenir: can you try if #50 is working, too? I think that should fix whatever issue conda builds are seeing.

@sarthakpati actually your build failed

schnee:pyppmd tyamada$ git rev-parse HEAD
ce5ef4347bbf0f9d55107fad325937052f86c19d
schnee:pyppmd tyamada$ python3 setup.py bdist_wheel
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-3.9
creating build/lib.macosx-10.14-x86_64-3.9/pyppmd
copying src/pyppmd/__init__.py -> build/lib.macosx-10.14-x86_64-3.9/pyppmd
package init file 'src/pyppmd/c/__init__.py' not found (or not a regular file)
creating build/lib.macosx-10.14-x86_64-3.9/pyppmd/c
copying src/pyppmd/c/c_ppmd.py -> build/lib.macosx-10.14-x86_64-3.9/pyppmd/c
copying src/pyppmd/__init__.pyi -> build/lib.macosx-10.14-x86_64-3.9/pyppmd
copying src/pyppmd/py.typed -> build/lib.macosx-10.14-x86_64-3.9/pyppmd
running build_ext
building 'pyppmd.c._ppmd' extension
creating build/temp.macosx-10.14-x86_64-3.9
creating build/temp.macosx-10.14-x86_64-3.9/lib
creating build/temp.macosx-10.14-x86_64-3.9/lib2
creating build/temp.macosx-10.14-x86_64-3.9/src
creating build/temp.macosx-10.14-x86_64-3.9/src/ext
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -Ilib -Ilib2 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c lib/Ppmd7.c -o build/temp.macosx-10.14-x86_64-3.9/lib/Ppmd7.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -Ilib -Ilib2 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c lib/Ppmd7Dec.c -o build/temp.macosx-10.14-x86_64-3.9/lib/Ppmd7Dec.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -Ilib -Ilib2 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c lib/Ppmd7Enc.c -o build/temp.macosx-10.14-x86_64-3.9/lib/Ppmd7Enc.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -Ilib -Ilib2 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c lib/Ppmd8.c -o build/temp.macosx-10.14-x86_64-3.9/lib/Ppmd8.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -Ilib -Ilib2 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c lib/Ppmd8Dec.c -o build/temp.macosx-10.14-x86_64-3.9/lib/Ppmd8Dec.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -Ilib -Ilib2 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c lib/Ppmd8Enc.c -o build/temp.macosx-10.14-x86_64-3.9/lib/Ppmd8Enc.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -Ilib -Ilib2 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c lib2/Buffer.c -o build/temp.macosx-10.14-x86_64-3.9/lib2/Buffer.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -Ilib -Ilib2 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c lib2/Ppmd8Tdecoder.c -o build/temp.macosx-10.14-x86_64-3.9/lib2/Ppmd8Tdecoder.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -Ilib -Ilib2 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c lib2/threading.c -o build/temp.macosx-10.14-x86_64-3.9/lib2/threading.o
lib2/threading.c:115:7: error: use of undeclared identifier 'clock_serv_t'
      clock_serv_t cclock;
      ^
lib2/threading.c:116:7: error: use of undeclared identifier 'mach_timespec_t'
      mach_timespec_t mts;
      ^
lib2/threading.c:117:7: warning: implicit declaration of function 'host_get_clock_service' is invalid in C99 [-Wimplicit-function-declaration]
      host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
      ^
lib2/threading.c:117:30: warning: implicit declaration of function 'mach_host_self' is invalid in C99 [-Wimplicit-function-declaration]
      host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
                             ^
lib2/threading.c:117:48: error: use of undeclared identifier 'CALENDAR_CLOCK'
      host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
                                               ^
lib2/threading.c:117:65: error: use of undeclared identifier 'cclock'
      host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
                                                                ^
lib2/threading.c:118:7: warning: implicit declaration of function 'clock_get_time' is invalid in C99 [-Wimplicit-function-declaration]
      clock_get_time(cclock, &mts);
      ^
lib2/threading.c:118:22: error: use of undeclared identifier 'cclock'
      clock_get_time(cclock, &mts);
                     ^
lib2/threading.c:118:31: error: use of undeclared identifier 'mts'
      clock_get_time(cclock, &mts);
                              ^
lib2/threading.c:119:7: warning: implicit declaration of function 'mach_port_deallocate' is invalid in C99 [-Wimplicit-function-declaration]
      mach_port_deallocate(mach_task_self(), cclock);
      ^
lib2/threading.c:119:28: warning: implicit declaration of function 'mach_task_self' is invalid in C99 [-Wimplicit-function-declaration]
      mach_port_deallocate(mach_task_self(), cclock);
                           ^
lib2/threading.c:119:46: error: use of undeclared identifier 'cclock'; did you mean 'clock'?
      mach_port_deallocate(mach_task_self(), cclock);
                                             ^~~~~~
                                             clock
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/time.h:108:9: note: 'clock' declared here
clock_t clock(void) __DARWIN_ALIAS(clock);
        ^
lib2/threading.c:120:24: error: use of undeclared identifier 'mts'
      abstime.tv_sec = mts.tv_sec;
                       ^
lib2/threading.c:121:25: error: use of undeclared identifier 'mts'
      abstime.tv_nsec = mts.tv_nsec;
                        ^
5 warnings and 9 errors generated.
error: command '/usr/bin/clang' failed with exit code 1
schnee:pyppmd tyamada$ 

adding this to the head of threading.c worked

#ifdef __MACH__
#include <mach/clock.h>
#include <mach/mach.h>
#endif

ok I understand the situation.

your build OSX log says darwin13, which is macOS 10.9.

according to https://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x, clock_gettime is supported from macOS 10.12.

so if you intend binary release for wider mac machines, I appreciate your change.

Can you check the PR now?

v0.16.1 is out with the fix.