Allegro


namco

Member
Joined
Mar 22, 2006
Messages
410
Age
41
Location
Manchester, UK
Website
www.stupendous-stuff.com
Apologies for the new thread.

Since I'm got my main pc back I've decided to have a fresh look at compiling zombiepox.

This is what output my makefile gives:

QUOTE
C:\zpox_src>make
C:/devkitGP2X/bin/arm-linux-g++ `C:/devkitGP2X/bin/gp2x-allegro-config --cflags`
-O2 -Wall -Werror -c -o main.o main.cpp
In file included from C:\gp2xallegro-0.3\include\/allegro/base.h:40,
from C:\gp2xallegro-0.3\include\allegro.h:25,
from main.cpp:27:
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:36:44: error: allegro/platform/alplatf.h: No such file or directory
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:60:8: error: #error platform not supported
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:64:44: error: allegro/platform/astdint.h: No such file or directory
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:350:5: error: #error endianess not defined
In file included from C:\gp2xallegro-0.3\include\/allegro/system.h:246,
from C:\gp2xallegro-0.3\include\allegro.h:27,
from main.cpp:27:
C:\gp2xallegro-0.3\include\/allegro/inline/system.inl:22:27: error: allegro/debug.h: No such file or directory
In file included from C:\gp2xallegro-0.3\include\/allegro/draw.h:66,
from C:\gp2xallegro-0.3\include\allegro.h:40,
from main.cpp:27:
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:23:24: error: allegro/3d.h:No such file or directory
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:370: error: 'bmp_read24' declared as an 'inline' variable
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:370: error: 'uintptr_t'was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:370: error: 'bmp_read24' declared as an 'inline' variable
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:370: error: redefinition of 'int bmp_read24'
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:370: error: 'int bmp_read24' previously defined here
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:370: error: 'uintptr_t' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:380: error: variable or field 'bmp_write24' declared void
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:380: error: 'bmp_write24' declared as an 'inline' variable
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:380: error: 'uintptr_t' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:380: error: expected primary-expression before 'int'
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:380: error: initializer expression list treated as compound expression
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:380: error: variable or field 'bmp_write24' declared void
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:380: error: 'bmp_write24' declared as an 'inline' variable
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:380: error: redefinition of 'int bmp_write24'
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:380: error: 'int bmp_write24' previously defined here
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:380: error: 'uintptr_t' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:380: error: expected primary-expression before 'int'
C:\gp2xallegro-0.3\include\/allegro/inline/system.inl: In function 'void set_window_title(const char*)':
C:\gp2xallegro-0.3\include\/allegro/inline/system.inl:29: error: 'ASSERT' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/inline/system.inl: In function 'int desktop_color_depth()':
C:\gp2xallegro-0.3\include\/allegro/inline/system.inl:38: error: 'ASSERT' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/inline/system.inl: In function 'int get_desktop_resolution(int*, int*)':
C:\gp2xallegro-0.3\include\/allegro/inline/system.inl:49: error: 'ASSERT' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/inline/gfx.inl: At global scope:
C:\gp2xallegro-0.3\include\/allegro/inline/gfx.inl:58: error: ISO C++ forbids declaration of 'uintptr_t' with no type
C:\gp2xallegro-0.3\include\/allegro/inline/gfx.inl:58: error: typedef 'uintptr_t' is initialized (use __typeof__ instead)
C:\gp2xallegro-0.3\include\/allegro/inline/gfx.inl:58: error: '_BMP_BANK_SWITCHER' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/inline/gfx.inl:58: error: expected ',' or ';' before '(' token
C:\gp2xallegro-0.3\include\/allegro/inline/gfx.inl: In function 'uintptr_t bmp_write_line(BITMAP*, int)':
C:\gp2xallegro-0.3\include\/allegro/inline/gfx.inl:62: error: '_BMP_BANK_SWITCHER' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/inline/gfx.inl:62: error: expected `;' before 'switcher'
C:\gp2xallegro-0.3\include\/allegro/inline/gfx.inl:62: error: 'switcher' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/inline/gfx.inl: In function 'uintptr_t bmp_read_line(BITMAP*, int)':
C:\gp2xallegro-0.3\include\/allegro/inline/gfx.inl:69: error: '_BMP_BANK_SWITCHER' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/inline/gfx.inl:69: error: expected `;' before 'switcher'
C:\gp2xallegro-0.3\include\/allegro/inline/gfx.inl:69: error: 'switcher' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl: In function 'void _putpixel(BITMAP*, int, int, int)':
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:413: error: 'uint8_t' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:413: error: expected primary-expression before ')' token
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl: In function 'int _getpixel(BITMAP*, int, int)':
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:424: error: 'uint8_t' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:424: error: expected primary-expression before ')' token
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl: In function 'void _putpixel15(BITMAP*, int, int, int)':
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:438: error: 'uint16_t' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:438: error: expected primary-expression before ')' token
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl: In function 'int _getpixel15(BITMAP*, int, int)':
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:449: error: 'uint16_t' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:449: error: expected primary-expression before ')' token
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl: In function 'void _putpixel16(BITMAP*, int, int, int)':
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:463: error: 'uint16_t' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:463: error: expected primary-expression before ')' token
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl: In function 'int _getpixel16(BITMAP*, int, int)':
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:474: error: 'uint16_t' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:474: error: expected primary-expression before ')' token
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl: In function 'void _putpixel24(BITMAP*, int, int, int)':
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:488: error: 'bmp_write24' cannot be used as a function
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl: In function 'int _getpixel24(BITMAP*, int, int)':
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:499: error: 'bmp_read24' cannot be used as a function
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl: In function 'void _putpixel32(BITMAP*, int, int, int)':
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:513: error: 'uint32_t' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:513: error: expected primary-expression before ')' token
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl: In function 'int _getpixel32(BITMAP*, int, int)':
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:524: error: 'uint32_t' was not declared in this scope
C:\gp2xallegro-0.3\include\/allegro/inline/draw.inl:524: error: expected primary-expression before ')' token
c:\devkitgp2x\bin\../sysroot/usr/include/stdint.h: At global scope:
c:\devkitgp2x\bin\../sysroot/usr/include/stdint.h:129: error: conflicting declaration 'typedef unsigned int uintptr_t'
C:\gp2xallegro-0.3\include\/allegro/inline/gfx.inl:58: error: 'uintptr_t' has aprevious declaration as 'typedef int uintptr_t'
cc1plus.exe: warnings being treated as errors
ISortable.h:34: warning: 'class ISortable' has virtual functions but non-virtual destructor
main.cpp: In function 'int init_game()':
main.cpp:331: warning: 'set_window_close_button' is deprecated (declared at C:\gp2xallegro-0.3\include\/allegro/alcompat.h:192)
main.cpp:331: warning: 'set_window_close_button' is deprecated (declared at C:\gp2xallegro-0.3\include\/allegro/alcompat.h:192)
make: *** [main.o] Error 1


