prb28 / vscode-amiga-assembly

Amiga Assembly extension for Visual Studio Code
GNU General Public License v3.0
178 stars 12 forks source link

[EMU] No suitable emulator binary (Mac Silicon) #283

Closed lpoulain closed 2 months ago

lpoulain commented 9 months ago

When trying to execute the example workspace I get the [EMU] No suitable emulator binary error. I'm on Mac Silicon. It's a new project so is using the new config syntax.

When I try to execute ~/.vscode/extensions/prb28.amiga-assembly-1.8.6/dist/bin/fs-uae/fs-uae-darwin_x64 it turns out it cannot find its libraries, even though some are available in lib. By adding symlinks from /usr/local/lib I was able to get past some errors, but now it's looking for libgraphite2.3.dylibwhich is not available in the lib directory.

I also tried replacing fs-uae-darwin_x64 with a symlink to a working version of FS-UAE (and made sure the file works), but still get the "no suitable emulator binary" error.

cobour commented 9 months ago

Same problem here on Mac OS Sonoma running on Intel. Last working version is 1.8.2. On any higher version the above mentioned error occurs. I have checked the bin dir setting like mentioned in the "Breaking Changes" section of the wiki. Also my launch config is correct and checked against the wiki. Error seems to be introduced in v1.8.4.

@lpoulain : Go to the Extensions View in VSC, right-click on Amiga-Assembly and choose "Install Another Version...". Then select v1.8.2 and you are good to go.

lpoulain commented 9 months ago

@cobour switching to 1.8.2 indeed works, thanks!

prb28 commented 9 months ago

@grahambates can you look at this please ?

grahambates commented 9 months ago

Yeah I'll have a look

hidef-zz commented 8 months ago

