forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

suggestions to psptoolchain

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
aeolusc



Joined: 14 Oct 2006
Posts: 18

PostPosted: Sun Nov 04, 2007 2:01 am    Post subject: suggestions to psptoolchain Reply with quote

1. both gcc and psp-gcc read env CPATH/C_INCLUDE_PATH/CPLUS_INCLUDE_PATH/LIBRARY_PATH as header/lib search path, so that if we define them, gcc or psp-gcc might include/link files from wrong place.
I think it's better to change the env name in psp-gcc, just like add prefix "PSP_" or such on.

2. full gcc package includes java/fortran/testsuites and some other things with no use, we could have only gcc-core and gcc-g++ downloaded to save diskspace and decompress time while building.
Back to top
View user's profile Send private message
aeolusc



Joined: 14 Oct 2006
Posts: 18

PostPosted: Sun Nov 04, 2007 5:09 am    Post subject: Reply with quote

Here's my patch, for gcc 4.2.2, tested to work fine.
http://www.aeolusc.com/down/gcc-4.2.2-PSP.patch.bz2
1. Get env PSP_CPATH/PSP_C_INCLUDE_PATH/PSP_CPLUS_INCLUDE_PATH/PSP_LIBRARY_PATH for headers/libs search
2. Update gcc/g++ to 4.2.2
Back to top
View user's profile Send private message
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Sun Nov 04, 2007 3:13 pm    Post subject: Reply with quote

Any objections from folk before I merge this patch?
Back to top
View user's profile Send private message Visit poster's website
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun Nov 04, 2007 3:29 pm    Post subject: Reply with quote

Has it been tested on existing libs and projects?
Back to top
View user's profile Send private message AIM Address
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Sun Nov 04, 2007 3:48 pm    Post subject: Reply with quote

I don't think CPATH/etc should be changed. I've never seen a cross compiler do that before, and it seems that it will only add to incompatibilities and confusion when you try to cross-compile something. For example, build systems designed to handle cross compilers but expect things like CPATH to still work as documented will be broken.

As far as gcc 4.2.2, what has changed? Are there any non-x86 features that even matter for us?
Back to top
View user's profile Send private message
aeolusc



Joined: 14 Oct 2006
Posts: 18

PostPosted: Sun Nov 04, 2007 5:14 pm    Post subject: Reply with quote

no, i think leave them unchanged would cause incompatibilities and confusion.
example:
Compiled and installed pspsdk to /usr/local/pspdev(yes, that's default path).
Move the pspdev to another place without compile it again(e.g. move to /usr/pspdev), add /usr/pspdev/bin to PATH, works fine for c files.
But if compile cpp files with libstdc++ headers, you will get error "headers not found", so we should set up env CPLUS_INCLUDE_PATH to /usr/pspdev/psp/include.
then confusion comes around, compile with normal g++, it also search /usr/pspdev/include first, whatta hell...
Back to top
View user's profile Send private message
aeolusc



Joined: 14 Oct 2006
Posts: 18

PostPosted: Sun Nov 04, 2007 5:18 pm    Post subject: Reply with quote

J.F. wrote:
Has it been tested on existing libs and projects?


tested to build pspsdk, some 3rd part libs, works fine.

to jimparis: elf's generated by psp-gcc 4.2.2 have diffenrent size from ones by psp-gcc 4.1.0, so obviously some changes are made to mips compiling/linking
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Sun Nov 04, 2007 6:45 pm    Post subject: Reply with quote

aeolusc wrote:
no, i think leave them unchanged would cause incompatibilities and confusion.

They can both cause confusion. Cross compiling is tricky. I think sticking with the way every other gcc-based cross compiler has ever worked is a far more reasonable solution.
Quote:

example:
Compiled and installed pspsdk to /usr/local/pspdev(yes, that's default path).
Move the pspdev to another place without compile it again(e.g. move to /usr/pspdev), add /usr/pspdev/bin to PATH, works fine for c files.
But if compile cpp files with libstdc++ headers, you will get error "headers not found", so we should set up env CPLUS_INCLUDE_PATH to /usr/pspdev/psp/include.
This is not a practical example. When you move a GCC installation away from its prefix, you'll run into a lot more problems than just the CPLUS_INCLUDE_PATH. For example things like "psp-gcc -print-libgcc-file-name" hold a hardcoded path. You might get away with the "-B" option or setting GCC_EXEC_PREFIX, but rebuilding with the proper path is really the right way to move it.
Quote:
then confusion comes around, compile with normal g++, it also search /usr/pspdev/include first, whatta hell...
Yes, and if you set CFLAGS in your environment, then they'll apply to both compilers. That's what happens when cross compiling things -- you need to set up your environment properly for which system you're building for. Or are you also proposing that we also rename CFLAGS->PSP_CFLAGS, LDFLAGS->PSP_LDFLAGS, etc? By your argument we should, but it should hopefully be clear how wrong that would be.
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Sun Nov 04, 2007 6:53 pm    Post subject: Reply with quote

aeolusc wrote:
tested to build pspsdk, some 3rd part libs, works fine.
Builds fine, or works fine on the PSP too? Please, test some non-trivial programs, there are a lot of details that go into how binary loading works on the PSP under various firmwares and loaders and it would be good to verify that various assumptions are still valid.
Quote:
to jimparis: elf's generated by psp-gcc 4.2.2 have diffenrent size from ones by psp-gcc 4.1.0, so obviously some changes are made to mips compiling/linking
Bigger? How much?

I think upgrading to gcc 4.2 is a good idea, but a lot of people rely on it so it's worth taking some extra time to verify things. For the gcc-4.0.2 to gcc-4.1.0 upgrade, we left both in the toolchain for over a year before switching to 4.1.0 as a default. (not suggesting we wait that long, just as a reference)
Back to top
View user's profile Send private message
aeolusc



Joined: 14 Oct 2006
Posts: 18

PostPosted: Sun Nov 04, 2007 9:22 pm    Post subject: Reply with quote

Quote:
Bigger? How much?

a bit smaller, :P

Quote:
Builds fine, or works fine on the PSP too?


most programs work fine on PSP(c/c++,elf/prx).
only got a compiler internal error while building SDL_mixer/timidity, dunno if it is the problem imported by 4.2.2
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group