Darling: Getting Darling To Build On An ARM64 Device

Created on 23 Jan 2020  路  10Comments  路  Source: darlinghq/darling

I understand that ARM64 support isn't a high priority for Darling, but there are some parts that I probably would not understand or know how to resolve on my own. I am hoping the Darling team would be able to help me or push me at the right direction.


So I recently got a Pinebook Pro and installed Manjaro ARM on it. Majority of the packages needed are available, with the exception of gcc-multilib and lib32-gcc-libs. As a result, I have disabled TARGET_i386. I should include a proper build target for ARM64, but for the time being, I want to see how far I can get away with using TARGET_x86_64.

Any issues I have with ARM64 will be posted here (to avoid clutter since ARM64 isn't an officially supported platform). I also included some cmake logs if you need to take a look at the logs.

cmake_log.txt
CMakeError.log
CMakeOutput.log

Most helpful comment

@CuriousTommy Done. I happened to do just that because I'm trying to update dyld to the newest "dyld3".

All 10 comments

It didn't take too long for a build error to occur. The weird this is that this error is not caused by Darling's code, but rather the header files. This error comes from /usr/include/asm/sigcontext.h and /usr/include/sys/user.h

In file included from /home/thomasa/Downloads/darling/src/libelfloader/native/threads.c:27:
In file included from /usr/include/signal.h:291:
In file included from /usr/include/bits/sigcontext.h:30:
/usr/include/asm/sigcontext.h:77:2: error: unknown type name '__uint128_t'
        __uint128_t vregs[32];
        ^
In file included from /home/thomasa/Downloads/darling/src/libelfloader/native/threads.c:27:

Here is the full log: make_log.txt

Edit: I figure out the problem, it has to do with the -m32 build option located here.

It makes sense why this would fail (since I don't have the 32bit libraries installed). Seems like disabling TARGET_i386 isn't enough.

Edit2: I added an if condition to build the 32bit version if TARGET_i386 is set.

The next road blocker I am running into is cctools-port. It seems like the code currently has issues detecting the machine as arm64.

/home/thomasa/Downloads/darling/src/external/cctools-port/cctools/ld64/src/../../include/foreign/mach/machine/boolean.h:39:2: error: architecture not supported
...
/home/thomasa/Downloads/darling/src/external/cctools-port/cctools/ld64/src/../../include/foreign/mach/machine/vm_types.h:39:2: error: architecture not supported
...

Going off of this useful link, adding __aarch64__ fixed this error message.

The weird thing about this issue is that it does not occur in the original project (at least from my very basic compile test).

I am currently trying to use an updated version of cctool-port in my fork to see if that fixes any other complication issues I am experiencing.

Edit: No, updating it doesn't fix the issue. It has to do with the fact that __arm64__ is an Apple thing.

What is platform-include used for? bootstrap_cmds is currently failing.

/home/thomasa/Downloads/darling/src/bootstrap_cmd/include/mach/machine/boolean.h:35:2 error: architecture not supported
#error architecture not supported

I noticed that some of the files in that folder are similar to cctools-port:cctools/include/foreign. The boolean.h file in the darling repo doesn't include the other architectures that are found in the cctools-port boolean.h file. Are the files in the platform-include folder old?

You might also need to update https://github.com/darlinghq/darling/tree/master/src/kernel/libsyscall/bsdsyscalls for ARM64, (currently the macros only check for i386 or x86_64).

@TheBrokenRail I am actually going through that currently. Right now I am just copying and pasting Apple's xnu code in there, but it looks like I am going to have to make some manual changes as well.

Will your work support ARM32, then Darling will work on older Raspberry Pis/rooted Android devices as well!

@TheBrokenRail Not in it's current form. I probably won't support it until I merge ARM64 support into darling and move to a distro that also supports ARM32 (Manjaro ARM only supports ARM64).

For now, I want to keep things simple.

Any updates on this?

@TheBrokenRail I have been busy with some IRL stuff (working hard to get my entry level career job!), so I haven't had a lot of time to work on this.

IRL stuff aside, I am waiting for @LubosD to update Darling to use the new cctool-port code. After the new code is used, I can continue working on the arm-support branch (when I have the free time).

@CuriousTommy Done. I happened to do just that because I'm trying to update dyld to the newest "dyld3".

Was this page helpful?
0 / 5 - 0 ratings