Issue 32563: -Werror=declaration-after-statement expat build failure on Python 3.5 (original ) (raw ) Issue32563
Created on 2018-01-16 05:14 by ncoghlan , last changed 2022-04-11 14:58 by admin . This issue is now closed .
Pull Requests
URL
Status
Linked
Edit
PR 5201
merged
ncoghlan,2018-01-16 10:50
Messages (6)
msg310037 - (view)
Author: Alyssa Coghlan (ncoghlan) *
Date: 2018-01-16 05:14
A fresh Python 3.5 checkout failed to build the embedded expat XML library for me, due to the configure check that adds "-Werror=declaration-after-statement" to the compiler flags. I'm guessing this was introduced via the expat code changes brought in for https://github.com/python/cpython/commit/f2492bb6aae061aea47e21fc7e56b7ab9bfdf543 That configure check is gone in 3.6 and 3.7, but it's still there in 3.5. Locally, I've worked around the problem by removing the configure check, but I'm not sure that's the right answer, as I believe we still promise that 3.5 will build under C89.
msg310038 - (view)
Author: Alyssa Coghlan (ncoghlan) *
Date: 2018-01-16 05:50
Details of the compilation failure: ``` building 'pyexpat' extension gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -DHAVE_EXPAT_CONFIG_H=1 -DXML_POOR_ENTROPY=1 -DUSE_PYEXPAT_CAPI -I/home/ncoghlan/devel/py35/Modules/expat -I./Include -I. -I/usr/local/include -I/home/ncoghlan/devel/py35/Include -I/home/ncoghlan/devel/py35 -c /home/ncoghlan/devel/py35/Modules/pyexpat.c -o build/temp.linux-x86_64-3.5/home/ncoghlan/devel/py35/Modules/pyexpat.o gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -DHAVE_EXPAT_CONFIG_H=1 -DXML_POOR_ENTROPY=1 -DUSE_PYEXPAT_CAPI -I/home/ncoghlan/devel/py35/Modules/expat -I./Include -I. -I/usr/local/include -I/home/ncoghlan/devel/py35/Include -I/home/ncoghlan/devel/py35 -c /home/ncoghlan/devel/py35/Modules/expat/xmlparse.c -o build/temp.linux-x86_64-3.5/home/ncoghlan/devel/py35/Modules/expat/xmlparse.o gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -DHAVE_EXPAT_CONFIG_H=1 -DXML_POOR_ENTROPY=1 -DUSE_PYEXPAT_CAPI -I/home/ncoghlan/devel/py35/Modules/expat -I./Include -I. -I/usr/local/include -I/home/ncoghlan/devel/py35/Include -I/home/ncoghlan/devel/py35 -c /home/ncoghlan/devel/py35/Modules/expat/xmlrole.c -o build/temp.linux-x86_64-3.5/home/ncoghlan/devel/py35/Modules/expat/xmlrole.o gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -DHAVE_EXPAT_CONFIG_H=1 -DXML_POOR_ENTROPY=1 -DUSE_PYEXPAT_CAPI -I/home/ncoghlan/devel/py35/Modules/expat -I./Include -I. -I/usr/local/include -I/home/ncoghlan/devel/py35/Include -I/home/ncoghlan/devel/py35 -c /home/ncoghlan/devel/py35/Modules/expat/xmltok.c -o build/temp.linux-x86_64-3.5/home/ncoghlan/devel/py35/Modules/expat/xmltok.o /home/ncoghlan/devel/py35/Modules/expat/xmltok.c: In function ‘utf8_toUtf8’: /home/ncoghlan/devel/py35/Modules/expat/xmltok.c:408:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] const char * const fromLimBefore = fromLim; ^~~~~ /home/ncoghlan/devel/py35/Modules/expat/xmltok.c:414:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] const ptrdiff_t bytesToCopy = fromLim - *fromP; ^~~~~ cc1: some warnings being treated as errors ```
msg310066 - (view)
Author: STINNER Victor (vstinner) *
Date: 2018-01-16 09:47
Hum, I backported a fix to 3.4 but I forgot Python 3.5. My fix for Python 3.4 is made of multiple bugfixes: 8b11e8de7aedacfbbcc8c780f3c4097396f1d1a3 For Python 3.5, you want at least this change I think: https://github.com/libexpat/libexpat/commit/e0b290eb3d8f4c4b45137a7d7f4f8db812145bd2
msg310074 - (view)
Author: Alyssa Coghlan (ncoghlan) *
Date: 2018-01-16 10:53
I couldn't persuade git to pull the upstream patch in directly, so I just made the same change downstream: https://github.com/python/cpython/pull/5201
msg310491 - (view)
Author: Larry Hastings (larry) *
Date: 2018-01-23 10:24
New changeset 57fa0ab8911a70d91e5b60b8dc91f1085442a9e7 by larryhastings (Nick Coghlan) in branch '3.5': [3.5] bpo-32563 : Get expat to compile under C89 (#5201 ) https://github.com/python/cpython/commit/57fa0ab8911a70d91e5b60b8dc91f1085442a9e7
msg314683 - (view)
Author: Alyssa Coghlan (ncoghlan) *
Date: 2018-03-30 08:30
Tidying up old git branches, and I noticed this was still open even though Larry had long ago merged the PR.
History
Date
User
Action
Args
2022-04-11 14:58:56
admin
set
github: 76744
2018-03-30 08:30:19
ncoghlan
set
status: open -> closedversions: + Python 3.5messages: + resolution: fixedstage: patch review -> resolved
2018-01-23 10:24:46
larry
set
messages: +
2018-01-16 10:53:10
ncoghlan
set
messages: +
2018-01-16 10:50:58
ncoghlan
set
keywords: + patch stage: needs patch -> patch reviewpull_requests: + <pull%5Frequest5055>
2018-01-16 09:47:05
vstinner
set
messages: +
2018-01-16 05:50:40
ncoghlan
set
messages: +
2018-01-16 05:14:41
ncoghlan
create