Author Topic: Cross compiling issues  (Read 2492 times)

Bebe

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • http://
Cross compiling issues
« on: March 16, 2004, 01:40:48 pm »
Hi all,
  I\'m having an issue with cross compiling for the Z and I\'m beating my head against the wall trying to figure it out.  When I compile a simple hello world program in C++ using stl, I get a binary that is over 3MB, even when compiling in release mode with optimizations turned on.  When I remove all references to stl and compiled the program again, and binary still turns out to be 3MB.  Any thoughts??

Bebe
C860 pdaXrom
PNY 512 SD | Lexar 48 CF | Lexar 256 CF
Linksys WCF12 | Targus IR Keyboard
SuSE 9.1 x86_64 Kernel 2.6.7 | FreeBSD 5.2.1 | WinXp

rrusaw

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • http://
Cross compiling issues
« Reply #1 on: March 16, 2004, 02:16:59 pm »
Check to make sure you are performing dynamic linking.

Bebe

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • http://
Cross compiling issues
« Reply #2 on: March 16, 2004, 02:46:13 pm »
Quote
Check to make sure you are performing dynamic linking.

Thanks for the reply.
I compiled using \"-Wl,-Bdynamic\", but the binary is still 3MB.

Bebe

PS, I\'m using zgcc 3.3.1
C860 pdaXrom
PNY 512 SD | Lexar 48 CF | Lexar 256 CF
Linksys WCF12 | Targus IR Keyboard
SuSE 9.1 x86_64 Kernel 2.6.7 | FreeBSD 5.2.1 | WinXp

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Cross compiling issues
« Reply #3 on: March 16, 2004, 05:11:58 pm »
Have you stripped it? (you say release mode, but I don\'t know whether that has actually stripped it, though I\'d assume it has from the name).

Si
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

Bebe

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • http://
Cross compiling issues
« Reply #4 on: March 17, 2004, 10:26:54 am »
Quote
Have you stripped it? (you say release mode, but I don\'t know whether that has actually stripped it, though I\'d assume it has from the name).

Si

Thanks for replying lardman,

At first, I compiled my program like this:
Code: [Select]
g++ -Wall -g -o hello hello.cpp

Then like so,
Code: [Select]
g++ -Wall -02 -o hello hello.cpp

Then like this,
Code: [Select]
g++ -o hello hello.cpp

Finally, I did this

Code: [Select]
g++ -Wl,-Bdynamic -o hello hello.cpp

And I did this to both code that had stl and code that had non-stl references. All of this resulted in a 3MB file.

The interesting this is that when I used zgcc 3.3.2 to compile, I got a file that was much smaller. My guess is that some of the libs that came with the version of zgcc 3.3.1 were in debug mode.  Oh well, 3.3.2 it is
C860 pdaXrom
PNY 512 SD | Lexar 48 CF | Lexar 256 CF
Linksys WCF12 | Targus IR Keyboard
SuSE 9.1 x86_64 Kernel 2.6.7 | FreeBSD 5.2.1 | WinXp