forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

compilation problem with openTRI

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Heimdall



Joined: 10 Nov 2005
Posts: 259
Location: Netherlands

PostPosted: Wed Aug 27, 2008 5:46 pm    Post subject: compilation problem with openTRI Reply with quote

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

Code:
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:

...

/** 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?
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Wed Aug 27, 2008 7:29 pm    Post subject: Reply with quote

Code:

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);
Back to top
View user's profile Send private message
sauron_le_noir



Joined: 05 Jul 2008
Posts: 229

PostPosted: Wed Aug 27, 2008 7:56 pm    Post subject: Reply with quote

No problem here
Code:

[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:

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]
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Heimdall



Joined: 10 Nov 2005
Posts: 259
Location: Netherlands

PostPosted: Wed Aug 27, 2008 8:07 pm    Post subject: Reply with quote

Code:
//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:
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!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
sauron_le_noir



Joined: 05 Jul 2008
Posts: 229

PostPosted: Wed Aug 27, 2008 8:15 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail MSN Messenger
sauron_le_noir



Joined: 05 Jul 2008
Posts: 229

PostPosted: Wed Aug 27, 2008 8:26 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Wed Aug 27, 2008 10:21 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group