Hello, trying to compile a c++ app, upon link I get the following:
/cygdrive/p/ps2dev/setup/gcc/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libc.a(unlinkr.o)(.text+0x14): In function `_unlink_r':
../../../../../newlib/libc/reent/unlinkr.c:54: undefined reference to `unlink'
/cygdrive/p/ps2dev/setup/gcc/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libc.a(linkr.o)(.text+0x1c): In function `_link_r':
../../../../../newlib/libc/reent/linkr.c:61: undefined reference to `link'
Where are those functions defined?
I am currently including -lc -lkernel -lsyscall in link options.
Also tried adding all them options twice as -lc -lkernel -lsyscall -lc -lkernel -lsyscall .
Thanks.
Link error: 'link' and 'unlink' ???
I'm trying also to use init_scr() and scr_printf() functions, and gives me the same problem:
../Test.cpp: undefined reference to `init_scr()'
./Test.o(.text+0x8c):../Test.cpp: undefined reference to `scr_printf(char const*, ...)'
Doing an objdump, I've seen these functions are in libkernel, so why does it give me this error?
../Test.cpp: undefined reference to `init_scr()'
./Test.o(.text+0x8c):../Test.cpp: undefined reference to `scr_printf(char const*, ...)'
Doing an objdump, I've seen these functions are in libkernel, so why does it give me this error?
init_scr and scr_printf are in -ldebug
as for your first post... you said c++? .. try adding -lg after -lc
as for your first post... you said c++? .. try adding -lg after -lc
Shoot Pixels Not People!
Makeshift Development
Makeshift Development
My binary sdk doesn't have a libdebug.a, nor a debug.h.
init_scrand scr_printf are declared in kernel.h
Also, adding -lg after -lc (or before that) doesn't seem to work. :(
Something else I could try?
Note: In my binary distro, doing an objdump on kernel shows:
$ ../../../../gcc/ee/bin/ee-objdump.exe -x ../../../../ps2lib/ee/lib/libkernel.a | grep scr_printf
00000328 g F .text 000001dc scr_printf
$ ../../../../gcc/ee/bin/ee-objdump.exe -x libc.a | grep link
linkr.o: file format elf32-littlemips
rw-r--r-- 1000/513 17100 Jun 16 19:15 2004 linkr.o
00000000 g F .text 00000054 _link_r
00000000 *UND* 00000000 link
0000001c R_MIPS_26 link
00000000 *UND* 00000000 _unlink_r
00000008 R_MIPS_26 _unlink_r
00000000 *UND* 00000000 _link_r
00000000 *UND* 00000000 _unlink_r
0000001c R_MIPS_26 _link_r
00000030 R_MIPS_26 _unlink_r
unlinkr.o: file format elf32-littlemips
rw-r--r-- 1000/513 17264 Jun 16 19:15 2004 unlinkr.o
00000000 g F .text 0000004c _unlink_r
00000000 *UND* 00000000 unlink
00000014 R_MIPS_26 unlink
init_scrand scr_printf are declared in kernel.h
Also, adding -lg after -lc (or before that) doesn't seem to work. :(
Something else I could try?
Note: In my binary distro, doing an objdump on kernel shows:
$ ../../../../gcc/ee/bin/ee-objdump.exe -x ../../../../ps2lib/ee/lib/libkernel.a | grep scr_printf
00000328 g F .text 000001dc scr_printf
$ ../../../../gcc/ee/bin/ee-objdump.exe -x libc.a | grep link
linkr.o: file format elf32-littlemips
rw-r--r-- 1000/513 17100 Jun 16 19:15 2004 linkr.o
00000000 g F .text 00000054 _link_r
00000000 *UND* 00000000 link
0000001c R_MIPS_26 link
00000000 *UND* 00000000 _unlink_r
00000008 R_MIPS_26 _unlink_r
00000000 *UND* 00000000 _link_r
00000000 *UND* 00000000 _unlink_r
0000001c R_MIPS_26 _link_r
00000030 R_MIPS_26 _unlink_r
unlinkr.o: file format elf32-littlemips
rw-r--r-- 1000/513 17264 Jun 16 19:15 2004 unlinkr.o
00000000 g F .text 0000004c _unlink_r
00000000 *UND* 00000000 unlink
00000014 R_MIPS_26 unlink
libdebug is part of ps2sdk, if you don't have it then your install is broken.
Shoot Pixels Not People!
Makeshift Development
Makeshift Development
-
- Site Admin
- Posts: 72
- Joined: Sat May 22, 2004 9:29 pm
- Location: Copenhagen, Denmark
- Contact:
People should STOP trying to do the banz0red multiple lib linking order crap.
(Like having -lc -lkernel -lc -lsyscalls -lkernel etc to fix unresolved symbol issues)
The way to resolve this is NOT by putting them over and over, but by using --start-group and --end-group.
For example, in your makefile do:
EE_LIBS = -Xlinker --start-group
EE_LIBS += -lgcc -lm -lgskit -ldmakit -lkernel -lc -lsyscall -ldebug
EE_LIBS += -Xlinker --end-group
Note that each lib is only used one.
Also, the -Xlinker part is VERY important.
If you are linking using GCC and not ld itself, you need -Xlinker to get the --start/end-group flags to the linker itself. Remeber that GCC is a frontend, not the actual workhorse.
(Like having -lc -lkernel -lc -lsyscalls -lkernel etc to fix unresolved symbol issues)
The way to resolve this is NOT by putting them over and over, but by using --start-group and --end-group.
For example, in your makefile do:
EE_LIBS = -Xlinker --start-group
EE_LIBS += -lgcc -lm -lgskit -ldmakit -lkernel -lc -lsyscall -ldebug
EE_LIBS += -Xlinker --end-group
Note that each lib is only used one.
Also, the -Xlinker part is VERY important.
If you are linking using GCC and not ld itself, you need -Xlinker to get the --start/end-group flags to the linker itself. Remeber that GCC is a frontend, not the actual workhorse.
Regards,
Neovanglist
Neovanglist