Do I need to go back through the library and fix stuff or have I just compiled it wrongly.

Just in case that I have compiled wrongly I'll also provide the makefile below:

CODE

PROG_NAME = zombiepox
OBJS = main.o CItem.o CTile.o CMap.o CActor.o hisc.o soundbox.o
CROSS_COMPILE = C:/devkitGP2X/bin/arm-linux-
SDL_BASE = C:/devkitGP2X/bin/gp2x-allegro-config
LDFLAGS = -static

CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
STRIP = $(CROSS_COMPILE)strip
CLEANUP = rm -f $(ALL_TARGETS) *.o *~
GPECOMP = gpecomp $(PROG_NAME).gpi $(PROG_NAME).gpe

CFLAGS=`$(SDL_BASE) --cflags` -O2 -Wall -Werror
CXXFLAGS=`$(SDL_BASE) --cflags` -O2 -Wall -Werror
LIBS=`$(SDL_BASE) --libs`

TARGET=$(PROG_NAME).gpe
SDLTEST_OBJS = $(OBJS)

all : $(TARGET)

$(TARGET):$(SDLTEST_OBJS)
$(CXX)$(LDFLAGS)-o$(TARGET)$(SDLTEST_OBJS)$(LIBS)
$(STRIP) $(TARGET)
$(GPECOMP)
$(CLEANUP)



Thanks for any help.
 
Hehe.. impatient?

Yeah, I'd say gp2x-allegro-config --cflags isn't returning the right path..
Under the returned path you would have (for example)
allegro/platform/alplatf.h

eg mine returns -I/opt/gp2x/include

You also have a weird mixture of slashes and backslashes..? Is this normal.. something to do with developing on windows??
eg "C:\gp2xallegro-0.3\include\/allegro/inline/system.inl"
 
Thanks guys.

Sorry, I've been promising zombiepox for the past 6 months (on and off) and everytime I go back I keep getting damn errors.

Right, the returning path...this'll be that prefix I had to change in the config file?

QUOTE

You also have a weird mixture of slashes and backslashes..? Is this normal.. something to do with developing on windows??



Yeah I'm deving on windows so I'm assumming it's that. I do have Qemu with Slackware 11.0 set up, just in case :)
 
