linking issue with PS2SDK

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

linking issue with PS2SDK

Post by Shazz »

Before going into details (if needed), is it a wellknown issue ?

Code: Select all

./uae-cpu/cpuemu5.o(.text+0x19020): In function `cctrue':
cpuemu.c: undefined reference to `_impure_ptr'
./uae-cpu/cpuemu5.o(.text+0x19024):cpuemu.c: undefined reference to `_impure_ptr'
./uae-cpu/cpuemu6.o(.text+0x28254): In function `cctrue':
cpuemu.c: undefined reference to `_impure_ptr'
./uae-cpu/cpuemu6.o(.text+0x28258):cpuemu.c: undefined reference to `_impure_ptr'
D:\cygwin\usr\local\ps2dev\ps2sdk/ee/lib/libc.a(fflush.o)(.text+0x5c): In function `fflush':
src/stdio.c: undefined reference to `mcFlush'
D:\cygwin\usr\local\ps2dev\ps2sdk/ee/lib/libc.a(fflush.o)(.text+0x6c):src/stdio.c: undefined reference to `mcSync'
D:\cygwin\usr\local\ps2dev\ps2sdk/ee/lib/libc.a(sscanf.o)(.text+0x30): In function `sscanf':
src/stdio.c: undefined reference to `vsscanf'
Especially the 3 refs to fflush, mcFlush, vsscanf, mcSync...

I'm using the toolchain updated with the shell script from 2 days ago and PS2SDK makefiles from Makefile.eeglobal_sample,v 1.6 2005/02/01 23:31:01 oobles Exp $
I tried changing the EE_LIBS += -lc -lsyscall -lkernel but nothing changes...

The '_impure_ptr' pb is more tricky for me as I really don't know what is it... I've got it when recompiling the 68K UAE core...


Thx...
- TiTAN Art Division -
http://www.titandemo.org
pixel
Posts: 791
Joined: Fri Jan 30, 2004 11:43 pm

Post by pixel »

_impure_ptr ==> this is from newlib. Please check back your -I options so that the includes falls into the ps2sdk's common/include and ee/include. And also, please check that you are not including a header that is defined into the newlib and not in the ps2sdk

mcFlush ==> add -lmc to link phase. it's needed by fflush.

vsscanf ==> we don't have any *scanf function familly in the sdk, sorry. If you deadly need it, just try to simplify/change your code so that it uses custom scanners, maybe using atoi for example. However, you're trying to compile uae (the Amiga emulator, right?). Just check if sscanf is really useful in the case you're having. In that latter case, I can provide a short sscanf replacement depending on the format used in your software. Otherwise, just add this .c code to the link phase:

Code: Select all

int vsscanf(void){return 0;}
Just bug me on IRC about it or PM me or whatever.
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

Thx pixels !

As I don't have newlib and using a fresh ps2sdk toolchain install I don't know where it can come from... I search I search...

mcFlush fixed, thx

for the *scanf call, here is the unique need in the FPP UAE core :

Code: Select all

STATIC_INLINE fptype to_pack (uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd3)
{
    fptype d;
    char *cp;
    char str[100];

    cp = str;
    if (wrd1 & 0x80000000)
	*cp++ = '-';
    *cp++ = (wrd1 & 0xf) + '0';
    *cp++ = '.';
    *cp++ = ((wrd2 >> 28) & 0xf) + '0';
    *cp++ = ((wrd2 >> 24) & 0xf) + '0';
    *cp++ = ((wrd2 >> 20) & 0xf) + '0';
    *cp++ = ((wrd2 >> 16) & 0xf) + '0';
    *cp++ = ((wrd2 >> 12) & 0xf) + '0';
    *cp++ = ((wrd2 >> 8) & 0xf) + '0';
    *cp++ = ((wrd2 >> 4) & 0xf) + '0';
    *cp++ = ((wrd2 >> 0) & 0xf) + '0';
    *cp++ = ((wrd3 >> 28) & 0xf) + '0';
    *cp++ = ((wrd3 >> 24) & 0xf) + '0';
    *cp++ = ((wrd3 >> 20) & 0xf) + '0';
    *cp++ = ((wrd3 >> 16) & 0xf) + '0';
    *cp++ = ((wrd3 >> 12) & 0xf) + '0';
    *cp++ = ((wrd3 >> 8) & 0xf) + '0';
    *cp++ = ((wrd3 >> 4) & 0xf) + '0';
    *cp++ = ((wrd3 >> 0) & 0xf) + '0';
    *cp++ = 'E';
    if (wrd1 & 0x40000000)
	*cp++ = '-';
    *cp++ = ((wrd1 >> 24) & 0xf) + '0';
    *cp++ = ((wrd1 >> 20) & 0xf) + '0';
    *cp++ = ((wrd1 >> 16) & 0xf) + '0';
    *cp = 0;
    sscanf (str, "%le", &d);
    return d;
}
Do you have an idea of what to use available to replace it ?

Thanks a lot for your help, those things are really tricky for me :D (and Evilo too eh eh)
- TiTAN Art Division -
http://www.titandemo.org
pixel
Posts: 791
Joined: Fri Jan 30, 2004 11:43 pm

Post by pixel »

Code: Select all

sscanf(str, "%le", &d)
would be equivalent to

Code: Select all

d = strtod(str, 0)
The _impure_ptr really comes from a .h files not in the ps2sdk's libc. So, in order to find what's wrong, I'd recommand using the -v flag when compiling with gcc. It'll display all the files it opens and read, alongside with large pieces of information. Reading this output might give you a hint about which .h file is included from not within ps2sdk. Of course, please report any result of that.
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

Ok I get rid of some other sscanf fns used to parsing config files... not an issue for the moment, I'll see later...

here is the log using the v flag :

Code: Select all

ee-gcc -v -DPART_5 -c  -I.  -Wno-unused cpuemu.c -o cpuemu5.o
Reading specs from /usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/specs
Configured with: ../configure --prefix=/usr/local/ps2dev/ee --target=ee --enable-languages=c,c++ --with-newlib --with-headers=/usr/local/ps2dev/ee/ee/include --enable-cxx-flags=-G0
Thread model: single
gcc version 3.2.2
 /usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/cc1.exe -lang-c -v -I. -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=2 -D__GXX_ABI_VERSION=102 -D__ELF__ -Dmips -D_mips -D__mips -D__mips__ -DR5900 -D_R5900 -D__R5900 -DR3000 -D_3000 -D__3000 -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__ -D__ELF__ -D__mips__ -D__mips__ -D__mips -D__mips__ -D__R5900__ -D_R5900 -D__R5900 -D__R3000__ -D__3000__ -D__3000 -D__MIPSEL__ -D_MIPSEL -D__MIPSEL -D__MIPSEL__ -D__mips -D__mips -D__R5900 -D__R3000 -D__3000 -D__MIPSEL -Acpu(mips) -Amachine(mips) -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C -D_MIPS_SZPTR=32 -D_MIPS_SZINT=32 -D__SIZE_TYPE__=unsigned int -D__SSIZE_TYPE__=int -D__PTRDIFF_TYPE__=int -D_MIPS_SZLONG=64 -D__mips_fpr=64 -D_MIPS_FPSET=32 -U__mips -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS3 -D__mips=3 -D__mips64 -D__mips_eabi -D__mips_single_float -D__LANGUAGE_C__ -DLANGUAGE_C -DPART_5 cpuemu.c -quiet -dumpbase cpuemu.c -Wno-unused -version -o /cygdrive/d/temp/ccPkHmTQ.s
GNU CPP version 3.2.2 (cpplib) [AL 1.1, MM 40] (MIPSel R5900 ELF)
GNU C version 3.2.2 (ee)
	compiled by GNU C version 3.3.3 (cygwin special).
#include "..." search starts here:
#include <...> search starts here&#58;
 .
 /usr/local/ps2dev/ee/include
 /usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/include
 /usr/local/ps2dev/ee/ee/sys-include
 /usr/local/ps2dev/ee/ee/include
End of search list.
 /usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/../../../../ee/bin/as.exe -v -mwarn-short-loop -march=r5900 -mips3 -mfp32 -mgp64 -mabi=eabi -msingle-float -o cpuemu5.o /cygdrive/d/temp/ccPkHmTQ.s
GNU assembler version 2.14 &#40;ee&#41; using BFD version 2.14 20030612
ee-gcc -v -DPART_6 -c  -I.  -Wno-unused cpuemu.c -o cpuemu6.o
Reading specs from /usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/specs
Configured with&#58; ../configure --prefix=/usr/local/ps2dev/ee --target=ee --enable-languages=c,c++ --with-newlib --with-headers=/usr/local/ps2dev/ee/ee/include --enable-cxx-flags=-G0
Thread model&#58; single
gcc version 3.2.2
 /usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/cc1.exe -lang-c -v -I. -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=2 -D__GXX_ABI_VERSION=102 -D__ELF__ -Dmips -D_mips -D__mips -D__mips__ -DR5900 -D_R5900 -D__R5900 -DR3000 -D_3000 -D__3000 -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__ -D__ELF__ -D__mips__ -D__mips__ -D__mips -D__mips__ -D__R5900__ -D_R5900 -D__R5900 -D__R3000__ -D__3000__ -D__3000 -D__MIPSEL__ -D_MIPSEL -D__MIPSEL -D__MIPSEL__ -D__mips -D__mips -D__R5900 -D__R3000 -D__3000 -D__MIPSEL -Acpu&#40;mips&#41; -Amachine&#40;mips&#41; -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C -D_MIPS_SZPTR=32 -D_MIPS_SZINT=32 -D__SIZE_TYPE__=unsigned int -D__SSIZE_TYPE__=int -D__PTRDIFF_TYPE__=int -D_MIPS_SZLONG=64 -D__mips_fpr=64 -D_MIPS_FPSET=32 -U__mips -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS3 -D__mips=3 -D__mips64 -D__mips_eabi -D__mips_single_float -D__LANGUAGE_C__ -DLANGUAGE_C -DPART_6 cpuemu.c -quiet -dumpbase cpuemu.c -Wno-unused -version -o /cygdrive/d/temp/ccTNesVC.s
GNU CPP version 3.2.2 &#40;cpplib&#41; &#91;AL 1.1, MM 40&#93; &#40;MIPSel R5900 ELF&#41;
GNU C version 3.2.2 &#40;ee&#41;
	compiled by GNU C version 3.3.3 &#40;cygwin special&#41;.
#include "..." search starts here&#58;
#include <...> search starts here&#58;
 .
 /usr/local/ps2dev/ee/include
 /usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/include
 /usr/local/ps2dev/ee/ee/sys-include
 /usr/local/ps2dev/ee/ee/include
End of search list.
 /usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/../../../../ee/bin/as.exe -v -mwarn-short-loop -march=r5900 -mips3 -mfp32 -mgp64 -mabi=eabi -msingle-float -o cpuemu6.o /cygdrive/d/temp/ccTNesVC.s
GNU assembler version 2.14 &#40;ee&#41; using BFD version 2.14 20030612
ee-gcc -DPART_7 -c  -I.  -Wno-unused cpuemu.c -o cpuemu7.o
ee-gcc -DPART_8 -c  -I.  -Wno-unused cpuemu.c -o cpuemu8.o
make&#91;2&#93;&#58; Leaving directory `/cygdrive/d/Dev/DevC/projects/PS2/hatari/src/uae-cpu'
make -C uae-cpu/ all
make&#91;2&#93;&#58; Entering directory `/cygdrive/d/Dev/DevC/projects/PS2/hatari/src/uae-cpu'
make&#91;2&#93;&#58; Nothing to be done for `all'.
make&#91;2&#93;&#58; Leaving directory `/cygdrive/d/Dev/DevC/projects/PS2/hatari/src/uae-cpu'
make -C uae-cpu/ cpuemu.c
make&#91;2&#93;&#58; Entering directory `/cygdrive/d/Dev/DevC/projects/PS2/hatari/src/uae-cpu'
make&#91;2&#93;&#58; `cpuemu.c' is up to date.
make&#91;2&#93;&#58; Leaving directory `/cygdrive/d/Dev/DevC/projects/PS2/hatari/src/uae-cpu'
ee-gcc -mno-crt0 -TD&#58;\cygwin\usr\local\ps2dev\ps2sdk/ee/startup/linkfile -LD&#58;\cygwin\usr\local\ps2dev\ps2sdk/ee/lib  \
	-o hatari.elf D&#58;\cygwin\usr\local\ps2dev\ps2sdk/ee/startup/crt0.o audio.o bios.o blitter.o cart.o cfgopts.o configuration.o createBlankImage.o debug.o debugui.o dialog.o errlog.o fdc.o file.o floppy.o gemdos.o hdc.o ikbd.o int.o intercept.o joy.o keymap.o m68000.o main.o midi.o memAlloc.o memorySnapShot.o mfp.o misc.o msa.o psg.o printer.o reset.o rtc.o st.o stMemory.o screen.o screenConvert.o screenSnapShot.o shortcut.o sound.o spec512.o tos.o vdi.o video.o wavFormat.o xbios.o ymFormat.o ./gui-sdl/dlgAbout.o ./gui-sdl/dlgAlert.o ./gui-sdl/dlgDevice.o ./gui-sdl/dlgDisc.o ./gui-sdl/dlgJoystick.o ./gui-sdl/dlgKeyboard.o ./gui-sdl/dlgMain.o ./gui-sdl/dlgMemory.o ./gui-sdl/dlgNewDisc.o ./gui-sdl/dlgRom.o ./gui-sdl/dlgScreen.o ./gui-sdl/dlgSound.o ./gui-sdl/dlgSystem.o ./gui-sdl/dlgFileSelect.o ./gui-sdl/sdlgui.o ./uae-cpu/hatari-glue.o ./uae-cpu/memory.o ./uae-cpu/newcpu.o ./uae-cpu/readcpu.o ./uae-cpu/fpp.o ./uae-cpu/cpustbl.o ./uae-cpu/cpudefs.o ./uae-cpu/cpuemu1.o ./uae-cpu/cpuemu2.o ./uae-cpu/cpuemu3.o ./uae-cpu/cpuemu4.o ./uae-cpu/cpuemu5.o ./uae-cpu/cpuemu6.o ./uae-cpu/cpuemu7.o ./uae-cpu/cpuemu8.o -lc -LD&#58;\Dev\DevC\projects\PS2\SDL/lib -LD&#58;\cygwin\usr\local\ps2dev\lib\gskit/lib -lsdl -lgskit -ldmakit -lpad -lkbd -lm -lmc -lc -lkernel -lc -lsyscall
./uae-cpu/cpuemu5.o&#40;.text+0x19020&#41;&#58; In function `cctrue'&#58;
cpuemu.c&#58; undefined reference to `_impure_ptr'
./uae-cpu/cpuemu5.o&#40;.text+0x19024&#41;&#58;cpuemu.c&#58; undefined reference to `_impure_ptr'
./uae-cpu/cpuemu6.o&#40;.text+0x28254&#41;&#58; In function `cctrue'&#58;
cpuemu.c&#58; undefined reference to `_impure_ptr'
./uae-cpu/cpuemu6.o&#40;.text+0x28258&#41;&#58;cpuemu.c&#58; undefined reference to `_impure_ptr'
collect2&#58; ld returned 1 exit status
Have fun.... ;-)
- TiTAN Art Division -
http://www.titandemo.org
pixel
Posts: 791
Joined: Fri Jan 30, 2004 11:43 pm

Post by pixel »

Just as I said a few posts before, you are not having -I $PS2SDK/ee/include -I $PS2SDK/common/include in your compilation lines.
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

Thanks Pixel, yep some UAE files were compiled a little... brutly..

So now it compiles & links...

And it crashes before entering the main... :)
Let's have some fun...
- TiTAN Art Division -
http://www.titandemo.org
ole
Posts: 92
Joined: Sat May 08, 2004 11:14 pm
Location: Czech Republic

