Fabio Venturi
2014-03-21 13:30:18 UTC
Hello,
I'm trying to compile pygame from hg repository
with python3.4 (also this recompiled on Centos 6.5)
and I got the error:
ISO C90 forbids mixed declarations and code
following the environment and the steps i followed:
[***@linbox ~]$ gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)
[***@linbox ~]$ /usr/local/bin/virtualenv --version
1.11.4
[***@linbox ~]$ which python3
/usr/local/bin/python3
[***@linbox ~]$ python3 -V
Python 3.4.0
[***@linbox ~]$ virtualenv -p /usr/local/bin/python3.4 testenv
Already using interpreter /usr/local/bin/python3.4
Using base prefix '/usr/local'
New python executable in testenv/bin/python3.4
Also creating executable in testenv/bin/python
Installing setuptools, pip...done.
[***@linbox ~]$ . testenv/bin/activate
(testenv)[***@linbox ~]$
(testenv)[***@linbox testenv]$ which pip3
~/testenv/bin/pip3
(testenv)[***@linbox testenv]$ pip3 install
hg+https://bitbucket.org/pygame/pygame
Downloading/unpacking hg+https://bitbucket.org/pygame/pygame
Cloning hg https://bitbucket.org/pygame/pygame to /tmp/pip-opihfjlz-build
WARNING, No "Setup" File Exists, Running "config.py"
Using UNIX configuration...
Hunting dependencies...
SDL : found 1.2.14
FONT : found
IMAGE : found
MIXER : found
SMPEG : found 0.4.5
PNG : found
JPEG : found
SCRAP : found
PORTMIDI: found
PORTTIME: found
AVFORMAT: found
SWSCALE : found
FREETYPE: found 2.3.11
[...]
building 'pygame.scrap' extension
gcc -pthread -Werror=declaration-after-statement -DNDEBUG -g -fwrapv
-O3 -Wall -Wstrict-prototypes -fPIC -D_REENTRANT -DENABLE_NEWBUF=1
-I/usr/X11R6/include -I/usr/include/SDL
-I/usr/local/include/python3.4m -c src/scrap.c -o
build/temp.linux-x86_64-3.4/src/scrap.o
In file included from src/scrap.c:60:
src/scrap_x11.c: In function '_clipboard_filter':
src/scrap_x11.c:164: error: ISO C90 forbids mixed declarations and code
src/scrap_x11.c: In function '_get_data_as':
src/scrap_x11.c:429: error: ISO C90 forbids mixed declarations and code
src/scrap_x11.c: In function 'pygame_scrap_get_types':
src/scrap_x11.c:842: warning: passing argument 2 of 'PyDict_Next' from
incompatible pointer type
/usr/local/include/python3.4m/dictobject.h:63: note: expected
'Py_ssize_t *' but argument is of type 'int *'
error: command 'gcc' failed with exit status 1
So I modified scrap_x11.c and other files till i got pygame compiled
and working,
I'm posting the diff between pygame-fab (modified) and pygame-hg (original):
(testenv)[***@linbox testenv]$ diff -r pygame-fab pygame-hg
Binary files pygame-fab/.hg/dirstate and pygame-hg/.hg/dirstate differ
Only in pygame-fab/lib: version.py
Only in pygame-fab: __pycache__
Only in pygame-fab: Setup
Only in pygame-fab: Setup.bak
diff -r pygame-fab/src/scale_mmx64.c pygame-hg/src/scale_mmx64.c
205,206d204
< long long srcdiff64 = srcdiff;
< long long dstdiff64 = dstdiff;
211a210,211
< long long srcdiff64 = srcdiff;
< long long dstdiff64 = dstdiff;
318a317,318
159d158
< XEvent xevent = event->syswm.msg->event.xevent;
164a164
< *length = 0;
As you can see i just moved variables definition before functions calls,
and now pygame compile and (for the things i've tried) works:
(testenv)[***@linbox testenv]$ python3 -c 'import pygame;
print(pygame.version.ver)'
1.9.2a0
I thought this could help someone else,
my kindest regards,
- Fabio
I'm trying to compile pygame from hg repository
with python3.4 (also this recompiled on Centos 6.5)
and I got the error:
ISO C90 forbids mixed declarations and code
following the environment and the steps i followed:
[***@linbox ~]$ gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)
[***@linbox ~]$ /usr/local/bin/virtualenv --version
1.11.4
[***@linbox ~]$ which python3
/usr/local/bin/python3
[***@linbox ~]$ python3 -V
Python 3.4.0
[***@linbox ~]$ virtualenv -p /usr/local/bin/python3.4 testenv
Already using interpreter /usr/local/bin/python3.4
Using base prefix '/usr/local'
New python executable in testenv/bin/python3.4
Also creating executable in testenv/bin/python
Installing setuptools, pip...done.
[***@linbox ~]$ . testenv/bin/activate
(testenv)[***@linbox ~]$
(testenv)[***@linbox testenv]$ which pip3
~/testenv/bin/pip3
(testenv)[***@linbox testenv]$ pip3 install
hg+https://bitbucket.org/pygame/pygame
Downloading/unpacking hg+https://bitbucket.org/pygame/pygame
Cloning hg https://bitbucket.org/pygame/pygame to /tmp/pip-opihfjlz-build
WARNING, No "Setup" File Exists, Running "config.py"
Using UNIX configuration...
Hunting dependencies...
SDL : found 1.2.14
FONT : found
IMAGE : found
MIXER : found
SMPEG : found 0.4.5
PNG : found
JPEG : found
SCRAP : found
PORTMIDI: found
PORTTIME: found
AVFORMAT: found
SWSCALE : found
FREETYPE: found 2.3.11
[...]
building 'pygame.scrap' extension
gcc -pthread -Werror=declaration-after-statement -DNDEBUG -g -fwrapv
-O3 -Wall -Wstrict-prototypes -fPIC -D_REENTRANT -DENABLE_NEWBUF=1
-I/usr/X11R6/include -I/usr/include/SDL
-I/usr/local/include/python3.4m -c src/scrap.c -o
build/temp.linux-x86_64-3.4/src/scrap.o
In file included from src/scrap.c:60:
src/scrap_x11.c: In function '_clipboard_filter':
src/scrap_x11.c:164: error: ISO C90 forbids mixed declarations and code
src/scrap_x11.c: In function '_get_data_as':
src/scrap_x11.c:429: error: ISO C90 forbids mixed declarations and code
src/scrap_x11.c: In function 'pygame_scrap_get_types':
src/scrap_x11.c:842: warning: passing argument 2 of 'PyDict_Next' from
incompatible pointer type
/usr/local/include/python3.4m/dictobject.h:63: note: expected
'Py_ssize_t *' but argument is of type 'int *'
error: command 'gcc' failed with exit status 1
So I modified scrap_x11.c and other files till i got pygame compiled
and working,
I'm posting the diff between pygame-fab (modified) and pygame-hg (original):
(testenv)[***@linbox testenv]$ diff -r pygame-fab pygame-hg
Binary files pygame-fab/.hg/dirstate and pygame-hg/.hg/dirstate differ
Only in pygame-fab/lib: version.py
Only in pygame-fab: __pycache__
Only in pygame-fab: Setup
Only in pygame-fab: Setup.bak
diff -r pygame-fab/src/scale_mmx64.c pygame-hg/src/scale_mmx64.c
205,206d204
< long long srcdiff64 = srcdiff;
< long long dstdiff64 = dstdiff;
211a210,211
long long srcdiff64 = srcdiff;
long long dstdiff64 = dstdiff;
312,313d311long long dstdiff64 = dstdiff;
< long long srcdiff64 = srcdiff;
< long long dstdiff64 = dstdiff;
318a317,318
long long srcdiff64 = srcdiff;
long long dstdiff64 = dstdiff;
diff -r pygame-fab/src/scrap_x11.c pygame-hg/src/scrap_x11.clong long dstdiff64 = dstdiff;
159d158
< XEvent xevent = event->syswm.msg->event.xevent;
164a164
XEvent xevent = event->syswm.msg->event.xevent;
427a428*length = 0;
434d434< *length = 0;
As you can see i just moved variables definition before functions calls,
and now pygame compile and (for the things i've tried) works:
(testenv)[***@linbox testenv]$ python3 -c 'import pygame;
print(pygame.version.ver)'
1.9.2a0
I thought this could help someone else,
my kindest regards,
- Fabio