Author Topic: Building A Gcc 4.5 Cross-compiler For The Sharp Rom?  (Read 7636 times)

cybersphinx

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
    • http://
Building A Gcc 4.5 Cross-compiler For The Sharp Rom?
« on: July 03, 2010, 08:05:31 am »
Since gcc 2.95 is getting a bit old, and 4.5 has interesting new things like whole program link time optimization, I've though about building a gcc 4.5 cross-compiler to complement g++ 2.95 (which can't be replaced because of the ABI). The problem is, there doesn't seem to be much documentation about how to actually build a cross-compiler for the Zaurus (maybe there was more five years ago). Has anyone every tried this (probably not with 4.5, but maybe some older version)? Are there any docs on how to build any cross-compiler for the Sharp ROM, or have people always just used the premade packages?

koan

  • Sr. Member
  • ****
  • Posts: 370
    • View Profile
    • http://www.lyndonhill.com
Building A Gcc 4.5 Cross-compiler For The Sharp Rom?
« Reply #1 on: July 06, 2010, 04:17:28 pm »
I think the majority of people use the tool chains that are already available.

I am using the quantumstep chain (http://www.lucid-cake.net/osx_arm/index_en.html) because I am using a Mac.  IIRC Andreas said that he had followed the instructions of http://frank.harvard.edu/~coldwell/toolchain/

There is also this: http://www.ailis.de/~k/archives/19-ARM-cro...ling-howto.html

I think the main reason why people don't try to build a more up to date gcc is to do with setting up a two libc system. Another reason is that they are not interested in such old kernels when you can go for another distro, e.g. Debian or zubuntu and immediately switch to a 2.6 kernel.
Zocalo Feed Reader : Thai on Zaurus : Dictionaries for zbedic : Sharp ROM package feed
HELUX Handheld Embedded Linux Blog
SL-C3200 Multiboot : SL-C750  Sharp ROM

cybersphinx

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
    • http://
Building A Gcc 4.5 Cross-compiler For The Sharp Rom?
« Reply #2 on: July 06, 2010, 07:07:43 pm »
Quote from: koan
I think the majority of people use the tool chains that are already available.
Sure, that's easier. I vaguely remember people playing with gcc 3.x for the Sharp ROM years ago though, but I couldn't find any docs about this now.

Quote
I think the main reason why people don't try to build a more up to date gcc is to do with setting up a two libc system.
Hm, does that mean if I get gcc 4.5 to work, I can't link g++ 2.95 and gcc 4.5 object files (either directly or as dynamic libraries)? That was really the main point of this, if I can use gcc 4.5 only for pure C programs (or maybe C++ programs that don't depend on anything already on the Sharp ROM), it's not worth the effort.

Quote
Another reason is that they are not interested in such old kernels when you can go for another distro, e.g. Debian or zubuntu and immediately switch to a 2.6 kernel.
Yeah, but my main use for the Zaurus is still as a dictionary with Kanji handwriting recognition, so I'm stuck with the Sharp ROM.

koan

  • Sr. Member
  • ****
  • Posts: 370
    • View Profile
    • http://www.lyndonhill.com
Building A Gcc 4.5 Cross-compiler For The Sharp Rom?
« Reply #3 on: July 07, 2010, 03:38:43 am »
Quote from: cybersphinx
Hm, does that mean if I get gcc 4.5 to work, I can't link g++ 2.95 and gcc 4.5 object files (either directly or as dynamic libraries)?

I'm no expert but you can't mix files that use a different ABI, you need a libc for each ABI.