Just run
C:/devkitGP2X/bin/gp2x-allegro-config --cflags
in a command prompt and see what's returned..
then check that path is correct.

Sorry, I don't dev in windows - too much 'in the way' :)
 
Um, doesn't like that...however what I did do was to re write certain include files to point to the right area. For example:

C:\gp2xallegro-0.3\include\/allegro/internal/alconfig.h:36:44: error: allegro/platform/alplatf.h: No such file or directory

was re-edited so it now pointed at:
C:\gp2xallegro-0.3\include\allegro\platform\alplatf.h

that seemed to have done the trick.

However I'm now at my last error which I'm a little stuck on. After running make i now get:

QUOTE
C:\zpox_src>make
C:/devkitGP2X/bin/arm-linux-g++ `C:/devkitGP2X/bin/gp2x-allegro-config --cflags` -O2 -Wall -Werror -c -o main.o main.cpp
cc1plus.exe: warnings being treated as errors
ISortable.h:34: warning: 'class ISortable' has virtual functions but non-virtual destructor
make: *** [main.o] Error 1


Here is ISortable.h:

CODE

#ifndef _CSORTABLE_H_
#define _CSORTABLE_H_

#include <list>

using namespace std;

// forward declarations
class CActor;
class CMap;


class ISortable {
public:
int x() { return (int)m_x; }
int y() { return (int)m_y; }
void setX(int p_x) { m_x = p_x; }
void setY(int p_y) { m_y = p_y; }
virtual void render(BITMAP *p_bmp, int p_x, int p_y) = 0;
virtual int update(CMap *p_map, list<ISortable *> *p_list) = 0;
virtual int getMapRow() = 0;

protected:
// position
double m_x, m_y;

};


class ByYPos {
public:
bool operator()(ISortable *a, ISortable *b) {
return a->y() < b->y();
}
};



#endif



Thanks again! :)
 
Add 'virtual ~ISortable()'

It's warning you because this is a potential memory leak.

If you have a ISortable pointer pointing to a subclass of ISortable and delete the point, the destructor of the subclass will not be called if the destructor isn't virtual.

It's generally a good idea to make all destructors virtual to help avoid memory leaks.
 
Did that which it seemed to be happy with, then it was doing the whole no rule to make target xxx needed by yyyy thing.

started again with their makefile and got this:

c:\devkitgp2x\bin\..\lib\gcc\arm-linux\4.0.2\..\..\..\..\arm-linux\bin\ld.exe: c
annot find -lalleg
 
You really need to sort out your 'gp2x-allegro-config' - hard coding paths into the makefile and/or your code isn't the preferable method.
The last warning you had probably implies the same problem - ie soulds like it can't find 'gp2x-allegro-config' ; borne out by the fact you couldn't run it from the command line.
I think you ought to sort that out first before you mess around any more with the makefile and source (apart from that destructor problem)?
Your last error implies it can't find the static lib for allegro.. ie a -L<path to lib> option to the linker.
Again, you could easily fix this by editing the makefile, but you're avoiding the basic problem.
Find on your system where 'gp2x-allegro-config' is and sort out the path to that in your makefile and undo your explicit paths in your header & source files.
Then tell us what it returns with --cflags and --libs options if it still doesn't build.

EDIT:
I'm also a bit confused why you use 'SDL_BASE' as a define in the makefile when using ALLEGRO, but that's not a major issue. :)
 
QUOTE

You really need to sort out your 'gp2x-allegro-config' - hard coding paths into the makefile and/or your code isn't the preferable method.



Sorry for cheating :p

It does find gp2x-allegro-config but complains saying that its not recognised as a program/batch file/internal or external command

As for the makefile, that was me using someone elses and modifying it. After getting the:

QUOTE

no rule to make target xxx needed by yyyy thing.



so I used this instead:

CODE



# compiler
CC = C:/devkitGP2X/bin/arm-linux-g++

# compiler flags
CFLAGS = \
-O2\
#-fomit-frame-pointer\
#-ffast-math\
#-funroll-loops\
#-W\
-Wall\
#-pedantic

# linker flags
LDFLAGS = \
`C:/devkitGP2X/bin/gp2x-allegro-config --libs`\
-s


# o-files
OBJ_DIR = ./obj

ALL_OBJ = main.o \
CItem.o \
CTile.o \
CMap.o \
CActor.o \
hisc.o

# merge o-files and prepend path
OBJS = $(addprefix $(OBJ_DIR)/, $(ALL_OBJ))