I have the same issue but on Ubuntu 22.04 / AMD based system :(

DarthChillash commented 8 months ago

In both my scenario and I talked to @hidef-zz turns out libSDL was missing. It can be fixed easy by installing some of these packages:

libsdl2-2.0-0 libsdl2-dev libsdl2-ttf-2.0-0 libsdl2-ttf-dev

We found the problem with ldd command, of course, so I imagine Mac users could try checking emulator binary with ldd to see which lib is missing and then install it.

Not sure how LARGE would fs-uae binary be if it was statically linked, tho?

grahambates commented 8 months ago

It doesn't seem to be possible to create a completely static binary at least for Mac. The required libs should be bundled for all platforms though, so I'm looking into why it might not be referencing them correctly.

DarthChillash commented 8 months ago

Try a clean Ubuntu install in a VM. I am pretty sure that libSDL is missing. When we attempt to start the extension emulator the error message that we get is somewhat misleading.

Is it possible that VScode extension runs ldd and tells the user which lib is missing instead of just saying "no suitable emulator binary"?

prb28 commented 8 months ago

@grahambates I don't know if if helps but for osx I used to relocate the librairies with the command:

install_name_tool -change "/usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib" "@loader_path/libSDL2-2.0.0.dylib" fs-uae

This must me be done for each library with local path and recursively.

cobour commented 7 months ago

I installed these missing libraries brew install freetype brew install glib brew install graphite2

after that when starting ~/.vscode/extensions/prb28.amiga-assembly-1.8.6/dist/bin/fs-uae/fs-uae-darwin_x64 from the terminal I get this error:

fs-uae-darwin_x64(3657,0x7ff859fd8b80) malloc: Heap corruption detected, free list is damaged at 0x600003ee0020 Incorrect guard value: 36170086427328512 fs-uae-darwin_x64(3657,0x7ff859fd8b80) malloc: set a breakpoint in malloc_error_break to debug zsh: abort ./fs-uae-darwin_x64

macOS 14.2.1 (Intel), Amiga Assembly v1.8.6, VSCode 1.85.2

grahambates commented 7 months ago

There's a chance the error is the same as this issue on my other FS-UAE fork for Bartman's extension: https://github.com/BartmanAbyss/vscode-amiga-debug/issues/243

If so, that fix is also included in the next version of uae-dap.

grahambates commented 7 months ago

I do relocate libraries as part of the build, so not too sure what's going on there. If it's still happening on the next release I'll look into it.

cobour commented 7 months ago

Here are my test results:

macOS 14.2.1 (Intel)

VSCode 1.86.0, Amiga Assembly v1.8.7 (pre-release) => no error message, but fs-uae does not start at all (no window does come up, program does not run) VSCode 1.86.0, Amiga Assembly v1.8.6 => error message "Cannot read properties of undefined (reading 'on')", fs-uae does not start (emulator does not come up, program does not run)

VSCode 1.85.2, Amiga Assembly v1.8.7 (pre-release) => Extension version can not be installed VSCode 1.85.2, Amiga Assembly v1.8.6 => error message "[EMU] No suitable emulator binary", fs-uae does not start (emulator does not come up, program does not run) VSCode 1.85.2, Amiga Assembly v1.8.2 => no error message, fs-uae starts, program starts, debugging works

grahambates commented 7 months ago

@cobour are you able to start fs-uae maually from the CLI? The location of the bundled version will probably be ~/.vscode/extensions/prb28.amiga-assembly-1.8.7/dist/bin/fs-uae/fs-uae-darwin_x64. Let me know if you see any errors.

cobour commented 7 months ago

@grahambates The file was not marked as executable: -rw-r--r--@ 1 frank staff 18249120 4 Feb 15:22 fs-uae-darwin_x64 so I executed chmod 755 fs-uae-darwin_x64

after that the app starts, throwing this error: fs-uae-darwin_x64(933,0x7ff8558e9b80) malloc: Heap corruption detected, free list is damaged at 0x6000026c4af0 *** Incorrect guard value: 36170086427328512 fs-uae-darwin_x64(933,0x7ff8558e9b80) malloc: *** set a breakpoint in malloc_error_break to debug

error came at 3 times out of 4 calls, when it was not shown, there was a segmentation fault reported in terminal.

when error came, a error report window opened, full text is attached: full_error_log.txt

prb28 commented 7 months ago

It worked for me on intel macos 12.6.7 - maybe it needs to be rebuild in a newer version of macos.

cobour commented 7 months ago

If you could point me to the instructions to build the patched fs-uae for your extension I would be glad to provide that binary.

prb28 commented 7 months ago

Must be this project from @grahambates: https://github.com/grahambates/fs-uae/tree/remote_debugger_prb28 but I do not have built this version. Building fs-uae can be tricky.... (as win-uae).

Jasmin68k commented 7 months ago

In both my scenario and I talked to @hidef-zz turns out libSDL was missing. It can be fixed easy by installing some of these packages:

libsdl2-2.0-0 libsdl2-dev libsdl2-ttf-2.0-0 libsdl2-ttf-dev

We found the problem with ldd command, of course, so I imagine Mac users could try checking emulator binary with ldd to see which lib is missing and then install it.

Not sure how LARGE would fs-uae binary be if it was statically linked, tho?

The problem still exists on Linux.

Using Debian Sid, I have to use export LD_LIBRARY_PATH=/home/user/.vscode/extensions/prb28.amiga-assembly-1.8.7/dist/bin/fs-uae (f.e. in .bashrc) or install libsdl2-ttf-2.0-0 in order to not get the error message in the title.

It seems, the extension fails to set LD_LIBRARY_PATH properly.

cobour commented 7 months ago

Must be this project from @grahambates: https://github.com/grahambates/fs-uae/tree/remote_debugger_prb28 but I do not have built this version. Building fs-uae can be tricky.... (as win-uae).

I cloned the mentioned repo and switched to mentioned branch. Then I followed the build instructions in docs/compiling.md I had Xcode and Xcode command line tools already on my machine, so I just executed the brew install... after the bootstrap and configure I started the make

It did produce a binary that I renamed, chmod'ed and copied to the extension directory (VSCode 1.86.0, Amiga Assembly 1.8.7 pre-release). Binary is much bigger than the one that was installed by the extension:

-rwxr-xr-x 1 frank staff 23602688 6 Feb 19:30 fs-uae-darwin_x64 -rwxr-xr-x@ 1 frank staff 18249120 6 Feb 19:17 fs-uae-darwin_x64___ORIGINAL

BUT: same error as before, most of the time the malloc-error, sometimes a simple segmentation fault. :-(

Did I do something wrong?

prb28 commented 7 months ago

If it is the same error, it might be a bug.

prb28 commented 7 months ago

@cobour on linux, modifying line 150 of src/fpp_native.cpp from

elif defined(GNUC) && 0

to

elif defined(GNUC)

fixes a segfault. I do not know if it is the case on macos.

cobour commented 7 months ago

@prb28 @grahambates I tried the small change in app_native.cpp, but it does not solve the error.

Looking further I recognized that the fs-uae that is shipped with the extension uses SDL2 v2.0.0 (see "full_error_log.txt" and VSCode-extension folder) and that the error occurs during some SDL2 setup code.

Maybe an upgrade to the last stable SDL2 version (v2.23.0) could help.

prb28 commented 7 months ago

Maybe an upgrade to the last stable SDL2 version (v2.23.0) could help. It depends on where is the crash, you'll know only with the debugger.

cobour commented 5 months ago

Currently I am using v1.8.7 of the extension, but I've replaced the dist/bin/fs-uae folder with the on from v1.8.2 This is working for me on macOS Sonoma 14.4 on Intel. Running and debugging works. Every fs-uae binary of extension versions greater than v1.8.2 do not work (after chmod to make them executable).

Can I help in any way to fix this? I've never debugged fs-uae itself though and I have currently no env to do so.

SvenSchneiderDVAG commented 5 months ago

Updated the extension to pre-release version v.1.8.7 on macOS Sonoma 14.4.1 (Mac Silicon) and it worked out of the box!

Before I had to revert to version 1.8.2 because of [EMU] No suitable emulator binary error.

And with version 1.8.6 I've got the "Cannot read properties of undefined (reading 'on')" error. fs-uae didn't start.

So I guess you guys fixed it!? :)

Edit: Proof image

image

image

prb28 commented 5 months ago

This is weird, I thought there was still something wrong. @grahambates what is your opinion ?

cobour commented 5 months ago

@prb28 @grahambates

I can now confirm that this combination works for me too: macOS Sonoma 14.4.1 (Intel CPU) VSCode 1.87.2 Amiga Assembly 1.8.7

Long story: With the noted config, FS-UAE won't start from launch in VSCode. When called from Terminal it crashed and gave me the crash log. I checked the crash log in detail and found out, that SDL is crashing while initializing the Joystick (connected via USB). After disconnecting the joystick, FS-UAE starts from Terminal and from VSCode launch. Debugging works as expected after unchecking the "All Exceptions" checkbox.

Sorry for the trouble...