Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#44288 closed defect (fixed)

pyport.h FreeBSD/Mac OS X "fix" causes errors in C++ compilation

Reported by: mbrethen Owned by: jyrkiwahlstedt
Priority: Normal Milestone:
Component: ports Version: 2.3.1
Keywords: Cc:
Port: python27

Description

I have experienced build errors (example below) with pyport.h The issue is documented in Python's bug tracker here:

http://bugs.python.org/issue10910

The problem is that pyport tries to replace the ctypes definion of the isascii(ch) and related functions by a replacement that works better with UTF-8 on FreeBSD and OSX. That replacement is incompatible with the localfwd.h header.

A workaround is provided at the site, which I'm attaching.

:info:build /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__locale:436:15: error: C++ requires a type specifier for all declarations
:info:build     char_type toupper(char_type __c) const
:info:build               ^~~~~~~~~~~~~~~~~~~~~~
:info:build /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Headers/pyport.h:731:29: note: expanded from macro 'toupper'

:info:build /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__locale:442:48: error: too many arguments provided to function-like macro invocation
:info:build     const char_type* toupper(char_type* __low, const char_type* __high) const
:info:build                                                ^
:info:build /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Headers/pyport.h:731:9: note: macro 'toupper' defined here
:info:build #define toupper(c) towupper(btowc(c))
:info:build         ^

Attachments (3)

issue10910-workaround.txt (563 bytes) - added by mbrethen 10 years ago.
patch-Include-pyport.h.diff (587 bytes) - added by mbrethen 10 years ago.
python27-Portfile.diff (781 bytes) - added by mbrethen 10 years ago.

Download all attachments as: .zip

Change History (12)

Changed 10 years ago by mbrethen

Attachment: issue10910-workaround.txt added

comment:1 Changed 10 years ago by mf2k (Frank Schima)

Cc: port info --maintainers python27 removed
Owner: changed from macports-tickets@… to jwa@…
Port: python27 added

In the future, please fill in the Port field and actually Cc the port maintainers by running the following command in Terminal to get them - (port info --maintainers python27).

Changed 10 years ago by mbrethen

Attachment: patch-Include-pyport.h.diff added

Changed 10 years ago by mbrethen

Attachment: python27-Portfile.diff added

comment:2 Changed 10 years ago by mbrethen

I patched my local python installation and confirmed the issue resolved. I have uploaded patches for pyport.h and the Portfile.

comment:3 Changed 10 years ago by jyrkiwahlstedt

Resolution: fixed
Status: newclosed

done in r122030, thanks

comment:4 Changed 8 years ago by mamoll (Mark Moll)

I think python34 and python35 need the same kind of patch.

comment:5 Changed 8 years ago by kylegoetz@…

Is there anyone who can implement a similar fix for python34? I am having problems installing a package, and the package maintainer linked me to this and said this was the issue.

comment:6 Changed 8 years ago by mbrethen

Have you tried patching it locally to confirm it works? See https://trac.macports.org/wiki/howto/PatchLocal

comment:7 in reply to:  5 Changed 8 years ago by mamoll (Mark Moll)

Replying to kylegoetz@…:

Is there anyone who can implement a similar fix for python34? I am having problems installing a package, and the package maintainer linked me to this and said this was the issue.

You can manually apply the change in the patch-Include-pyport.h.diff​ attachment to /opt/local/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m/pyport.h and then try port install py34-graph-tool again.

comment:8 in reply to:  6 Changed 8 years ago by mamoll (Mark Moll)

Replying to mark.brethen@…:

Have you tried patching it locally to confirm it works? See https://trac.macports.org/wiki/howto/PatchLocal

I can confirm that the patch works for python35.

comment:9 Changed 8 years ago by mbrethen

I suggest opening a new ticket for python3 with the patch and updated portfile.

Note: See TracTickets for help on using tickets.