kohi icon indicating copy to clipboard operation
kohi copied to clipboard

Unable to build on Mac m2 air

Open ozzyozbourne opened this issue 10 months ago • 1 comments

Screenshot 2024-04-19 at 2 30 26 AM **Describe the bug** A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Getting error on runing build-debug.sh or build-release.sh

ozzyozbourne avatar Apr 19 '24 06:04 ozzyozbourne

Hello Travis, I'm not sure why this is happening. Am I missing some library? Although I have added all the necessary dependencies mentioned for macOS, I'm running build-debug.sh from the main branch.

P.S. I have been enjoying the Kohi game engine series immensely. Keep up the good work, brother. Thanks

ozzyozbourne avatar Apr 19 '24 06:04 ozzyozbourne

@ozzyozbourne I am on an M3 MBP and I also experienced this issue. I don't know if this is the correct path forward, but I wrote my own kthread_wait function as mentioned in this issue:

https://github.com/travisvroman/kohi/issues/222

Here is my version. Note that I don't really know if this is the right way to write the function as I haven't contributed to this project and I don't write C at work.

b8 kthread_wait(kthread* thread) {
    if (!thread) {
        return false;
    }

    while (true) {
        if (thread->work_queue.element_count == 0) {
            break;
        }
    }

    return true;
}

I can now get the project to compile, but only when executing ./build-debug.sh. When executing ./build-release.sh, I get this error:

engine/src/renderer/renderer_frontend.c:501:8: error: no member named 'module_watch_ids' in 'struct shader'
    s->module_watch_ids = kallocate(sizeof(u32) * config->stage_count, MEMORY_TAG_ARRAY);
    ~  ^
1 error generated.
make: *** [obj/engine/src/renderer/renderer_frontend.c.o] Error 1

When building with ./build-debug.sh and running ./testbed, I get this error despite having Vulkan installed:

[ERROR]: Error opening library: dlopen(libvulkan_renderer.dylib, 0x0002): Library not loaded: @rpath/libvulkan.1.dylib
  Referenced from: <3D97920A-53AB-32EA-AFF7-FDA3F6E76247> /Users/briankamras/Documents/GitHub/kohi/bin/libvulkan_renderer.dylib
  Reason: tried: './libvulkan.1.dylib' (no such file)
[FATAL]: Could not create application!

bkamras09 avatar May 19 '24 15:05 bkamras09

@ozzyozbourne Thanks for submitting this!

Catching up on issues - apologies for the delay! I had to dig back a bit for this since it was technically resolved a while ago. #222 was as well.

Anyway, ultimately the issue was the fact that kthread_wait was never defined on the mac platform (nor linux seemingly) at the time this was written up. Anything version 0.6 and before would have been wrong here for those platforms. You'll need to use 0.7.0 or newer and this is fixed. For mac specifically, you'll want to use 0.7.1 or newer.

Closing this.

travisvroman avatar Jul 21 '24 00:07 travisvroman