Skip to content

Compilation Issue with Symbols #28

@Dhruv-Trivedi

Description

@Dhruv-Trivedi

Hello there!

I know this is not the best place to share my error, but I've been trying to compile XNU via this script and I'm stuck at a specific point — ld cannot load symbols for any architecture that I try to compile for. I've tried the build on an iMac Pro and an M1 MacBook Pro (T8103), both running macOS Sequoia 15.4.

Some articles that I came across indicate that I might be invoking clang++ for .c files, which results in a symbol resolution error — checking the build log, this is what I came across when running the recommended MACOS_VERSION='15.0' KERNEL_CONFIG=RELEASE ARCH_CONFIG=ARM64 MACHINE_CONFIG=VMAPPLE ./build.sh --clean --kc build command:

LDFILELIST bsd
CC lastkerneldataconst.o
CC lastkernelconstructor.o
CC nonlto.o
CC version.o
LD kernel.release.vmapple.unstripped.noctf

This last call to LD is invoking clang++ from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++, and this is the resultant error:

Undefined symbols for architecture arm64e:
  "OSValueObject<int>::MetaClass::MetaClass()", referenced from:
      ___cxx_global_var_init in OSValueObject.cpo
ld: symbol(s) not found for architecture arm64e
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [${BUILD_DIR}/build/xnu.obj/RELEASE_ARM64_VMAPPLE//kernel.release.vmapple.unstripped.noctf] Error 1
make[2]: *** [build_all] Error 2
make[1]: *** [build_all_bootstrap_RELEASE^ARM64^VMAPPLE] Error 2
make: *** [install] Error 2

Am I missing a cross-compiler toolchain? I am very new to XNU and the build process, but am hoping to learn. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions