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 

SifLoadModule...

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



Joined: 07 Aug 2006
Posts: 136

PostPosted: Thu Apr 02, 2009 3:09 am    Post subject: SifLoadModule... Reply with quote

Is SifLoadModule defined in LoadFile.h alone, or is there another file I'm overlooking? I'm trying to revamp the old G2 library built by DreamTime, and temporarily using some fairly unorthodox methods to accomplish some testing and R&D (rather than tearing down the entire lib in order to remove the -nostdlib flag, I'm simply sidestepping it altogether for the time being by including requisite files explicitly and directly), but I can't seem to get around the error

"undefined reference to `SifLoadModule'"

...regardless of whether or not I include LoadFile.h.

Any ideas?
_________________
I may be lazy, but I can...zzzZZZzzzZZZzzz...
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Lukasz



Joined: 19 Jan 2004
Posts: 248
Location: Denmark

PostPosted: Thu Apr 02, 2009 3:55 am    Post subject: Reply with quote

The undefined reference is a linker error and not compile error.

So what you are missing is linking with libkernel.a by passing -lkernel parameter to ee-gcc along with the correct path. Which is always done in the prefined Makefile.eeglobal for the PS2SDK samples, by adding -lkernel (libkernel.a) and -lc (libc.a) to the EE_LIBS variables and the correct paths with EE_INCS.
_________________
Lukasz.dk
Back to top
View user's profile Send private message Visit poster's website
LBGSHI



Joined: 07 Aug 2006
Posts: 136

PostPosted: Thu Apr 02, 2009 9:12 am    Post subject: Reply with quote

I see! So, even though I've added the lines

include $(PS2SDK)/samples/Makefile.pref
include $(PS2SDK)/samples/Makefile.eeglobal

...to the end of the makefile, it must not be processing them for some reason...

Thanks for the insight. I'll see if I can come up with a resolution, and, even better, if I can figure out why it's failing in the first place...
_________________
I may be lazy, but I can...zzzZZZzzzZZZzzz...
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
LBGSHI



Joined: 07 Aug 2006
Posts: 136

PostPosted: Thu Apr 02, 2009 1:50 pm    Post subject: Reply with quote

Even forcing those seems to have no effect. Here's my current makefile:

Code:


EE_INCS := -I$(PS2SDK)/ee/include -I$(PS2SDK)/common/include -I. $(EE_INCS) -I$(PS2SDK)/ports -I$(PS2SDK)/ports/include
EE_LIBS := -lpadx -lc -lkernel
EE_LDFLAGS := -L$(PS2SDK)/ee/lib $(EE_LDFLAGS)
CFLAGS = -EL -G0 -mips3 -nostdlib -DPS2_EE

C_SRC = gs.c g2.c mdsplash.c splash.c
S_SRC = crt0.s ps2_asm.s dma_asm.s gs_asm.s

C_OBJ = $(addprefix obj/, $(C_SRC:.c=.o))
S_OBJ = $(addprefix obj/, $(S_SRC:.s=.o))

mdsplash.elf: $(C_OBJ) $(S_OBJ)
   @echo "-------------------------------------------------"
   ee-gcc $(CFLAGS) -Tlinkfile $(EE_LDFLAGS) $(EE_LIBS) -o mdsplash.elf $(C_OBJ) $(S_OBJ)

obj/%.o: %.c
   @echo "-------------------------------------------------"
   ee-gcc $(EE_INCS) -c $(CFLAGS) $< -o $@

obj/%.o: %.s
   @echo "-------------------------------------------------"
   ee-gcc -xassembler-with-cpp -c $(CFLAGS) $< -o $@

%.c: resources/%.bmp
   @echo "-------------------------------------------------"
   bmp2c $< $(*F) > $@

clean:
   rm -f $(C_OBJ) $(S_OBJ) *.elf splash.c

splash.c: resources/splash.bmp



Is there anything glaringly amiss? Including or not including makefile.eeglobal and makefile.pref in the normal fashion seems to have no effect, as if the include directive is ignored...
_________________
I may be lazy, but I can...zzzZZZzzzZZZzzz...
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Thu Apr 02, 2009 4:18 pm    Post subject: Reply with quote

Are you in Windows or linux? The filename is "loadfile.h", not "LoadFile.h", and it DOES make a difference in linux. Remember that case IS significant in linux. Also, look at a sample makefile.

Code:
EE_BIN = pad_example.elf
EE_OBJS = pad.o
EE_LIBS = -lpad -lc

all: $(EE_BIN)

clean:
   rm -f *.elf *.o *.a

include $(PS2SDK)/samples/Makefile.pref
include $(PS2SDK)/samples/Makefile.eeglobal


You may have conflicting lines in your makefile. Remove everything that doesn't correspond to what's in the makefile above.
Back to top
View user's profile Send private message AIM Address
LBGSHI



Joined: 07 Aug 2006
Posts: 136

PostPosted: Thu Apr 02, 2009 9:29 pm    Post subject: Reply with quote

I'm using MinGW, and the file is properly (un)capitalized. Yes, I'm aware of what a standard makefile looks like, and there'd be no problem, if I had the ability to simply "remove everything that doesn't correspond" to one. However, as mentioned, I'm trying to avoid that time-consuming endeavor for the moment...

Thanks very much for the help, though. The effort does not go unappreciated.
_________________
I may be lazy, but I can...zzzZZZzzzZZZzzz...
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Lukasz



Joined: 19 Jan 2004
Posts: 248
Location: Denmark

PostPosted: Fri Apr 03, 2009 1:58 am    Post subject: Reply with quote

Try changing the order of the EE_LIBS:

Code:
EE_LIBS := -lpadx -lc -lkernel


To something like

Code:
EE_LIBS := -lkernel -lc -lpadx


or even

Code:
EE_LIBS := -lkernel -lc -lpadx -lc -lkernel


There is a linker bug which can cause undefined references if the the libs are not specified in a correct order relative to each other.
_________________
Lukasz.dk
Back to top
View user's profile Send private message Visit poster's website
LBGSHI



Joined: 07 Aug 2006
Posts: 136

PostPosted: Fri Apr 03, 2009 2:07 am    Post subject: Reply with quote

I remember reading about that bug, and even seeing it mentioned as the reason for the makefile.eeglobal's forced ordering of some of the libs.

Unfortunately, neither of those made a difference...ack.
_________________
I may be lazy, but I can...zzzZZZzzzZZZzzz...
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Lukasz



Joined: 19 Jan 2004
Posts: 248
Location: Denmark

PostPosted: Fri Apr 03, 2009 2:20 am    Post subject: Reply with quote

Sounds like the bug is in your source, maybe you should post all the files and then we might be able to figure it out.
_________________
Lukasz.dk
Back to top
View user's profile Send private message Visit poster's website
LBGSHI



Joined: 07 Aug 2006
Posts: 136

PostPosted: Fri Apr 03, 2009 8:25 am    Post subject: Reply with quote

There must be, but I sure can't locate it. I'm not really...erm, at liberty to share the entire source, but I would if I could. Thanks for the help, in any case, and wish me luck :)
_________________
I may be lazy, but I can...zzzZZZzzzZZZzzz...
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
LBGSHI



Joined: 07 Aug 2006
Posts: 136

PostPosted: Sat Apr 04, 2009 4:22 am    Post subject: Reply with quote

Ah, jimmi pointed out the need for $(EE_LDFLAGS) $(EE_LIBS) in my linking statement, and then the final requirement was your suggested re-ordering of the libs, namely the redundant EE_LIBS := -lkernel -lc -lpadx -lc -lkernel

Thanks :)
_________________
I may be lazy, but I can...zzzZZZzzzZZZzzz...
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 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