Skip to content

CMake on macOS M2: The file name is invalid #1419

@etra0

Description

@etra0

Currently, when building with CMake on a M series processors give the following error:

ggml_metal_init: error: Error Domain=NSCocoaErrorDomain Code=258 "The file name is invalid."

Steps to reproduce:

mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j12

Doing this fixes the error but I'm sure it'll break make builds.

diff --git a/ggml-metal.m b/ggml-metal.m
index 1139ee3..63ac00a 100644
--- a/ggml-metal.m
+++ b/ggml-metal.m
@@ -178,7 +178,7 @@ @implementation GGMLMetalClass
 
         //NSString * path = [[NSBundle mainBundle] pathForResource:@"../../examples/metal/metal" ofType:@"metal"];
         NSBundle * bundle = [NSBundle bundleForClass:[GGMLMetalClass class]];
-        NSString * path   = [bundle pathForResource:@"ggml-metal" ofType:@"metal"];
+        NSString * path   = [bundle pathForResource:@"bin/ggml-metal" ofType:@"metal"];
         metal_printf("%s: loading '%s'\n", __func__, [path UTF8String]);
 
         NSString * src  = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error];

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions