compilation problem with openTRI

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

compilation problem with openTRI

Post by Heimdall »

When i try to build the latest openTRI i get the following error:

Code: Select all

psp-gcc -I. -IC:/pspsdk/psp/sdk/include -O3 -G0 -Wall -D__PSP__ -D_PSP_FW_VERSION=150   -c -o triParticle.o triParticle.c
In file included from triParticle.c:36:
triParticle.h:184: error: expected ')' before '*' token
triParticle.h:222: error: expected specifier-qualifier-list before 'triParticleRenderer'
This happens on triParticle.h

Code: Select all

...

/** Custom particle render callback
  * @param s Pointer to particle system
  * @param p Pointer to particle structure to render
  */
typedef void (*triParticleRenderer)(triParticleSystem* s, triParticle* p);


typedef struct triParticleSystem
{
	triS32					ID;							// Particle system ID
	triS32					typeID;						// Particle system type ID - see triParticleEmitterTypes

	triParticleEmitter		*emitter;					// The emitter attached to this system

	triS32					textureID;					// Texture to use for this particle system
	triS32					texMode;					// one of GU_TFX_*
	triU32					texColor;					// sceGuTexEnvColor
	triBlendMode			blendMode;
	triS32					renderMode;					// GU_POINTS, GU_LINES, GU_SPRITES, GU_TRIANGLES

	triS32					useBillboards;				// make particles always point towards camera, only applicable in GU_TRIANGLES_MODE

	triU32					actions[triNumActions];		// actions to apply every frame


	triParticle* 			particles;					// particle list for update/movement
	triVortex* 				vortices;					// vortex particle list
	triS32*					particleStack;
	triS32*					vorticesStack;
	triS32					numParticles;
	triS32					numVortices;

	triS32					numVerticesPerParticle;		// numbers to allocate the right amount of memory

	void* 					vertices;					// particle vertice list for rendering (created during update)
	triS32					numVertices;
	triS32					vertexFormat;

	triVec3f				boundingBox[8];
	triS32					updateFlag;
	
	
	triParticleRenderer		render;						// function pointer to custom particle rendering function
	struct triParticleSystem*	next;
} triParticleSystem;

...
The typedef above references the struct bellow and the struct bellow reference the typedef above, GCC 4.3.1 seems not to like it! Any ideas on how to fix this?
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

Code: Select all

struct struct triParticleSystem; // forward declaration, only necessary if the following typedef doesn't already treat "struct triParticleSystem" as a forward declaration.

typedef void (*triParticleRenderer)(struct triParticleSystem* s, triParticle* p); 
sauron_le_noir
Posts: 203
Joined: Sat Jul 05, 2008 8:03 am

Post by sauron_le_noir »

No problem here

Code: Select all

[f731@localhost tri]$ psp-gcc -v
Utilisation des specs internes.
Target: psp
Configuré avec: ../configure --prefix=/usr/local/pspdev --target=psp --enable-languages=c,c++ --with-newlib --with-gmp --with-mpfr --enable-cxx-flags=-G0
Modèle de thread: single
gcc version 4.3.1 (GCC) 
[f731@localhost tri]$ make 
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o streams/streams.o streams/streams.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triTexman.o triTexman.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triCamera.o triCamera.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triVAlloc.o triVAlloc.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triMemory.o triMemory.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triFont.o triFont.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triRefcount.o triRefcount.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triImage.o triImage.c
triImage.c: In function ‘_triImageLoadPngStream’:
triImage.c:558: attention : passing argument 5 of ‘png_get_IHDR’ from incompatible pointer type
triImage.c:558: attention : passing argument 6 of ‘png_get_IHDR’ from incompatible pointer type
triImage.c:558: attention : passing argument 7 of ‘png_get_IHDR’ from incompatible pointer type
triImage.c:598: attention : passing argument 4 of ‘png_get_PLTE’ from incompatible pointer type
triImage.c:599: attention : passing argument 4 of ‘png_get_tRNS’ from incompatible pointer type
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o rle.o rle.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triGraphics.o triGraphics.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o tri3d.o tri3d.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triLog.o triLog.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triModel.o triModel.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triInput.o triInput.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triVMath_vfpu.o triVMath_vfpu.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triAt3.o triAt3.c
triAt3.c:161:22: attention : constante caractère multi-caractères
triAt3.c:165:23: attention : constante caractère multi-caractères
triAt3.c:169:25: attention : constante caractère multi-caractères
triAt3.c:171:26: attention : constante caractère multi-caractères
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triWav.o triWav.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triAudioLib.o triAudioLib.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triNet.o triNet.c
triNet.c: In function ‘triNetSocketAccept’:
triNet.c:235: attention : passing argument 3 of ‘accept’ from incompatible pointer type
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triError.o triError.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I../include -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG -D_PSP_FW_VERSION=150   -c -o triParticle.o triParticle.c
psp-ar cru ../lib/libtri.a ./streams/streams.o ./triTexman.o ./triCamera.o ./triVAlloc.o ./triMemory.o  ./triFont.o ./triRefcount.o ./triImage.o ./rle.o ./triGraphics.o ./tri3d.o ./triLog.o ./triModel.o ./triInput.o ./triVMath_vfpu.o ./triAt3.o ./triWav.o ./triAudioLib.o ./triNet.o ./triError.o ./triLog.o ./triParticle.o
psp-ranlib ../lib/libtri.a
my makefile is:

