D2 Library Porters

Iain Buclaw ibuclaw at ubuntu.com
Tue Jul 3 04:34:37 PDT 2012


On 3 July 2012 11:26, d coder <dlang.coder at gmail.com> wrote:
>>
>> I'm going to be pushing gdc-4.8 package into debian this weekend (give
>> about a fortnight for it to land in sid) - is anyone interested in porting
>> Druntime / Phobos over to the architectures that Debian supports?  I can
>> give anyone a quick crash course through building a cross compiler if they
>> need it.
>
>
> Hello Iain
>
> I do not know how much I would be able to achieve, but I can contribute a
> reasonable amount of time on this.
>
> I would need a crash course though. Let me know how to proceed.
>
> Regards
> - Puneet


In a brief / rough description, essentially the art of cross-compiling is:

1) Obtain binutils sources for your current distribution (Debian has 2.22)
Obtain gcc-core sources for the version you are wanting to build (ie: 4.7)


2) Configure binutils with --target=arm-linux-gnueabi. Build and
install somewhere away from your system folders (eg: /usr/local, /opt,
or /home may work)


3) Configure gcc-core with --target=arm-linux-gnueabi
--enable-multilib --disable-libssp.  Build and install in same
location as binutils.

Notes on configure options:
--target is the target you want to compile for. The examples given are
if compiling for armel, check the target system name as debian defines
for the system you want to cross compile for.

--enable-multilib allows multiarch settings (eg, it should enable both
ARM and Thumb compilation on armel - but don't quote me on that! :)
--disable-libssp disables the stack-smashing protection library. This
is because apparently it doesn't build in cross-compiler toolchains.


4) If you manage to successfully compile and install the gcc
cross-compiler. Obtain the gdc sources and install into gcc-core (I
will tarball a copy up that includes the zlib sources too and post a
link).   Then rebuild gcc with the same options above above, but with
--enable-languages=d included.


5) Report any gdc build errors as bugs.  Try to fix any library build
errors and send patches! \o/

I suspect there will be issues found where we can also push into
upstream Phobos / Druntime which will help make life easier for
architecture and platform porters.

Any arch-specific implementations that are missing in Druntime,
generally you will need to consult the libc sources for that
architecture.  You can either get glibc or elibc for that (Debian uses
elibc).


I'll be available on IRC later if you need any real-time assistance -
I can forsee it as cross compilers are always ugly to get right :~)


Regards
-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the Digitalmars-d mailing list