acidanthera / bugtracker

Acidanthera Bugtracker
374 stars 42 forks source link

How to compile Lilu.kext? #2412

Open vrqq opened 3 days ago

vrqq commented 3 days ago

When I try to load Lilu.kext compiled in MacOS 10.15 Catalina, it took me a problem: kxld[as.vit9696.Lilu]: The vtable '__ZTV4Lilu' is malformed. Make sure your kext has been built against the correct headers.

Xcode Version 12.4 (12D4e) macOS Catalina 10.15.7 (19H2026)

The build steps below:

  1. get the latest version of Lilu: git clone https://github.com/acidanthera/Lilu.git
  2. In Lilu project folder, clone MacKernelSDK project git clone https://github.com/acidanthera/MacKernelSDK.git
  3. Build Lilu in release xcodebuild -configuration Release
  4. set the permission and try to load kext kextutil -v Lilu.kext

Then the error log shown:

root@vrqqs-MBP # kextutil -v ./Lilu.kext
Defaulting to kernel file '/System/Library/Kernels/kernel'
Kext with invalid signature (-67050) allowed: <OSKext 0x7ff3f5f18960 [0x7fff8eed3ce0]> { URL = "file:///Users/vrqq/Lilu/build/Release/Lilu.kext/", ID = "as.vit9696.Lilu" }
Code Signing Failure: code signature is invalid
/Users/vrqq/Lilu/build/Release/Lilu.kext appears to be loadable (not including linkage for on-disk libraries).
Loading /Users/vrqq/Lilu/build/Release/Lilu.kext.
Disabling KextAudit: SIP is off
KextAudit initialized: audit=F
(kernel) kxld[as.vit9696.Lilu]: The vtable '__ZTV4Lilu' is malformed. Make sure your kext has been built against the correct headers.
(kernel) kxld[as.vit9696.Lilu]: The vtable '__ZTV4Lilu' is malformed. Make sure your kext has been built against the correct headers.
(kernel) Can't load kext as.vit9696.Lilu - link failed.
(kernel) Failed to load executable for kext as.vit9696.Lilu.
(kernel) Kext as.vit9696.Lilu failed to load (0xdc008016).
(kernel) Failed to load kext as.vit9696.Lilu (error 0xdc008016).
Failed to load /Users/vrqq/Lilu/build/Release/Lilu.kext - (libkern/kext) link error.
Failed to load /Users/vrqq/Lilu/build/Release/Lilu.kext - (libkern/kext) link error.
Check library declarations for your kext with kextlibs(8).

And I compare the file 'MacKernelSDK/Headers/DriverKit/IOService.h' with '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit20.2.sdk/System/DriverKit/System/Library/Frameworks/DriverKit.framework/Headers/IOService.h' I found that the declaration in Xcode.app have a function virtual kern_return_t RequireMaxBusStall(uint64_t maxBusStall); but MacKernelSDK not.

The problem still exist after I add an additional xcode-buildsetting MACOSX_DEPLOYMENT_TARGET=10.15

It is a bug or I use a wrong compile arguments?

vit9696 commented 2 days ago

I think currently our kexts can only be loaded with OpenCore. Does your compiled kext load with OpenCore?