Closed rickgaiser closed 4 years ago
@rickgaiser I've setup the toolchain, ps2sdk and the ports using the for-ps2dev branches. I have also built and installed the freetype2, zlib, libjpeg and libpng ports. However executing ./setup.sh
fails when it goes to build the examples with the following.
Welcome to the setup script for gsKit.
This script will attempt to automatically detect the presence of LIBPNG, LIBJPEG, LIBTIFF and ZLIB, and will set up all required environmental variables.
If your libraries are not stored in /usr/local/ps2dev/ps2sdk/ports, please specify the location of the libraries manually.
Performing pre-install cleanup.
Libraries:
-e LIBJPEG detected.
-e LIBPNG detected.
-e ZLIB detected.
-e LIBTIFF not detected.
Building gsKit.
/usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.3/../../../../ee/bin/ld: cannot open crt0.o: No such file or directory
collect2: ld returned 1 exit status
make[2]: *** [/home/astre/Documents/ps2/gsKit/ee/Rules.make:64: alpha.elf] Error 1
make[1]: *** [../Rules.make:21: all-alpha] Error 2
make: *** [Rules.make:21: all-examples] Error 2
Installing gsKit.
/usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.3/../../../../ee/bin/ld: cannot open crt0.o: No such file or directory
collect2: ld returned 1 exit status
make[2]: *** [/home/astre/Documents/ps2/gsKit/ee/Rules.make:64: alpha.elf] Error 1
make[1]: *** [../Rules.make:25: install-alpha] Error 2
make: *** [Rules.make:25: install-examples] Error 2
Performing post-install cleanup.
I can't seem to track down where it is trying to include crt0.o but even so it should be able to find it since it is now in the ee-gcc
lib folder.
Hi and thank you for testing. I've never used the setup.sh, but when I run it I don't get the error:
Welcome to the setup script for gsKit.
This script will attempt to automatically detect the presence of LIBPNG, LIBJPEG, LIBTIFF and ZLIB, and will set up all required environmental variables.
If your libraries are not stored in /home/rgaiser/dev/ps2max-newlib/ps2dev/ps2sdk/ports, please specify the location of the libraries manually.
Performing pre-install cleanup.
Libraries:
-e LIBJPEG detected.
-e LIBPNG detected.
-e ZLIB detected.
-e LIBTIFF detected.
Building gsKit.
It is not intended for other projects to include the
Makefile.global file used by gsKit.
Installing gsKit.
Performing post-install cleanup.
I've also tried without LIBTIFF, but still no error.
Can you try removing all the --silent
flags from setup.sh and run it again? That way we can see what linker options are used. Have you also setup your environment variables correctly? Is it possible they still point to your previous toolchain or source folder? These are something like:
export PS2DEV=/usr/local/ps2dev
export PS2SDK=$PS2DEV/ps2sdk
export GSKIT=$PS2DEV/gsKit
export PS2SDKSRC=/home/astre/Documents/ps2/ps2sdk
export GSKITSRC=/home/astre/Documents/ps2/gsKit
I have the following in~/.profile
export PS2DEV=/usr/local/ps2dev
export PS2SDK=$PS2DEV/ps2sdk
export GSKIT=$PS2DEV/gsKit
export PATH=$PATH:$PS2DEV/bin:$PS2SDK/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin:$PS2DEV/dvp/bin
Below is the output after removing --silent
I had completely removed the $PS2DEV folder prior to rebuilding the toolchain and libraries.
Ok, I did a complete rebuild:
Then in ps2toolchain:
Then in ps2sdk:
Then in ps2sdk-ports
Then in gsKit:
This works, but I've also found the problem to be in script nr.5 The one that builds ps2sdk is also the one that messes with crt0.o. I'll add a commit to fix this shortly.
Ok, I did a complete rebuild:
- clone all 4 repositories: ps2toolchain, ps2sdk, ps2sdk-ports and gsKit
- switch to for-ps2dev branch on all 4 repositories
- create environment variables to the new toolchain location
Then in ps2toolchain:
- ./toolchain.sh 1 2 3 4
- NOTE: we do NOT want ps2toochain to build the old ps2sdk
Then in ps2sdk:
- make clean all install
Then in ps2sdk-ports
- make all
Then in gsKit:
- ./setup.sh
This works, but I've also found the problem to be in script nr.5 The one that builds ps2sdk is also the one that messes with crt0.o. I'll add a commit to fix this shortly.
Ah ok thank you.
Edit: In case you see what I previously wrote just know I've been studying for too long :sweat_smile: I can barely remember my own name at the moment.
It should be fixed with https://github.com/ps2dev/ps2toolchain/pull/58/commits/e38225f919f297d9e2a0c854295b3105d9e17fae
If you can re-test that would be great.
It should be fixed with ps2dev/ps2toolchain@e38225f
If you can re-test that would be great.
Everything built without a problem now. I did notice warnings of implicit declarations of the file io functions in libjpeg though. I'm not sure if they were present previously or not.
libjpg.c: In function `jpgOpen':
libjpg.c:206: warning: implicit declaration of function `lseek'
libjpg.c:213: warning: implicit declaration of function `read'
libjpg.c:214: warning: implicit declaration of function `close'
libjpg.c: In function `jpgScreenshot':
libjpg.c:483: warning: implicit declaration of function `write'
libjpg.c: In function `print_text_marker':
libjpg.c:548: warning: implicit declaration of function `isprint'
These PR series move libc from ps2sdk to newlib:
1: File and directory functions (both fio and fileXio) are now handled by newlib, tranparently. With the following functions supported: -- close/open -- read/write -- lseek -- ioctl -- unlink (remove) -- link (rename) -- mkdir/rmdir -- stat -- opendir/closedir -- readdir -- rewinddir
Existing code must be modified to use these standard posix function names instead of calling fio* fileXio functions directly, becouse of an incompatibility between newlib and the ps2 file handing. For this reason existing code will provide an error when including ps2 headers that should not be used:
For some applications however, using the fio/fileXio functions directly may still be needed (for instance when mounting partitions). By defining 'NEWLIB_PORT_AWARE' before including these headers this is still possible. As far as I know the only incompatibility it with opening a file. The flags, like O_RDONLY, are incompatible and must be changed to FIO_O_RDONLY.
2: time function is implemented, returning the UTC time. Using the stat function the times from files can also be returned in UTC format.
3: nanosleep is implemented. It sleeps using SetAlarm. Then busy waits the last nanoseconds, resulting in both a lot of free cpu time, and a very accurate sleep time.
4: The linkfile has been moved to the binutils port, and crt0.s has been moved to newlib port.
5: The newlib port is upgraded from 1.10 to 1.14. This adds (amongs other things) wchar support, needed by some applications like uLE. Upgrading to newer versions resulted in a lot of compiler issues. Perhaps newlib can be upgraded to 3.x when the compiler gets updated.
The end result is that porting new applications to the ps2 will become a lot more easy. Or sometimes they will just run.
Special thanks to @fjtrujy, the creator of the PS2 RetroArch port, for making this possible.
This PR series consists of ps2toolchain, ps2sdk, ps2sdk-ports and gsKit to get a working newlib toolchain. This is the gsKit PR. It fixes 1 small bug, and the rest is for posix/newlib compatibility.