Very weird compilation error

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

Moderators: cheriff, TyRaNiD

Post Reply
gambiting
Posts: 154
Joined: Thu Aug 17, 2006 5:39 pm

Very weird compilation error

Post by gambiting »

Hi! I can't compile my SDL game for PSP(it's a port of my own game for PC). Error I have is:

Code: Select all

gambiting@gambiting-desktop:~/psp/v-pop_psp$ make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -I/usr/local/pspdev/psp/include/SDL -Dmain=SDL_main -D_PSP_FW_VERSION=150  -L. -L/usr/local/pspdev/psp/sdk/lib   main.o -lpsprtc -lstdc++ -lc -lm -lz -lSDL -lSDLmain -lSDL_ttf -lSDL_gfx -lfreetype -L/usr/local/pspdev/psp/lib -lSDLmain -lSDL -lm -L/usr/local/pspdev/psp/sdk/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpspnet_inet  -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o V-POP.elf
/usr/local/pspdev/psp/lib/libSDLmain.a(SDL_psp_main.o): In function `cleanup_output':
psp/SDL_psp_main.c:122: multiple definition of `module_info'
main.o:/home/gambiting/psp/v-pop_psp/main.cpp:109: first defined here
/usr/local/pspdev/psp/lib/libSDLmain.a(SDL_psp_main.o): In function `cleanup_output':
psp/SDL_psp_main.c:122: multiple definition of `sce_newlib_attribute'
main.o:/home/gambiting/psp/v-pop_psp/main.cpp:109: first defined here
collect2: ld returned 1 exit status
make: *** [V-POP.elf] Error 1
gambiting@gambiting-desktop:~/psp/v-pop_psp$
It's very weird,as on line 109 in main.cpp file there is no such functions,only my own code,which is nowhere near related to SDL.My makefile:

Code: Select all

TARGET = V-POP
SOURCES = main.cpp
OBJS = main.o
YOURLIBS=
INCDIR =

CXX      = psp-g++ 

CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti -g -G4 -Wall -O2 -G0 -Wall -D_DEBUG -DPSPDevkit  -DPSP_FW_VERSION=371
ASFLAGS = $(CFLAGS)
SDL_CONFIG = $(PSPBIN)/sdl-config
USE_PSPSDK_LIBC=1 

LIBDIR =
LDFLAGS =
STDLIBS= -lpsprtc -lstdc++ -lc -lm -lz -lSDL -lSDLmain -lSDL_ttf -lSDL_gfx -lfreetype
LIBS=$(STDLIBS)$(YOURLIBS)

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = V-POP

PSPSDK=$(shell psp-config --pspsdk-path)
PSPBIN = $(PSPSDK)/../bin
CFLAGS += $(shell $(PSPBIN)/sdl-config --cflags)
LIBS += $(shell $(PSPBIN)/sdl-config --libs) 
include $(PSPSDK)/lib/build.mak
It's very stupid error,so I guess that's my mistake somewhere,and it will be easy to find.Please help :D
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

What is at line 109?
We can't guess if you won't show us, but you probably have some PSP_* macros that are conflicting with the ones in libSDLmain. Use one or the other, not both.
Chrighton
Posts: 58
Joined: Wed Jun 15, 2005 8:24 pm

Post by Chrighton »

That's exactly the problem, you're linking to SDL_main which has been built using those macros. Don't link to it if you want to use the macros in your stuff, or omit them if you do link to SDL_main.

Also, you may want to consider dropping SDL_main if you you plan on some level of compatibility with the slim psp.
gambiting
Posts: 154
Joined: Thu Aug 17, 2006 5:39 pm

Post by gambiting »

Hi! On line 109 there was my function void Draw_Box,but I figured it out - SDLmain uses it's own PSP_MODULE_INFO functions,so I couldn't use them in my own source file.But they were on line 6 and 7 so I don't know why compiler was telling me that they are on line 109...strange.Also,I removed SDLmain for now,as it wouldn't work with slim.Everything is solved.Thanks very much!
Post Reply