View previous topic :: View next topic |
Author |
Message |
LBGSHI
Joined: 07 Aug 2006 Posts: 136
|
Posted: Thu Apr 02, 2009 3:09 am Post subject: SifLoadModule... |
|
|
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 |
|
|
Lukasz
Joined: 19 Jan 2004 Posts: 248 Location: Denmark
|
Posted: Thu Apr 02, 2009 3:55 am Post subject: |
|
|
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 |
|
|
LBGSHI
Joined: 07 Aug 2006 Posts: 136
|
Posted: Thu Apr 02, 2009 9:12 am Post subject: |
|
|
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 |
|
|
LBGSHI
Joined: 07 Aug 2006 Posts: 136
|
Posted: Thu Apr 02, 2009 1:50 pm Post subject: |
|
|
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 |
|
|
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Thu Apr 02, 2009 4:18 pm Post subject: |
|
|
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 |
|
|
LBGSHI
Joined: 07 Aug 2006 Posts: 136
|
Posted: Thu Apr 02, 2009 9:29 pm Post subject: |
|
|
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 |
|
|
Lukasz
Joined: 19 Jan 2004 Posts: 248 Location: Denmark
|
Posted: Fri Apr 03, 2009 1:58 am Post subject: |
|
|
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 |
|
|
LBGSHI
Joined: 07 Aug 2006 Posts: 136
|
Posted: Fri Apr 03, 2009 2:07 am Post subject: |
|
|
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 |
|
|
Lukasz
Joined: 19 Jan 2004 Posts: 248 Location: Denmark
|
Posted: Fri Apr 03, 2009 2:20 am Post subject: |
|
|
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 |
|
|
LBGSHI
Joined: 07 Aug 2006 Posts: 136
|
Posted: Fri Apr 03, 2009 8:25 am Post subject: |
|
|
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 |
|
|
LBGSHI
Joined: 07 Aug 2006 Posts: 136
|
Posted: Sat Apr 04, 2009 4:22 am Post subject: |
|
|
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 |
|
|
|