Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility Challenges with Zig Language Extras on Windows 10 LTSC Using MinGW-W64 and Scoop and Ubuntu 23.10 #5

Closed
punowo opened this issue Dec 23, 2023 · 7 comments

Comments

@punowo
Copy link

punowo commented Dec 23, 2023

Hello. First of all thank you for this extension. I've wanted something like this for a while. ziglang/vscode-zig#158

I'm having some trouble getting this to work and this might be due to my somewhat unorthodox setup, I say this because from what I've seen most people just use msvc on Windows.

I am on Windows 10 LTSC and I pull mingw-winlibs-llvm-ucrt-mcf ( gcc, gdb ), zig and zls from scoop ( https://scoop.sh/ ). With C/C++ I just use handle everything through the cmake vscode plugin which has the ability to initialize projects, debug cmake files and even Cmake: Debug which just works no matter what OS I'm on as long as there a C/C++ compiler present.

PS C:\Users\pun> gcc --version
gcc.exe (MinGW-W64 x86_64-ucrt-mcf-seh, built by Brecht Sanders) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

PS C:\Users\pun> gdb --version
GNU gdb (GDB for MinGW-W64 x86_64, built by Brecht Sanders) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

PS C:\Users\pun> zig version
0.11.0

I've made a simple hello type test project.

folder_structure

Here are the results for each respective "zig-language-extras.debugType" option:

cppvsdbg

cppvsdbg

gdb

gdb

lldb

lldb

I can getting working by having the project name be main with the default option for win32, cppvsdbg.

works

@ianic
Copy link
Owner

ianic commented Dec 23, 2023

Uf, Windows... never tried it there.

Please look at #3 where @Niakr1s introduced Windows support.
Maybe you can set 'zig-language-extras.debugType' to your debugger.

Ooo, sorry, just saw that you already tried various debugTypes.

@ianic
Copy link
Owner

ianic commented Dec 23, 2023

Can you manually build launch config, this is what extension does.
Then start with launch config from extensions and then tweak it to work with different debuggers.

binPath can be found in extension output.

@punowo
Copy link
Author

punowo commented Dec 23, 2023

I can manually build launch configs. I think the problem is how the binPath is generated.

let binName = path.parse(fileNameRelative).name;

I say this because I've tried debugging the extension and it never enters that if unless you use .base instead of .name.

works

Now, I know practically nothing about Zig ( still learning ) and this is the first time I've tried to debug a vscode extension but what happens when you try to start Zig Extras: Debug Binary from a file that is not main.zig but has something that is called / required in main.zig ?

@punowo
Copy link
Author

punowo commented Dec 25, 2023

Hi. I'm having the same problem on Ubuntu 23.10.

Screenshot from 2023-12-25 16-24-37

Screenshot from 2023-12-25 16-24-57

I do believe at this point there's something wrong with how the binary path is constructed. Is anyone else having this problem ?

@punowo punowo changed the title Compatibility Challenges with Zig Language Extras on Windows 10 LTSC Using MinGW-W64 and Scoop Compatibility Challenges with Zig Language Extras on Windows 10 LTSC Using MinGW-W64 and Scoop and Ubuntu 23.10 Dec 25, 2023
@punowo
Copy link
Author

punowo commented Dec 27, 2023

Hi. I made a pull request that solves the problem I am facing but I don't know if it's exactly what is needed. Despite the formatting changes I only added two functions at the top and changed the how binary path is generated inside the "Debug Binary" part of the code.

#6

@ianic
Copy link
Owner

ianic commented Dec 31, 2023

Thanks for your effort in bringing this up.

When debugging binary, extension tries to decide on binary name in zig-out/bin folder. That should be name of the file or for main.zig name of the parent folder (skipping src). I found a problem in that logic.

Could you please try with the latest 0.62 version.

@punowo
Copy link
Author

punowo commented Dec 31, 2023

I don't have access to my windows machine but I'm pretty sure you can close this. The problem is fixed for me on my Ubuntu 23.10 machine. Thanks for the update.

@ianic ianic closed this as completed Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants