Openwrt Linux Uclibc ARM GC issue

Joakim dlang at joakim.fea.st
Sat Dec 16 14:14:40 UTC 2017


On Friday, 15 December 2017 at 14:06:37 UTC, Radu wrote:
> Trying to run some D code on Openwrt with Uclibc and got stuck 
> by broken GC.
>
> Using LDC 1.6
> ====================================
> LDC - the LLVM D compiler (1.6.0):
>   based on DMD v2.076.1 and LLVM 5.0.0
>   built with LDC - the LLVM D compiler (1.6.0)
>   Default target: x86_64-unknown-linux-gnu
>   Host CPU: broadwell
>   http://dlang.org - http://wiki.dlang.org/LDC
>
>   Registered Targets:
>     aarch64    - AArch64 (little endian)
>     aarch64_be - AArch64 (big endian)
>     arm        - ARM
>     arm64      - ARM64 (little endian)
>     armeb      - ARM (big endian)
>     nvptx      - NVIDIA PTX 32-bit
>     nvptx64    - NVIDIA PTX 64-bit
>     ppc32      - PowerPC 32
>     ppc64      - PowerPC 64
>     ppc64le    - PowerPC 64 LE
>     thumb      - Thumb
>     thumbeb    - Thumb (big endian)
>     x86        - 32-bit X86: Pentium-Pro and above
>     x86-64     - 64-bit X86: EM64T and AMD64
> ====================================
>
> Run time libs where compiled with:
>
> ====================================
> ldc-build-runtime --dFlags="-w;-mtriple=armv7-linux-gnueabihf 
> -mcpu=cortex-a7 -L-lstdc++" --cFlags="-mcpu=cortex-a7 
> -mfloat-abi=hard -D__UCLIBC_HAS_BACKTRACE__ 
> -D__UCLIBC_HAS_TLS__" --targetSystem="Linux;UNIX" 
> BUILD_SHARED_LIBS=OFF
> ====================================

First thing I'd do is build and run the test runners, then make 
sure no tests are failing, particularly in druntime.  Another 
thing I notice is that you don't separate many of those C and D 
flags with semi-colons: not sure how that worked for you, as I 
get errors if I try something similar.  Also, you need to specify 
the C cross-compiler with CC=arm-openwrt-linux-gcc before running 
ldc-build-runtime: maybe you did that but forgot to mention it.

It is fairly easy to cross-compile the test runners too if you 
pass the --testrunners flag, see the instructions for the RPi and 
Android for examples:

https://wiki.dlang.org/Building_LDC_runtime_libraries
https://wiki.dlang.org/Build_D_for_Android

You may need to make some modifications to druntime or Phobos to 
get everything to compile, and you may have to specify some 
linker flags too, to get the test runners to link.  Let us know 
how it works out.

While you could reuse most of the glibc declarations for now, you 
may eventually need to patch druntime for Uclibc, as was done 
before for Bionic and the NetBSD libc for example:

https://github.com/dlang/druntime/pull/734
https://github.com/dlang/druntime/pull/1494


More information about the digitalmars-d-ldc mailing list