SifLoadModule...
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?
"undefined reference to `SifLoadModule'"
...regardless of whether or not I include LoadFile.h.
Any ideas?
I may be lazy, but I can...zzzZZZzzzZZZzzz...
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.
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.
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...
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...
Even forcing those seems to have no effect. Here's my current makefile:
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...
Code: Select all
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
I may be lazy, but I can...zzzZZZzzzZZZzzz...
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.
You may have conflicting lines in your makefile. Remove everything that doesn't correspond to what's in the makefile above.
Code: Select all
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
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.
Thanks very much for the help, though. The effort does not go unappreciated.
I may be lazy, but I can...zzzZZZzzzZZZzzz...
Try changing the order of the EE_LIBS:
To something like
or even
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.
Code: Select all
EE_LIBS := -lpadx -lc -lkernel
Code: Select all
EE_LIBS := -lkernel -lc -lpadx
Code: Select all
EE_LIBS := -lkernel -lc -lpadx -lc -lkernel