[!--quoteo(post=0:date=:name=cybersphinx)--][div class=\'quotetop\']QUOTE(cybersphinx)[/div][div class=\'quotemain\'][!--quotec--]Yeah, but my main use for the Zaurus is still as a dictionary with Kanji handwriting recognition, so I'm stuck with the Sharp ROM.[/quote]

You can run zbedic on zubuntu and use scim with the tomoe module http://scim-imengine.sourceforge.jp/hiki.cgi?SCIMTomoe

The engine used in Kanji Nirvana was a simple port from somewhere else, so you could even take that to write your own input method.
Zocalo Feed Reader : Thai on Zaurus : Dictionaries for zbedic : Sharp ROM package feed
HELUX Handheld Embedded Linux Blog
SL-C3200 Multiboot : SL-C750  Sharp ROM

cybersphinx

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
    • http://
Building A Gcc 4.5 Cross-compiler For The Sharp Rom?
« Reply #4 on: July 07, 2010, 01:50:18 pm »
Quote from: koan
I'm no expert but you can't mix files that use a different ABI, you need a libc for each ABI.
On a Debian etch system (the last one with gcc-2.95), I can link gcc 4.1 object files into g++ 2.95 C++ programs, so basically it should work. The question is, does that work for the Zaurus as well, and if yes, how do I get a compiler for it?

Quote
You can run zbedic on zubuntu and use scim with the tomoe module http://scim-imengine.sourceforge.jp/hiki.cgi?SCIMTomoe

The engine used in Kanji Nirvana was a simple port from somewhere else, so you could even take that to write your own input method.
Last time I looked into alternatives (unfortunately, I only have one Zaurus that needs to work, so I'm not very inclined to experiment with reflashing it), those all were pretty basic, requiring kanji to be input one by one, with each stroke separately in the right order. While the Sharp ROM gives me a screen-wide area where I can write whole words, and as long as the stroke order is mostly correct, it recognizes almost everything.

koan

  • Sr. Member
  • ****
  • Posts: 370
    • View Profile
    • http://www.lyndonhill.com
Building A Gcc 4.5 Cross-compiler For The Sharp Rom?
« Reply #5 on: July 08, 2010, 05:52:43 am »
Are you really sure you linked gcc 4.1 object files to 2.95 programs ? GCC changed the ABI around ~3.0. Maybe if you used a pure C interface and rentrant code, but C++ ??? I'm very sceptical.

Quote from: cybersphinx
While the Sharp ROM gives me a screen-wide area where I can write whole words, and as long as the stroke order is mostly correct, it recognizes almost everything.

Is that a Sharp specific IM or is it available through Opie ?
Zocalo Feed Reader : Thai on Zaurus : Dictionaries for zbedic : Sharp ROM package feed
HELUX Handheld Embedded Linux Blog
SL-C3200 Multiboot : SL-C750  Sharp ROM

cybersphinx

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
    • http://
Building A Gcc 4.5 Cross-compiler For The Sharp Rom?
« Reply #6 on: July 08, 2010, 11:25:29 am »
Quote from: koan
Are you really sure you linked gcc 4.1 object files to 2.95 programs ? GCC changed the ABI around ~3.0.
The C++ ABI, yes. But the C ABI has been the same for ages, afaik.

Quote
Maybe if you used a pure C interface and rentrant code, but C++ ??? I'm very sceptical.
Well, I tried something like
Code: [Select]
file1.c:
int test(int i) {
        return i * i;
}
Code: [Select]
file2.cpp:
extern "C" {
  int test(int);
}

void main(void) {
        cout << " x " << test(3) << " y " << endl;
}
Code: [Select]
gcc-4.1 -c file1.c
g++-2.95 -c file2.cpp
g++-2.95 -o test file1.o file2.o
which works as expected.

Quote
Is that a Sharp specific IM or is it available through Opie ?
It's one of the Sharp ROM's default Japanese input methods, only available in binary form. It might work on OPIE if that's compiled with g++ 2.95 (for the old ABI), but afaik all OPIE systems use newer toolchains.

koan

  • Sr. Member
  • ****
  • Posts: 370
    • View Profile
    • http://www.lyndonhill.com
Building A Gcc 4.5 Cross-compiler For The Sharp Rom?
« Reply #7 on: July 08, 2010, 04:38:03 pm »
Quote from: cybersphinx
which works as expected.

I'm sorry to be a sceptic still but how do you gain the benefit of link time optimisation if you are linking with the old 2.95 ?
Zocalo Feed Reader : Thai on Zaurus : Dictionaries for zbedic : Sharp ROM package feed
HELUX Handheld Embedded Linux Blog
SL-C3200 Multiboot : SL-C750  Sharp ROM

cybersphinx

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
    • http://
Building A Gcc 4.5 Cross-compiler For The Sharp Rom?
« Reply #8 on: July 10, 2010, 12:07:00 pm »
Quote from: koan
I'm sorry to be a sceptic still but how do you gain the benefit of link time optimisation if you are linking with the old 2.95 ?
Heh, good question actually. From what I read, it works for dynamic libraries. I thought to do the same for static libraries, but that seems not possible. Anyway, that's not the only thing I hope gcc 4.5 is better with, it also should have a generally better optimizer, and support for the Xscale architecture.

koan

  • Sr. Member
  • ****
  • Posts: 370
    • View Profile
    • http://www.lyndonhill.com
Building A Gcc 4.5 Cross-compiler For The Sharp Rom?
« Reply #9 on: August 21, 2010, 04:20:26 pm »
It looks like someone has already done this with gcc 3.4... see http://prudentialscatterbrain.hp.infoseek.co.jp/

Binaries compiled with his gcc may need a static libgcc and libstdc++ which he supplies in ipks.

(He says that the files in the first table are compiled with his gcc 3.4 but don't need the additional libraries, files in the second table do).

HTH
Zocalo Feed Reader : Thai on Zaurus : Dictionaries for zbedic : Sharp ROM package feed
HELUX Handheld Embedded Linux Blog
SL-C3200 Multiboot : SL-C750  Sharp ROM