kernel unresolved externals

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

Moderators: cheriff, TyRaNiD

Post Reply
Zeta
Posts: 9
Joined: Sat Jul 09, 2005 1:46 pm

kernel unresolved externals

Post by Zeta »

Hi. I am building a project based on different libraries and at this point I am getting some unresolved externals that I can't find a way to fix them. I get this:

/usr/local/pspdev/lib/gcc/psp/4.0.1/../../../../psp/lib/libc.a(_Exit.o): In function `_exit':
../../../../../../newlib/libc/sys/psp/libcglue.c:563: undefined reference to `sceKernelSelfStopUnloadModule'
../../../../../../newlib/libc/sys/psp/libcglue.c:570: undefined reference to `sceKernelExitThread'
/usr/local/pspdev/lib/gcc/psp/4.0.1/../../../../psp/lib/libc.a(_sbrk.o): In function `_sbrk':
../../../../../../newlib/libc/sys/psp/libcglue.c:406: undefined reference to `sceKernelAllocPartitionMemory'
../../../../../../newlib/libc/sys/psp/libcglue.c:408: undefined reference to `sceKernelGetBlockHeadAddr'
../../../../../../newlib/libc/sys/psp/libcglue.c:402: undefined reference to `sceKernelMaxFreeMemSize'
/usr/local/pspdev/lib/gcc/psp/4.0.1/../../../../psp/lib/libc.a(_sbrk.o): In function `__psp_free_heap':
../../../../../../newlib/libc/sys/psp/libcglue.c:428: undefined reference to `sceKernelFreePartitionMemory'
/usr/local/pspdev/lib/gcc/psp/4.0.1/../../../../psp/lib/libc.a(_write.o): In function `_write':
../../../../../../newlib/libc/sys/psp/libcglue.c:227: undefined reference to `sceIoWrite'
../../../../../../newlib/libc/sys/psp/libcglue.c:216: undefined reference to `sceKernelStdin'
../../../../../../newlib/libc/sys/psp/libcglue.c:218: undefined reference to `sceKernelStdout'
../../../../../../newlib/libc/sys/psp/libcglue.c:220: undefined reference to `sceKernelStderr'
/usr/local/pspdev/lib/gcc/psp/4.0.1/../../../../psp/lib/libc.a(_close.o): In function `_close':
../../../../../../newlib/libc/sys/psp/libcglue.c:176: undefined reference to `sceKernelStdout'
../../../../../../newlib/libc/sys/psp/libcglue.c:178: undefined reference to `sceKernelStderr'
../../../../../../newlib/libc/sys/psp/libcglue.c:174: undefined reference to `sceKernelStdin'
/usr/local/pspdev/lib/gcc/psp/4.0.1/../../../../psp/lib/libc.a(_lseek.o): In function `_lseek':
../../../../../../newlib/libc/sys/psp/libcglue.c:249: undefined reference to `sceIoLseek'
../../../../../../newlib/libc/sys/psp/libcglue.c:237: undefined reference to `sceKernelStdin'
../../../../../../newlib/libc/sys/psp/libcglue.c:239: undefined reference to `sceKernelStdout'
../../../../../../newlib/libc/sys/psp/libcglue.c:241: undefined reference to `sceKernelStderr'
/usr/local/pspdev/lib/gcc/psp/4.0.1/../../../../psp/lib/libc.a(_read.o): In function `_read':
../../../../../../newlib/libc/sys/psp/libcglue.c:195: undefined reference to `sceKernelStdin'
../../../../../../newlib/libc/sys/psp/libcglue.c:197: undefined reference to `sceKernelStdout'
../../../../../../newlib/libc/sys/psp/libcglue.c:199: undefined reference to `sceKernelStderr'

My toolchain is the last version, and I've been messing around with the Makefile for a long time but can't find a way to fix this. All the libraries compile without any complain. The makefile looks like this:

PSPSDK = $(shell psp-config --pspsdk-path)
TARGET = ZombieStation
OBJS = ZombieStation.o ZombieStationPSP.o Application.o ApplicationPSP.o ApplicationMode.o
LIBDIR = ./Core ./Display ./Game ./GUI ./Input ./Tests
INCDIR = $(LIBDIR)
LIBS = -lZombieTests -lZombieCore -lZombieGame -lZombieGUI -lZombieInput -lZombieDisplay -lpspgu

CFLAGS = -G0 -Wall -O2
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LDFLAGS =

include $(PSPSDK)/lib/build.mak

ifneq ($VS_PATH),)
CC = psp-g++
endif

I've used the search on the forums to see if anybody else had the same problem and all but still can't find a solution. Does anybody have any idea about what can I be doing wrong? Thanks in advance.
And congratulations for the excellent work on the sdk.
Zeta
Posts: 9
Joined: Sat Jul 09, 2005 1:46 pm

Post by Zeta »

Just in case anybody has this problem in the future, I fixed it changing a makefile line to look like this:

LIBS = -lc -lZombieTests -lZombieCore -lZombieGame -lZombieGUI -lZombieInput -lZombieDisplay -lpspgu

I'm not very used to makefiles and it seems like the order of the libraries is very important.

Also I would like you to know that trying to fix this I deleted the whole /usr/local/pspdev directory, then downloaded the psptoolchain from svn on psp/trunk/psptoolchain and tried to install it but it resulted on an error while compiling a gdb project, reporting that the libintl.a was missing. I don't know if it's important or not since it's not an official release but I just wanted to warn you.

Thanks
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

Yeah, order is very important when using the gnu linker. People who come from other environments where this isn't the case get hit by it a bit before they figure it out.
GE Dominator
Post Reply