Opened 4 years ago

Closed 4 years ago

#55832 closed defect (fixed)

py-matplotlib fails to compile on Snow Leopard

Reported by: fvaccari Owned by: seanfarley (Sean Farley)
Priority: Normal Milestone:
Component: ports Version: 2.4.2
Keywords: Cc:
Port: py-matplotlib

Description

In order to compile py36-matplotlib on Snow Leopard I had to modify line 1313 of file _macosx.m from this

    for (size_t state_index = 0; state_index < n; state_index++)

to this

    size_t state_index;
    for (state_index = 0; state_index < n; state_index++)

I think this solution should work on any other system, but better leave the decision to the experts...

I didn't check if the same issue exists for other py?? versions

Attachments (2)

matplotlibError.log (201.0 KB) - added by fvaccari 4 years ago.
The error log
_macosx.m.modSL (94.6 KB) - added by fvaccari 4 years ago.
The modified _macosx.m file

Download all attachments as: .zip

Change History (9)

Changed 4 years ago by fvaccari

Attachment: matplotlibError.log added

The error log

Changed 4 years ago by fvaccari

Attachment: _macosx.m.modSL added

The modified _macosx.m file

comment:1 Changed 4 years ago by ryandesign (Ryan Schmidt)

Cc: sean@… removed
Keywords: py36-matplotlib Snow Leopard removed
Owner: set to seanfarley
Port: py-matplotlib added; py36-matplotlib removed
Status: newassigned
Summary: py36-matplotlib fails to compile on Snow Leopardpy-matplotlib fails to compile on Snow Leopard

The error in the log is:

error: ‘for’ loop initial declaration used outside C99 mode

Yes, the same problem would exist for all Python versions. It is not a Python version specific problem. The issue is that this code is not compatible with C89 mode, which is the default for the older gcc-4.2 and llvm-gcc-4.2 compilers used by default on Snow Leopard and earlier. C99 mode is the default for clang which is used by default on Lion and later.

The code could either be fixed to be C89-compatible, as per your suggested changes, or the build can declare that this code needs C99 mode using -std=c99 in CFLAGS. The project's build system should do that. Either way, it's an upstream bug that should be reported to the developers of py-matplotlib so they can fix it.

comment:2 Changed 4 years ago by seanfarley (Sean Farley)

I agree with Ryan, fwiw. I'd be able to try to help upstream this if you can raise a ticket / PR with them.

comment:4 Changed 4 years ago by seanfarley (Sean Farley)

Thanks for reporting this, @fvaccari! Seems that 2.2.0 will have this fix and is going to drop soon so I'll update the port when that comes out :-)

comment:5 Changed 4 years ago by wroberts (Will Roberts)

I'm also seeing this issue with py36-matplotlib on OS X 10.6. Matplotlib 2.2.0 is out since March 6 with @fvaccari's change merged. Any update on the Portfile?

comment:6 in reply to:  5 Changed 4 years ago by fvaccari

Replying to wroberts:

I'm also seeing this issue with py36-matplotlib on OS X 10.6. Matplotlib 2.2.0 is out since March 6 with @fvaccari's change merged. Any update on the Portfile?

Just to be sure, did you clean py36-matplotlib and retried?

comment:7 Changed 4 years ago by seanfarley (Sean Farley)

Resolution: fixed
Status: assignedclosed

In b5481b0abbbdc057b7a1191d75ae9a1836c67539/macports-ports:

py-matplotlib: update to 2.2.2

Closes: #55832

Note: See TracTickets for help on using tickets.