Code: Select all

PSPSDK=$(shell psp-config --pspsdk-path)
PSPDIR=$(shell psp-config --psp-prefix)

TARGET_LIB = ../lib/libtri.a
OBJS = ./streams/streams.o ./triTexman.o ./triCamera.o ./triVAlloc.o ./triMemory.o  ./triFont.o \
	./triRefcount.o ./triImage.o ./rle.o ./triGraphics.o ./tri3d.o ./triLog.o \
	./triModel.o ./triInput.o ./triVMath_vfpu.o ./triAt3.o ./triWav.o ./triAudioLib.o \
	./triNet.o ./triError.o ./triLog.o ./triParticle.o
CFLAGS += -I../include -I $(PSPDIR)/include -I $(PSPDIR)/include/freetype2 -I ./streams -I ./mmgr -I ./pmp -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY -DTRI_SUPPORT_PNG
LIBS = -lpspgum -lpspgu -lpsprtc -lm -lz -lpspwlan -lpspaudio -lpspaudiocodec -lcurl
include $(PSPSDK)/lib/build.mak

install: $(PSP_LIB)
	@echo "Installing libtri into $(PSPDIR)"
	mkdir -p $(PSPDIR)/include $(PSPDIR)/include/tri $(PSPDIR)/include/tri/streams $(PSPDIR)/include/tri/mmgr $(PSPDIR)/include/tri/pmp  $(PSPDIR)/lib
	cp *.h $(PSPDIR)/include/tri
	cp ./streams/*.h $(PSPDIR)/include/tri/streams
	cp ./mmgr/*.h $(PSPDIR)/include/tri/mmgr
	cp ./pmp/*.h  $(PSPDIR)/include/tri/pmp
	cp $(TARGET_LIB) $(PSPDIR)/lib
	@echo "Done"
[/code]
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

Code: Select all

//struct triParticleSystem;

/** Custom particle render callback
  * @param s Pointer to particle system
  * @param p Pointer to particle structure to render
  */
typedef void (*triParticleRenderer)(struct triParticleSystem* s, triParticle* p);
without forward declaring the struct GCC warns:

Code: Select all

psp-gcc -I. -IC:/pspsdk/psp/sdk/include -O3 -G0 -Wall -D__PSP__ -D_PSP_FW_VERSION=150   -c -o triParticle.o triParticle.c
In file included from triParticle.c:36:
triParticle.h:186: warning: 'struct triParticleSystem' declared inside parameter list
triParticle.h:186: warning: its scope is only this definition or declaration, which is probably not what you want
triParticle.c: In function 'triParticleSystemRender':
triParticle.c:179: warning: passing argument 1 of 's->render' from incompatible pointer type
triParticle.c: In function 'triParticleUpdateLoadEmitter':
triParticle.c:288: warning: no return statement in function returning non-void
BTW i'm using the latest SVN version rev29 which have a different makefile from sauron_le_noir.

With the forward declaration it works perfectly!
sauron_le_noir
Posts: 203
Joined: Sat Jul 05, 2008 8:03 am

Post by sauron_le_noir »

Yes indeed it is better to use the forward declaration gcc 4.3 is more strict (and it is better) just must just talking to raphael about this problem so he can put it in his code
i have made my own makefile because so i can incorporate it in my pdf reader as dependance of a JAMRULES
mupdf use JAM perftools
sauron_le_noir
Posts: 203
Joined: Sat Jul 05, 2008 8:03 am

Post by sauron_le_noir »

by the way don't forget to drop this macro -D__PSP__ -DDEBUG -D_DEBUG -D_DEBUG_LOG -D_DEBUG_MEMORY in your homebrew when is is in proudction
compiling your homebrew with this macro activate the logs of the TriMemory function
Increase also in triMemory.c this define
#define MAX_AMOUNT 32767
if you use a lot of triAlloc in your homebrew
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

I compiled the last version with gcc4.1.0, so that could indeed be a tighter restriction of latest gcc. I'll be sure to fix that :)

Comitted revision 30.
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
Post Reply