BartmanAbyss / vscode-amiga-debug

One-stop Visual Studio Code Extension to compile, debug and profile Amiga C/C++ programs compiled by the bundled gcc 12.2 with the bundled WinUAE/FS-UAE.
GNU General Public License v3.0
303 stars 38 forks source link

MacOS: missing libzstd.1.dylib #192

Closed mfamfa closed 1 year ago

mfamfa commented 1 year ago

I decided to try out the Mac version on M1 Pro MacBook Pro (MacOS 12.2.6) and got the following issue: Compiling main.c dyld[19618]: Library not loaded: '/usr/local/opt/zstd/lib/libzstd.1.dylib' Referenced from: '/Users/a/.vscode/extensions/bartmanabyss.amiga-debug-1.6.8/bin/darwin/opt/libexec/gcc/m68k-amiga-elf/12.2.0/cc1' Reason: tried: '/usr/local/opt/zstd/lib/libzstd.1.dylib' (no such file), '/usr/local/lib/libzstd.1.dylib' (no such file), '/usr/lib/libzstd.1.dylib' (no such file) m68k-amiga-elf-gcc: internal compiler error: Abort trap: 6 signal terminated program cc1 Please submit a full bug report, with preprocessed source (by using -freport-bug). See https://gcc.gnu.org/bugs/ for instructions. make: *** [obj/main.o] Error 4

zstd is installed with brew. Not sure if I am missing some step?

BartmanAbyss commented 1 year ago

@grahambates Any idea?

grahambates commented 1 year ago

Yeah it looks like this is down to the GCC build no longer being static. I thought we'd eliminated all the non-system dependencies but obviously not this one. I'll sort it.

mfamfa commented 1 year ago

Great, thanks. Quick workaround; uninstall zstd with: brew uninstall --ignore-dependencies zstd then get and install x86 version with: brew fetch --force --bottle-tag=x86_64_monterey zstd brew install [download location]/Homebrew/downloads/..--zstd--1.5.2.monterey.bottle.3.tar.gz Then create symbolic link, e.g.: sudo ln -s /opt/homebrew/Cellar/zstd/1.5.2/lib/libzstd.1.5.2.dylib /usr/local/lib/libzstd.1.dylib

grahambates commented 1 year ago

I haven't forgotten about this. It doesn't look like we can avoid the zstd dependency so it will need to be bundled. However I've been reading up on this and there's a way to alter the binaries to point to a specific lib path using install_name_tool, rather than relying on DYLD_FALLBACK_LIBRARY_PATH like we do for fs-uae. I'm working on adding this into the CI job.

grahambates commented 1 year ago

This should be resolved in #197. @mfamfa if you're able to test using the binaries from that branch and confirm, that would be great.

mfamfa commented 1 year ago

@grahambates yes, will test it. Thanks.

mfamfa commented 1 year ago

@grahambates So I checked the new binaries. I cloned the repo to my machine. Applied your pull request (#197) to a new local branch. Open the folder in vscode and run the extension with F5. In the new spawned vscode I opened the demo folder and run it with F5.

FS-UAE opens and then hangs I got the followed in the vscode running the extension:

rejected promise not handled within 1 second: RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 262153. Received 262154
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:98
stack trace: RangeError: The value of "offset" is out of range. It must be >= 0 and <= 262153. Received 262154
    at new NodeError (node:internal/errors:371:5)
    at boundsError (node:internal/buffer:86:9)
    at Buffer.readInt16BE (node:internal/buffer:506:5)
    at new Kickstart (/Users/amor/Amiga/vscode-amiga-debug/dist/extension.js:21714:27)
    at AmigaDebugSession.launchRequest (/Users/amor/Amiga/vscode-amiga-debug/dist/extension.js:11260:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
mfamfa commented 1 year ago

@grahambates update - the above was fixed with a new KS1.3 rom. (I was using Cloanto before).

BartmanAbyss commented 1 year ago

That error should have been fixed. Was an out of bound read within the kickstart rom.

mfamfa commented 1 year ago

I believe this is safe to close now. Tested with latest version.