Skip to content

Having a hard time compiling on Apple Silicon #3

@ikatson

Description

@ikatson

Hi, I'm not sure if Apple Silicon is even a configuration that is supposed to work, but libkrun's support of macos/arm64 indicated that is probably is. As it lists libkrunfw as a dependency, I'm trying to build libkrunfw on Apple M1, which makes it build the kernel on osx natively.

There's a myriad of issues I was facing so far, here are some of them:

  1. ARCH variable is not exported, so kernel build system does not see ARCH=arm64. Worked around by exporting it.

  2. Files in the root folder are called like *aarch64, but on M1 uname -m is arm64. Worked around by renaming all the files.

  3. System linker /usr/bin/ld is incompatible with the kernel build system, spits out messages like ld: unknown option: --version. Worked around by symlinking ld.lld into my PATH as ld.

  4. There's no elf.h on big sur. So far worked around (kind of) by using elf.h from libelf.

  5. Maybe it is from the previous problem, but getting this output during the kernel build MKELF scripts/mod/elfconfig.h, Error: not ELF. Worked around by temporarily making mk_elfconfig.c always return 0.

  6. uuid_t from OSX is incompatible with kernel one, here's the error

     scripts/mod/file2alias.c:47:3: error: typedef redefinition with different types ('struct uuid_t' vs '__darwin_uuid_t' (aka 'unsigned char [16]'))
     } uuid_t;
       ^
     /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uuid_t.h:31:25: note: previous definition is here
     typedef __darwin_uuid_t uuid_t;
                             ^
     scripts/mod/file2alias.c:1329:42: error: array initializer must be an initializer list or string literal
             DEF_FIELD(symval, tee_client_device_id, uuid);
                                                     ^
     2 errors generated.
     make[2]: *** [scripts/Makefile.host:112: scripts/mod/file2alias.o] Error 1
     make[1]: *** [Makefile:1205: prepare0] Error 2
    

I have no idea how far will I go trying to overcome all this, but the main question stands - is it supposed to be possible, or it's not a configuration that was ever tested?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions