Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Perl: porters

JROBINSON TPF grant report July/August

 

 

Perl porters RSS feed   Index | Next | Previous | View Threaded


castaway at desert-island

Aug 27, 2012, 4:02 AM

Post #1 of 5 (50 views)
Permalink
JROBINSON TPF grant report July/August

(Report up to Aug 26th anyway, I'll add anything I do in the last few days
of August to the next one)

After a bit of a slow start (and thus the reason to merge July/August
reports), I've gotten started on the actual work, and managed to tick off
one of my tasks.

I eliminated my earlier use of the tool "agcc" from the code base. This
was an external (and with non-compatible licence) tool designed to make
using the cross-compiled gcc similar to a normal gcc. In the end it turned
out to be more of a hinderance. Getting rid of it and using Android's
suggestion for "--sysroot" as a gcc option means upgrading the NDK to the
latest one is now simple. The SDK is now not required at all.

The last 2 weeks (Weeks #6/#7) I was at the Perl Reunification Summit, and
then YAPC::EU, which were inspirational. I got started on the second task
I have identified. To enable me to merge (or better, re-port) my original
changes to blead, I have started with a fresh copy of blead and will
add a piece at a time.

Expanding Configure is my current target. It already has a small piece of
code to support cross-compiling, using -Dusecrosscompile, however this
mostly skips all the parts it can't do, like compiling and then running
various pieces of code for testing sizes of integers and similar. In order
to enable us to have as small a piece of "canned config.sh" as possible, I
am adding support for these things.

Currently I have it using `nm` (or rather the copy in the cross-compiler
bin-utils) to find the size of the variables declared in the 'try.c'
binary. When cross-compiling, this now looks like:

#include <stdio.h>
#$i_stdlib I_STDLIB
#ifdef I_STDLIB
#include <stdlib.h>
#endif

int PERL_INT_SIZE;
long PERL_LONG_SIZE;
short PERL_SHORT_SIZE;

int main()
{
exit(0);
}
EOCP

Running nm gets us:

$
/usr/src/android/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-nm
-p -t d -S UU/try
00037740 d _DYNAMIC
00037940 d _GLOBAL_OFFSET_TABLE_
00033612 A __exidx_end
00037996 A _bss_end__
00037724 T __FINI_ARRAY__
00037960 A __bss_start__
00037968 00000004 B __dso_handle
00033612 A __exidx_start
00037984 00000004 B PERL_LONG_SIZE
00037988 00000004 B PERL_INT_SIZE
U __libc_init
00037992 00000002 B PERL_SHORT_SIZE
00037732 D __CTOR_LIST__
00037996 A __bss_end__
00033552 T _start
00037716 T __INIT_ARRAY__
00037960 A __bss_start
00033600 00000012 T main
00037996 A __end__
00037708 D __PREINIT_ARRAY__
00037960 A _edata
00037996 A _end
U exit
00037960 D __data_start

And we extract the values for the PERL_* variables. The same process is
repeated for long longs, long doubles, pointers etc. Assuming
cross-compile environments all use gcc and contain the bin-utils, this
ought to be fairly portable.

To ensure the correct 'nm' (and also later 'ar') is used, I've added
support to Configure to allow the binaries to be named differently. The
cross-compiler 'nm' for the NDK is, for example,
'arm-linux-androideabi-nm'. If "-Dusecrosscompile=arm-linux-androideabi-"
is passed as a Configure argument, binaries will be discovered with that
string as a prefix.

I've now started to add support for -Dsysroot. The name is taken from the
gcc option mentioned earlier, and is similar to chroot, it specifies a
logical root directory under which headers and libraries can be found.
Various parts of the Configure script try to discover which libraries are
available, and the location of the libc.so, using absolute paths. When
cross-compiling, these are being found on the host system, instead of
inside the toolchain for the cross-compiler. Adding sysroot support means
the compiler's headers and libraries can now be located correctly. This is
applicable to any system with its compiler located in its own chroot, or
multiple toolchains / libraries installed.

[Hours] [Activity]

5.75 Admin - Tasks, Emails, Planning
6.50 Remove agcc from x-cross-compile branch
2.00 Update to latest Android NDK and verify working with
x-cross-compile
10.50 Update Configure with better cross-compiling support
=====

24.75 hours total

Jess Robinson


doughera at lafayette

Aug 29, 2012, 7:11 AM

Post #2 of 5 (45 views)
Permalink
Re: JROBINSON TPF grant report July/August [In reply to]

On Mon, 27 Aug 2012, Jess Robinson wrote:

>
> (Report up to Aug 26th anyway, I'll add anything I do in the last few days of
> August to the next one)
>
> After a bit of a slow start (and thus the reason to merge July/August
> reports), I've gotten started on the actual work, and managed to tick off one
> of my tasks.
>
> I eliminated my earlier use of the tool "agcc" from the code base. This was an
> external (and with non-compatible licence) tool designed to make using the
> cross-compiled gcc similar to a normal gcc. In the end it turned out to be
> more of a hinderance. Getting rid of it and using Android's suggestion for
> "--sysroot" as a gcc option means upgrading the NDK to the latest one is now
> simple. The SDK is now not required at all.
>
> The last 2 weeks (Weeks #6/#7) I was at the Perl Reunification Summit, and
> then YAPC::EU, which were inspirational. I got started on the second task I
> have identified. To enable me to merge (or better, re-port) my original
> changes to blead, I have started with a fresh copy of blead and will add a
> piece at a time.
>
> Expanding Configure is my current target. It already has a small piece of code
> to support cross-compiling, using -Dusecrosscompile, however this mostly skips
> all the parts it can't do, like compiling and then running various pieces of
> code for testing sizes of integers and similar. In order to enable us to have
> as small a piece of "canned config.sh" as possible, I am adding support for
> these things.

Autoconf has some clever tricks to do some of these. One I'm aware of is
ax_compile_check_sizeof. Check out

http://www.gnu.org/software/autoconf-archive/ax_compile_check_sizeof.html#ax_compile_check_sizeof

for more details. I think it's worth checking those out before falling
back on potentially fragile probes that depend on the particular output of
a particular toolchain,

--
Andy Dougherty doughera [at] lafayette


perl.p5p at rjbs

Aug 29, 2012, 7:23 AM

Post #3 of 5 (45 views)
Permalink
Re: JROBINSON TPF grant report July/August [In reply to]

* Jess Robinson <castaway [at] desert-island> [2012-08-27T07:02:56]
> (Report up to Aug 26th anyway, I'll add anything I do in the last
> few days of August to the next one)
> [...]
> 24.75 hours total

+1

--
rjbs
Attachments: signature.asc (0.48 KB)


castaway at desert-island

Aug 30, 2012, 2:31 AM

Post #4 of 5 (41 views)
Permalink
Re: JROBINSON TPF grant report July/August [In reply to]

On Wed, 29 Aug 2012 15:11:22 +0100, Andy Dougherty
<doughera [at] lafayette> wrote:

> On Mon, 27 Aug 2012, Jess Robinson wrote:
>
>>
>>
>> Expanding Configure is my current target. It already has a small piece
>> of code
>> to support cross-compiling, using -Dusecrosscompile, however this
>> mostly skips
>> all the parts it can't do, like compiling and then running various
>> pieces of
>> code for testing sizes of integers and similar. In order to enable us
>> to have
>> as small a piece of "canned config.sh" as possible, I am adding support
>> for
>> these things.
>
> Autoconf has some clever tricks to do some of these. One I'm aware of is
> ax_compile_check_sizeof. Check out
> http://www.gnu.org/software/autoconf-archive/ax_compile_check_sizeof.html#ax_compile_check_sizeof
>
> for more details. I think it's worth checking those out before falling
> back on potentially fragile probes that depend on the particular output
> of
> a particular toolchain,
>

That's... very sneaky. I'll have a look, thanks!

I do think I'll probably output warnings if someone tries to cross-compile
on an untested host / compiler though, and we can add to the list of
known-working as we go.

Jess


tom at eborcom

Aug 30, 2012, 10:40 AM

Post #5 of 5 (41 views)
Permalink
Re: JROBINSON TPF grant report July/August [In reply to]

On Mon, Aug 27, 2012 at 12:02:56PM +0100, Jess Robinson wrote:
> After a bit of a slow start (and thus the reason to merge July/August
> reports), I've gotten started on the actual work, and managed to tick off
> one of my tasks.

Jess's report shows a promising start to this grant.

Signed off,
Tom

Perl porters RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.