Opened 3 years ago
Last modified 17 months ago
#64805 reopened defect
libprelude: python bindings fail to build on OSX 10.12 and earlier, due to lack of 'fmemopen'
Reported by: | ctreleaven (Craig Treleaven) | Owned by: | ToToL |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | mascguy (Christopher Nielsen) | |
Port: | libprelude |
Description
Relevant portion of the log seems to be:
gnumake[3]: Entering directory `/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_security_libprelude/libprelude/work/libprelude-5.2.0/bindings/python' CC="/usr/bin/clang++" /opt/local/bin/python3.8 setup.py build running build running build_py creating build creating build/lib.macosx-10.12-x86_64-3.8 copying prelude.py -> build/lib.macosx-10.12-x86_64-3.8 running build_ext building '_prelude' extension creating build/temp.macosx-10.12-x86_64-3.8 /usr/bin/clang++ -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -pipe -Os -I/opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c _prelude.cxx -o build/temp.macosx-10.12-x86_64-3.8/_prelude.o -I../.. -I../../src/include -I../../src/include -I../../src/libprelude-error -I../../bindings/c++/include In file included from _prelude.cxx:188: In file included from /opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/Python.h:85: In file included from /opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/pytime.h:6: In file included from /opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/object.h:746: /opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/cpython/object.h:177:16: warning: 'tp_print' is deprecated [-Wdeprecated-declarations] typedef struct _typeobject { ^ /opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/cpython/object.h:260:5: note: 'tp_print' has been explicitly marked deprecated here Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int); ^ /opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/pyport.h:515:54: note: expanded from macro 'Py_DEPRECATED' #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__)) ^ In file included from _prelude.cxx:188: In file included from /opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/Python.h:85: In file included from /opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/pytime.h:6: In file included from /opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/object.h:746: /opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/cpython/object.h:177:16: warning: 'tp_print' is deprecated [-Wdeprecated-declarations] typedef struct _typeobject { ^ /opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/cpython/object.h:260:5: note: 'tp_print' has been explicitly marked deprecated here Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int); ^ /opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/pyport.h:515:54: note: expanded from macro 'Py_DEPRECATED' #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__)) ^ _prelude.cxx:6388:22: error: use of undeclared identifier 'fmemopen'; did you mean 'freopen'? fd = fmemopen(buf, len, "r"); ^~~~~~~~ freopen /usr/include/stdio.h:248:7: note: 'freopen' declared here FILE *freopen(const char * __restrict, const char * __restrict, ^ _prelude.cxx:6388:36: error: cannot initialize a parameter of type 'const char *' with an lvalue of type 'ssize_t' (aka 'long') fd = fmemopen(buf, len, "r"); ^~~ /usr/include/stdio.h:248:63: note: passing argument to parameter here FILE *freopen(const char * __restrict, const char * __restrict, ^ 2 warnings and 2 errors generated. error: command '/usr/bin/clang++' failed with exit status 1 gnumake[3]: *** [python-build] Error 1
I suspect this is obvious to some but not me.
Attachments (1)
Change History (12)
Changed 3 years ago by ctreleaven (Craig Treleaven)
Attachment: | libprelude 10.12 buildbot fail 2202Mar11.txt added |
---|
comment:1 Changed 3 years ago by jmroot (Joshua Root)
I think you'll find that fmemopen
was not implemented in macOS until 10.13.
comment:2 Changed 3 years ago by ctreleaven (Craig Treleaven)
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:3 Changed 3 years ago by jmroot (Joshua Root)
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Changing compilers won't help; fmemopen is a libc function and doesn't exist at all on the older OSes. You would have to either provide an implementation of the function, or modify the code to do whatever it's doing without using that function.
comment:4 follow-up: 7 Changed 3 years ago by ctreleaven (Craig Treleaven)
Thanks Josh, I'm starting to get a glimmer now. (I'm not a C/C++ guy.)
AIUI, I would need to use an SDK from 10.13 or newer to get the appropriate version of stdio.h. For example:
$ bbfind fmemopen /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:356: FILE *fmemopen(void * __restrict __buf, size_t __size, const char * __restrict __mode) __API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0));
I believe Ryan has an uncommitted port that is supposed to address this kind of problem? I'll see if I can locate a ticket.
In the meantime, I can disable the Python bindings in this port on older OS versions which should get around the problem. I appreciate your help.
comment:5 Changed 3 years ago by ctreleaven (Craig Treleaven)
Not finding a ticket but the WIP is at:
https://github.com/ryandesign/macports-ports/blob/master/devel/MacOSX.sdk/Portfile
comment:6 Changed 3 years ago by ctreleaven (Craig Treleaven)
comment:7 Changed 3 years ago by jmroot (Joshua Root)
Replying to ctreleaven:
AIUI, I would need to use an SDK from 10.13 or newer to get the appropriate version of stdio.h.
Using a newer SDK would allow the code to compile, but it would then fail at runtime on < 10.13. You can check for the function's availability at runtime too, but you still need some alternative code that does the same thing but without using fmemopen.
comment:8 follow-up: 9 Changed 20 months ago by barracuda156
Has any replacement for fmemopen
been found ever since?
comment:9 Changed 17 months ago by mascguy (Christopher Nielsen)
Replying to barracuda156:
Has any replacement for
fmemopen
been found ever since?Maybe this? https://github.com/NimbusKit/memorymapping
fmemopen()
will be available via legacy-support
within a few days. (But it's currently testable via legacy-support-devel
as of this writing.)
comment:10 Changed 17 months ago by mascguy (Christopher Nielsen)
Cc: | mascguy added |
---|
comment:11 Changed 17 months ago by mascguy (Christopher Nielsen)
Summary: | libprelude: python bindings fail to build on OSX 10.12 and earlier → libprelude: python bindings fail to build on OSX 10.12 and earlier, due to lack of 'fmemopen' |
---|
Buildbot log file 10.12