birdal46 / grafx2

Automatically exported from code.google.com/p/grafx2
0 stars 0 forks source link

Changes after r335 that don't compile on haiku #61

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
when compiling grafx2 on haiku os, using r359. I get:

baron@/>cd /boot/home/Desktop/grafx2
baron@/boot/home/Desktop/grafx2>make
gcc -W -Wall -c -g `sdl-config --cflags`  -I/boot/common/include -c main.c
-o obj/haiku/main.o
/boot/home/Desktop/grafx2/main.c: In function `Initialisation_du_programme':
/boot/home/Desktop/grafx2/main.c:338: parse error before `*'
/boot/home/Desktop/grafx2/main.c:339: `Icone' undeclared (first use in this
function)
/boot/home/Desktop/grafx2/main.c:339: (Each undeclared identifier is
reported only once
/boot/home/Desktop/grafx2/main.c:339: for each function it appears in.)
make: *** [obj/haiku/main.o] Error 1

Changes in r355 don't seem to work with haiku.

Original issue reported on code.google.com by richienyhus on 25 Nov 2008 at 6:28

GoogleCodeExporter commented 8 years ago
If changes in r355 are removed, compiling stops(graph.c:28) due to the fact
BeOS/haiku does not use sys/sysinfo.h.

Original comment by richienyhus on 25 Nov 2008 at 6:45

GoogleCodeExporter commented 8 years ago
The parse error is due to declaring a variable "in the middle of" the code, 
it's 
valid in C++ but we're compiling C so I don't know why it doesn't raise an 
error or 
warning for me.
Try putting the declarations before the function calls in main.c:335
// Routine pour définir l'icone.
 char Chemin_icone[256];
 SDL_Surface * Icone; // <--
 sprintf(Chemin_icone, "%s%s", Repertoire_du_programme, "gfx2.gif");
 Icone = IMG_Load(Chemin_icone); // <--
 if (Icone)
 ...

Original comment by yrizoud on 25 Nov 2008 at 9:38

GoogleCodeExporter commented 8 years ago
For the sys/sysinfo.h part, I attached a modified copy of graph.c that doesn't 
use 
it.
(I cannot access svn from here)

Original comment by yrizoud on 25 Nov 2008 at 10:00

Attachments:

GoogleCodeExporter commented 8 years ago
svn362 includes both "fixes".

Original comment by yrizoud on 25 Nov 2008 at 7:58

GoogleCodeExporter commented 8 years ago
you can actually declare a variable in the middle of the code in C99 / gcc4. 
But it 
will not work with gcc2 nor openwatcom...

Original comment by pulkoma...@gmail.com on 25 Nov 2008 at 8:15

GoogleCodeExporter commented 8 years ago
I don't know if I should open a new issue for this but I now get:

baron@/boot/home/Desktop/grafx/grafx2-read-only>make
gcc -W -Wall -c -g `sdl-config --cflags`  -I/boot/common/include -c readline.c 
-o
obj/haiku/readline.o
/boot/home/Desktop/grafx/grafx2-read-only/readline.c: In function 
`CaractereValide':
/boot/home/Desktop/grafx/grafx2-read-only/readline.c:90: parse error before 
`int'
/boot/home/Desktop/grafx/grafx2-read-only/readline.c:91: `Position' undeclared 
(first
use in this function)
/boot/home/Desktop/grafx/grafx2-read-only/readline.c:91: (Each undeclared 
identifier
is reported only once
/boot/home/Desktop/grafx/grafx2-read-only/readline.c:91: for each function it 
appears
in.)
make: *** [obj/haiku/readline.o] Error 1

Original comment by richienyhus on 26 Nov 2008 at 2:09

GoogleCodeExporter commented 8 years ago
It's ok to continue on this one, to fix changes since r335 that don't compile 
on 
Beos and/or Haiku.

readline.c:90 is the same problem as Comment1: the "int Position;" should be 
moved 
back a few lines so it's before the first "if".

From the docs I just read, Haiku uses the compiler gcc 2.95
It's ok so far (grafx2 compiled until r335) so I think we just need to compile 
by 
default with "-Wdeclaration-after-statement", to avoid mixed declarations and 
code.

Original comment by yrizoud on 26 Nov 2008 at 9:14

GoogleCodeExporter commented 8 years ago
Haiku/beos being back on GCC 2.95 is a real pain. Hopefully when Haiku hits 
Alpha1 
such problems will go away for the most part, seeing as it is planed as a GCC 
2/4 
hybrid.

Alpha1 "should" be a few months around the conner. So if anything gets really 
broken,  
a working port to Haiku can wait till then. Still If 
"-Wdeclaration-after-statement" 
has a chance to work, then there is not point it not trying. :)

Original comment by richienyhus on 26 Nov 2008 at 12:12

GoogleCodeExporter commented 8 years ago
Well, variables declarations in the middle of code isn't a good idea anyways, i 
should already have enabled this warning. I don't think we'll have problems 
with the 
gcc2 vs gcc4 things as our code is pure C and is not affected by the C++ ABI 
change 
that breaks binary compatibility between them. So a gcc4 build of grafx2 could 
run 
on BeOS as well.

Original comment by pulkoma...@gmail.com on 30 Nov 2008 at 6:47

GoogleCodeExporter commented 8 years ago
Well, variables declarations in the middle of code isn't a good idea anyways, i 
should already have enabled this warning. I don't think we'll have problems 
with the 
gcc2 vs gcc4 things as our code is pure C and is not affected by the C++ ABI 
change 
that breaks binary compatibility between them. So a gcc4 build of grafx2 could 
run 
on BeOS as well.

Original comment by pulkoma...@gmail.com on 30 Nov 2008 at 6:47

GoogleCodeExporter commented 8 years ago

Original comment by pulkoma...@gmail.com on 16 Dec 2008 at 10:29

GoogleCodeExporter commented 8 years ago
AFAIK, the current issues are fixed. The extra compilation warning is a good 
thing,
on several occasions it has helped me to avoid repeating the mistake.
The only thing that could be undetected yet, is if the update method (that was
recently changed) is good for this platform.

Original comment by yrizoud on 24 Dec 2008 at 2:15

GoogleCodeExporter commented 8 years ago
I've asked Begasus to test the latest revision. If it works, we can close this 
one.

Original comment by pulkoma...@gmail.com on 24 Dec 2008 at 2:38

GoogleCodeExporter commented 8 years ago
compiles and runs fines under haiku :)
Thanks, Begasus

Original comment by pulkoma...@gmail.com on 24 Dec 2008 at 2:52