Nathan Hüsken | 25 Jan 14:58 2013
Picon

Size of crosscompiled exectuable

Hey,

A simple hello world application has 1Mb in by 64 bit ubunut machine.
When I stript it, is has about 750kb.

When I build a cross compiler for android (arm), the executable has a
asize of about 10MB, stripped about 5MB.

That is huge, five times the size on my linux sysem.
Why is this?
Can I do something about it?

Thanks!
Nathan
Simon Marlow | 25 Jan 16:36 2013
Picon

Re: Size of crosscompiled exectuable

On 25/01/13 13:58, Nathan Hüsken wrote:
> A simple hello world application has 1Mb in by 64 bit ubunut machine.
> When I stript it, is has about 750kb.

GHC statically links all its libraries by default.  If you want a 
dynamically linked executable, use -dynamic (ensure you have the dynamic 
libraries built and/or installed though).

> When I build a cross compiler for android (arm), the executable has a
> asize of about 10MB, stripped about 5MB.
>
> That is huge, five times the size on my linux sysem.

Not sure what you mean by "five times the size on my linux system". 
What is 5 times larger than what?

Static linking is useful when cross compiling, because it means you can 
just copy the binary over to the target system and run it.

Cheers,
	Simon
Stephen Paul Weber | 25 Jan 16:51 2013
Picon

Re: Size of crosscompiled exectuable

Somebody claiming to be Simon Marlow wrote:
>On 25/01/13 13:58, Nathan Hüsken wrote:
>>A simple hello world application has 1Mb in by 64 bit ubunut machine.
>>When I stript it, is has about 750kb.
>>When I build a cross compiler for android (arm), the executable has a
>>asize of about 10MB, stripped about 5MB.
>>
>>That is huge, five times the size on my linux sysem.
>
>Not sure what you mean by "five times the size on my linux system". 
>What is 5 times larger than what?

He's saying that the size of the android executable (made by his cross 
compiler) is five time the sive of the equivalent Ubuntu executable (made 
by, I assume, his system's GHC).

The problem is not the size, but the size ratio.

--

-- 
Stephen Paul Weber,  <at> singpolyma
See <http://singpolyma.net> for how I prefer to be contacted
edition right joseph
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Simon Marlow | 25 Jan 17:35 2013
Picon

Re: Size of crosscompiled exectuable

On 25/01/13 15:51, Stephen Paul Weber wrote:
> Somebody claiming to be Simon Marlow wrote:
>> On 25/01/13 13:58, Nathan Hüsken wrote:
>>> A simple hello world application has 1Mb in by 64 bit ubunut machine.
>>> When I stript it, is has about 750kb.
>>> When I build a cross compiler for android (arm), the executable has a
>>> asize of about 10MB, stripped about 5MB.
>>>
>>> That is huge, five times the size on my linux sysem.
>>
>> Not sure what you mean by "five times the size on my linux system".
>> What is 5 times larger than what?
>
> He's saying that the size of the android executable (made by his cross
> compiler) is five time the sive of the equivalent Ubuntu executable
> (made by, I assume, his system's GHC).
>
> The problem is not the size, but the size ratio.

Ah, I see.  Yes, my executables are a similar size.  I'm not sure why, 
I'll try to look into it.

Cheers,
	Simon

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
(Continue reading)

Simon Marlow | 25 Jan 17:45 2013
Picon

Re: Size of crosscompiled exectuable

On 25/01/13 16:35, Simon Marlow wrote:
> On 25/01/13 15:51, Stephen Paul Weber wrote:
>> Somebody claiming to be Simon Marlow wrote:
>>> On 25/01/13 13:58, Nathan Hüsken wrote:
>>>> A simple hello world application has 1Mb in by 64 bit ubunut machine.
>>>> When I stript it, is has about 750kb.
>>>> When I build a cross compiler for android (arm), the executable has a
>>>> asize of about 10MB, stripped about 5MB.
>>>>
>>>> That is huge, five times the size on my linux sysem.
>>>
>>> Not sure what you mean by "five times the size on my linux system".
>>> What is 5 times larger than what?
>>
>> He's saying that the size of the android executable (made by his cross
>> compiler) is five time the sive of the equivalent Ubuntu executable
>> (made by, I assume, his system's GHC).
>>
>> The problem is not the size, but the size ratio.
>
> Ah, I see.  Yes, my executables are a similar size.  I'm not sure why,
> I'll try to look into it.

It's just the lack of SPLIT_OBJS.  Also, unregisterised accounts for a 
factor of 1.5 or so.

Incidentally, I now have a registerised cross-compiler for Raspberry Pi 
compiling a working hello world :)  (LLVM 3.0, GHC HEAD)