Post by ole »

can't wait to see UAE working on the ps2.... :) What about the Atari ST emu you mentioned earlier? Any progress?
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

Arf Ole... bad news for you...

Remember I'm a true olsk00l Atarist... So somebody will have to threat me to have UAE ported to the PS2 :D

In fact with 7not6 we have a working version of Castaway but make it evolve is a real pain due to nasty code...
In the same time, Hatari exists, still supported, nice code, better emulation and... .SDL based...

So I have decided to give my efforts to Hatari which is for me a better choice...

So what about UAE ????
Hatari uses the UAE 68K core engine :D (shame on me)

But who knows maybe UAE could be next on the list :D (ask evilo the old amiga freak :D)
- TiTAN Art Division -
http://www.titandemo.org
EugeneE3RD
Posts: 51
Joined: Sat Apr 03, 2004 10:22 am

Post by EugeneE3RD »

ole wrote:can't wait to see UAE working on the ps2.... :) What about the Atari ST emu you mentioned earlier? Any progress?
So would I. UAE on PS2 would be great since the Amiga has so many freeware programs & in fact, a good amount of commerical companies are allowing downloads of their old Amiga progs.
You no mess with Lo Wang- Lo Wang (Shadow Warrior).
EugeneE3RD
Posts: 51
Joined: Sat Apr 03, 2004 10:22 am

