#69386 closed defect (fixed)
py-lxml fails with default gcc compiler
Reported by: | rmottola (Riccardo) | Owned by: | petrrr |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | leopard | Cc: | barracuda156, reneeotten (Renee Otten) |
Port: | py-lxml |
Description
on 10.5 compilation fails:
In file included from src/lxml/etree.c:265443: /opt/local/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12/internal/pycore_frame.h: In function ‘_PyFrame_Initialize’: /opt/local/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12/internal/pycore_frame.h:134: error: ‘for’ loop initial declaration used outside C99 mode Compile failed: command '/usr/bin/gcc-4.2' failed with exit code 1
I tried using: apple gcc 4.2: fails macports gcc 4.8: fails macports gcc 6 : works!
so I propose blacklisting gcc 4.x versions
Change History (9)
comment:1 follow-up: 6 Changed 9 months ago by kencu (Ken)
comment:2 Changed 9 months ago by kencu (Ken)
(the reason using gcc6+ works is that those newer gcc versions default to a newer C standard).
comment:3 Changed 9 months ago by jmroot (Joshua Root)
Owner: | set to petrrr |
---|---|
Status: | new → assigned |
comment:4 Changed 9 months ago by reneeotten (Renee Otten)
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
see [40490a9e8cd54eeeb332af15b38fb7b5f4c92e08/macports-ports], so please do a self-update first.
comment:5 Changed 9 months ago by reneeotten (Renee Otten)
Cc: | barracuda156 added |
---|
oh, are you suggesting Ken that that wasn't the correct fix and setting the C standard would also work? Then that's probably a better solution than the one that I merged... so perhaps this ticket shouldn't be closed?
comment:6 Changed 9 months ago by barracuda156
Replying to kencu:
that works, but macports will usually want you to try setting the C standard first, if you can.
That can be tricky sometimes with python ports, but something like
configure.cflags-append -std=c99is usually what works.
I might have tried that, if the error was suggestive, and perhaps it did not work in a way I tried. (I am pretty sure I did not go with any hacking of the source itself to pass needed flags though.)
Unfortunately, I have no way to test anything for older systems at the moment and I will be back to my normal hardware in about 2–3 weeks. If you or someone could test it, it would be helpful.
comment:7 Changed 9 months ago by jmroot (Joshua Root)
Cc: | reneeotten added |
---|
Yes, adding a -std to the CFLAGS is a better fix. However it's likely that most if not all extension modules built against the Python 3.12 headers with these old compilers will hit this...
comment:8 Changed 9 months ago by jmroot (Joshua Root)
Hm, looking again, it appears that lxml is directly including an internal header, which is hopefully rare.
that works, but macports will usually want you to try setting the C standard first, if you can.
That can be tricky sometimes with python ports, but something like
is usually what works.