Undefined symbol: _assert when loading ext2fs

  • I get this error when loading extfs.kext on an intel mac (I compiled it myself):
    kld(): Undefined symbols:
    kextload: kld_load_from_memory() failed for module /builds/ext2fsx/build/Default/ext2fs.kext/Contents/MacOS/ext2fs
    kextload: a link/load error occured for kernel extension ext2fs.kext/
    load failed for extension ext2fs.kext/
    (run kextload with -t for diagnostic output)

    kextload -t doesn't say anything different. I realize why _assert shouldn't be linked in, but it is.

    • assert is #define'd to Assert in <kern/assert.h>. So, I'd guess that you are not including that header when you build. Which means you are likely not using XCode to build.

      nm -m /mach_kernel | grep Assert
      000265ac (__TEXT,__text) external _Assert

      • It's not giving me an undefined _Assert. It's giving me an undefined _assert. I am building with XCode.

        • Right, that's what I was saying. assert is a macro, not a function. So if it is being linked in as a function reference then the header file <kern/assert.h> is not being included somewhere, because assert expands to Assert().

          What XCode version are you using? And are you building the Deployment of Development target?