GhcStage2HcOpts    = -O0 -fllvm -pgmlc llc-3.0 -pgmlo opt-3.0 -optlc 
(Continue reading)

Nathan Hüsken | 26 Jan 09:24 2013
Picon

Re: Size of crosscompiled exectuable

On 01/25/2013 05:45 PM, Simon Marlow wrote:
> On 25/01/13 16:35, Simon Marlow wrote:
>> On 25/01/13 15:51, Stephen Paul Weber wrote:
>>> Somebody claiming to be Simon Marlow wrote:
>>>> On 25/01/13 13:58, Nathan Hüsken wrote:
>>>>> A simple hello world application has 1Mb in by 64 bit ubunut machine.
>>>>> When I stript it, is has about 750kb.
>>>>> When I build a cross compiler for android (arm), the executable has a
>>>>> asize of about 10MB, stripped about 5MB.
>>>>>
>>>>> That is huge, five times the size on my linux sysem.
>>>>
>>>> Not sure what you mean by "five times the size on my linux system".
>>>> What is 5 times larger than what?
>>>
>>> He's saying that the size of the android executable (made by his cross
>>> compiler) is five time the sive of the equivalent Ubuntu executable
>>> (made by, I assume, his system's GHC).

Yes, exactly. Sorry for my bad phrasing.

>>> The problem is not the size, but the size ratio.
>>
>> Ah, I see.  Yes, my executables are a similar size.  I'm not sure why,
>> I'll try to look into it.
> 
> It's just the lack of SPLIT_OBJS.  Also, unregisterised accounts for a
> factor of 1.5 or so.

What exactly does SPLIT_OBJS do? Is there a chance to get it working for
(Continue reading)

Nathan Hüsken | 26 Jan 11:07 2013
Picon

Re: Size of crosscompiled exectuable

On 01/26/2013 09:24 AM, Nathan Hüsken wrote:
> On 01/25/2013 05:45 PM, Simon Marlow wrote:
>> On 25/01/13 16:35, Simon Marlow wrote:
>>> On 25/01/13 15:51, Stephen Paul Weber wrote:
>>>> Somebody claiming to be Simon Marlow wrote:
>>>>> On 25/01/13 13:58, Nathan Hüsken wrote:
>>>>>> A simple hello world application has 1Mb in by 64 bit ubunut machine.
>>>>>> When I stript it, is has about 750kb.
>>>>>> When I build a cross compiler for android (arm), the executable has a
>>>>>> asize of about 10MB, stripped about 5MB.
>>>>>>
>>>>>> That is huge, five times the size on my linux sysem.
>>>>>
>>>>> Not sure what you mean by "five times the size on my linux system".
>>>>> What is 5 times larger than what?
>>>>
>>>> He's saying that the size of the android executable (made by his cross
>>>> compiler) is five time the sive of the equivalent Ubuntu executable
>>>> (made by, I assume, his system's GHC).
> 
> Yes, exactly. Sorry for my bad phrasing.
> 
>>>> The problem is not the size, but the size ratio.
>>>
>>> Ah, I see.  Yes, my executables are a similar size.  I'm not sure why,
>>> I'll try to look into it.
>>
>> It's just the lack of SPLIT_OBJS.  Also, unregisterised accounts for a
>> factor of 1.5 or so.
> 
(Continue reading)

David Terei | 26 Jan 11:18 2013
Picon

Re: Size of crosscompiled exectuable

To pass to opt use '-optlo', e.g.,

$ ghc -fllvm -optlo-adce ...

Its documented in the GHC userguide.

Cheers,
David

On 26 January 2013 02:07, Nathan Hüsken <nathan.huesken <at> posteo.de> wrote:
> On 01/26/2013 09:24 AM, Nathan Hüsken wrote:
>> On 01/25/2013 05:45 PM, Simon Marlow wrote:
>>> On 25/01/13 16:35, Simon Marlow wrote:
>>>> On 25/01/13 15:51, Stephen Paul Weber wrote:
>>>>> Somebody claiming to be Simon Marlow wrote:
>>>>>> On 25/01/13 13:58, Nathan Hüsken wrote:
>>>>>>> A simple hello world application has 1Mb in by 64 bit ubunut machine.
>>>>>>> When I stript it, is has about 750kb.
>>>>>>> When I build a cross compiler for android (arm), the executable has a
>>>>>>> asize of about 10MB, stripped about 5MB.
>>>>>>>
>>>>>>> That is huge, five times the size on my linux sysem.
>>>>>>
>>>>>> Not sure what you mean by "five times the size on my linux system".
>>>>>> What is 5 times larger than what?
>>>>>
>>>>> He's saying that the size of the android executable (made by his cross
>>>>> compiler) is five time the sive of the equivalent Ubuntu executable
>>>>> (made by, I assume, his system's GHC).
>>
(Continue reading)

Simon Marlow | 28 Jan 12:46 2013
Picon

Re: Size of crosscompiled exectuable

On 26/01/13 08:24, Nathan Hüsken wrote:
> On 01/25/2013 05:45 PM, Simon Marlow wrote:
>> On 25/01/13 16:35, Simon Marlow wrote:
>>> On 25/01/13 15:51, Stephen Paul Weber wrote:
>>>> Somebody claiming to be Simon Marlow wrote:
>>>>> On 25/01/13 13:58, Nathan Hüsken wrote:
>>>>>> A simple hello world application has 1Mb in by 64 bit ubunut machine.
>>>>>> When I stript it, is has about 750kb.
>>>>>> When I build a cross compiler for android (arm), the executable has a
>>>>>> asize of about 10MB, stripped about 5MB.
>>>>>>
>>>>>> That is huge, five times the size on my linux sysem.
>>>>>
>>>>> Not sure what you mean by "five times the size on my linux system".
>>>>> What is 5 times larger than what?
>>>>
>>>> He's saying that the size of the android executable (made by his cross
>>>> compiler) is five time the sive of the equivalent Ubuntu executable
>>>> (made by, I assume, his system's GHC).
>
> Yes, exactly. Sorry for my bad phrasing.
>
>>>> The problem is not the size, but the size ratio.
>>>
>>> Ah, I see.  Yes, my executables are a similar size.  I'm not sure why,
>>> I'll try to look into it.
>>
>> It's just the lack of SPLIT_OBJS.  Also, unregisterised accounts for a
>> factor of 1.5 or so.
>
(Continue reading)

Brandon Allbery | 25 Jan 16:50 2013
Picon

Re: Size of crosscompiled exectuable

On Fri, Jan 25, 2013 at 8:58 AM, Nathan Hüsken <nathan.huesken <at> posteo.de> wrote:
A simple hello world application has 1Mb in by 64 bit ubunut machine.
When I stript it, is has about 750kb.

When I build a cross compiler for android (arm), the executable has a
asize of about 10MB, stripped about 5MB.

If I had to guess, libc is linked dynamically on Ubuntu (Linux really wants this) but statically when cross-compiled.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b <at> gmail.com                                  ballbery <at> sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Gmane