libwebgpu_dawn.dylib needs to be added to .build folder
As per the title, after updating packages, not sure what caused this but my dylib now needs to be in my .build/arm64-apple-macosx/ folder in order to run. Possibly a mistake on my part but I don't recall needing to do this before.
Can you try running otool -D /usr/local/lib/libwebgpu_dawn.dylib - I suspect the output will probably contain something like @rpath/libwebgpu_dawn.dylib, which means it is expecting to be placed next to the executable.
You should be able to change the default install name of the dylib like so: sudo install_name_tool -id /usr/local/lib/libwebgpu_dawn.dylib /usr/local/lib/libwebgpu_dawn.dylib.
The whole installation process is a bit fiddly. I'll try rebuilding the latest dawn myself and add this step to the docs if needed.
Alternatively, you can add an rpath to the executable. In Swift package manager you can do this with something like linkerSettings: [.unsafeFlags(["-Xlinker", "-rpath", "-Xlinker", "/usr/local/lib"])]. Or you should be able to pass these flags directly to the swift command.
Arguably this is the better solution as it gives the end executable control over where to locate the library.
This may be of interest - having to manually place things around is not really workable, even worse installing into non userspace dirs
https://github.com/henrybetts/swift-webgpu/pull/13
This branch has gone quite far off topic in my fork (mostly due to trying to get it all working with macos, ios, tvos, and meta required for the app stores, then shifting the swift package around - and requires dawn cmake changes to build frameworks instead of dylibs) but it resolves all things like rpaths and [I think] is all automated now... I need to add some workflows to auto generate the [xc]frameworks https://github.com/NewChromantics/dawn/tree/graham/buildframework
I've barely used cmake though, (it's a nightmare if you do a lot of cross platform work) so if someone has experience there and can cleanup my cmakelists changes, i could submit some more permanent improvements to google..