Post by EugeneE3RD »

I like to mention a warning about UAE. If you do release UAE for PS2, it must not contain the Amiga Kickstart roms since Amiga INC doesn't allow the Kickstart roms to be downloaded from the NET/ & the Kickstart roms can't be included/packaged with the Amiga Emu.

People who want to use an Amiga Emu have to purchase Amiga Forever which contains the Kickstart roms & Amiga Forever is licensed by Amiga INC.
You no mess with Lo Wang- Lo Wang (Shadow Warrior).
OptiRoc
Posts: 22
Joined: Mon Feb 02, 2004 12:26 am
Location: Sweden

Post by OptiRoc »

UAE requires a fairly hi spec PC to run decently. It would be interesting to see how it performs on PS2. At least you have all the videomodes (and a proper TV hook-up) needed to achieve perfect image quality.
ole
Posts: 92
Joined: Sat May 08, 2004 11:14 pm
Location: Czech Republic

Post by ole »

Agree. Not only the proccessor speed is required but the memory amount is critical. I have compiled (just curious wether it's gonna work :-) uae under ps2dev environment (only 68000 core, dummy sound and graphics routines) and the elf launched with TLB Store exception: BadVaddr 02000000 - that is IMHO not enough memory (it didn't even start in main() when it terminated)....
Edit:
finally it works, so if anyone woud like to test it here is the preliminary version.
http://www.volny.cz./molej/ps2/uae.htm
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

Eh eh ole you're faster than me :D

My Hatari port based on UAE core is not working yey and it is "just" a SDL portage...

You're incredible :D
- TiTAN Art Division -
http://www.titandemo.org
Post Reply