Openwrt Linux Uclibc ARM GC issue

Radu void at null.pt
Sun Dec 17 17:20:32 UTC 2017


On Saturday, 16 December 2017 at 14:14:40 UTC, Joakim wrote:
> 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

Test runners where out of the question as no program started. See 
my reply to David.
Yeah I setup the CC correctly, but curiously specifying a more 
fitting platform triple and -march on GCC produced non working 
binaries, I had to revert to the defaults.

Yes - latest LDC versions make cross compiling a breeze so kudos 
to you guys for making this happening. I'm using Linux subsystem 
for Window btw. so for me this is even more fun as I can work on 
both environments natively :)

The modifications need it surface deep are very few - some math 
and memory streams functions are missing.

The road block looks to be somewhere in the GC and TLS, or the 
interaction of them (at least this is my feeling ATM)


More information about the digitalmars-d-ldc mailing list