# compile cpp to o
$(OBJ_DIR)/%.o: ./src/%.cpp
$(CC) $(CFLAGS) -c $< -o $@


# output filename
OUTPUT = zombiepox.gpe

# output location
OUTPUT_DIR = .

# main rule
$(OUTPUT): $(OBJS)
$(CC) $(OBJS) -o $(OUTPUT_DIR)/$@ $(LDFLAGS)


# resource file
RES_DIR = res
RES_FILE = $(RES_DIR)/ld48.rc

# resource rule
res.o : $(RES_FILE)
windres $(RES_FILE) -o $@

# UPX rule
upx : $(OUTPUT)
upx $(OUTPUT)



Which was their original and one that I modified.

Sorry about being so swappy. I'm just starting to get to get the hang of makefiles.
 
namco said:
Sorry for cheating :p
Heh - we all do it :)

namco said:
It does find gp2x-allegro-config but complains saying that its not recognised as a program/batch file/internal or external command
Mmmm.. sounds like a windows thing.. :( Maybe Parkydr knows more what the problem is - do you use cygwin on windows???

namco said:
Sorry about being so swappy. I'm just starting to get to get the hang of makefiles.
Makefiles (and vi) are great - it used to be so simple 20 years ago - then linux exploded onto the scene and there are all means of makefiles and configure scripts and GPL and SVN and and stuff... :(

Well you could go back to your makefile and add -L<path to lib> ...
 
Last edited by a moderator:
QUOTE

Maybe Parkydr knows more what the problem is - do you use cygwin on windows???



Not sure, I know that if I type "ls" into command prompt i get the linux version of "dir". And looking I have Msys installed, so that could be it.

After installing Slackware 11 on Qemu, I enjoyed playing with vim, just meant I didn't have to remember things like :wq etc etc
 
Can't help you with your setup - have you tired implicitly using -

CODE
PROG_NAME = zombiepox
OBJS = main.o CItem.o CTile.o CMap.o CActor.o hisc.o soundbox.o
CROSS_COMPILE = C:/devkitGP2X/bin/arm-linux-
SDL_BASE = -IC:\gp2xallegro-0.3\include
LDFLAGS = -static

CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
STRIP = $(CROSS_COMPILE)strip
CLEANUP = rm -f $(ALL_TARGETS) *.o *~
GPECOMP = gpecomp $(PROG_NAME).gpi $(PROG_NAME).gpe

CFLAGS=$(SDL_BASE) -O2 -Wall -Werror
CXXFLAGS=$(SDL_BASE) -O2 -Wall -Werror
LIBS= -LC:\gp2xallegro-0.3\lib

TARGET=$(PROG_NAME).gpe
SDLTEST_OBJS = $(OBJS)

all : $(TARGET)

$(TARGET):$(SDLTEST_OBJS)
$(CXX)$(LDFLAGS)-o$(TARGET)$(SDLTEST_OBJS)$(LIBS)
$(STRIP) $(TARGET)
$(GPECOMP)
$(CLEANUP)


I thhink this could be what you want..?
In fact looking again this morning - there are a few problems with your makefile - eg ALL_TARGETS never gets defined and the heavy use of 'SDL' in it - doesn't matter but I wonder where you got this makefile?
 
Had a go at it but it didn't want to know.

So in the end I switched to my "backup plan". I'm now using Slackware 11 (on qemu).

I've installed the devkitPro toolchain and now trying to configure allegro to build me the gp2x libraries.

I keep getting the error: "Sorry, mapped files are required for Linux console to work" in ./src/linux/fbcon.c:31:2

This is using the patched version of allegro 4.2.0 and when I run the configure when it says:

allegro_error2.jpg


Oh and:
checking for arm-linux-gcc or even /usr/local/devkitPro/devkitGP2X/bin/arm-linux-gcc it says no. Is that going to be a problem?

Thanks for your help and patience.

:)
 
Update:

gotten arm-linux-gcc to be recognised but when it comes to modexgfx.s I get a load of errors about a bad instruction (they total about 1k of errors).

How many of you guys got the configure and make for the allegro working for the gp2x???

I'm doing this through Slackware and I was hoping that this would be much easier than windows.
 
arm-linux-gcc? Sounds like an ancient toolchain or GPH's last one to me. Both are bad ;).
 
I'm now using the latest open2x compiler gcc-3.4.4 (glibc-2.3.6) and I get an unusual error when compiling allegro:

misc/asmdef.sh: line 50: unexpected EOF while looking for matching '
misc/asmdef.sh: line 54: syntax error: unexpected end of file


Has anyone come across this at all?
 
Last edited by a moderator:
Back
Top