hackwaly / ocamlearlybird

OCaml debug adapter
MIT License
208 stars 23 forks source link

Doesn't run anything: Ubuntu/VSCodium/latest software #30

Closed atagunov closed 3 years ago

atagunov commented 3 years ago

Hi,

hate to bother.. got a tiny toy project (zip) on Ubuntu 20.04, latest compiler (4.11.1), VSCodium 1.53.2 via a snap, OCaml Platform version 1.6.0 installed. I did

sudo apt-get install nodejs
sudo apt-get install npm
sudo npm install -g vsce

git clone https://github.com/hackwaly/ocamlearlybird.git
cd ocamlearlybird
opam install .

cd integrations/vscode/
vsce package

Installed the resulting ocamlearlybird-1.0.1.vsix into VSCodium, made launch.js look like this

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "try debug",
            "type": "ocamlearlybird",
            "request": "launch",
            "program": "${workspaceRoot}/_build/default/proj1.bc",
            "stopOnEntry": true,
            "yieldSteps": 4096,
            "onlyDebugGlob": "<${workspaceRoot}/_build/default/**/*>",
            "cwd": "${workspaceRoot}"
        }
    ]
}

When I try to launch debugger for this configuration blue progress line runs for 5-10 seconds but nothing happens. In particular I don't see this /usr/bin/env CAML_DEBUG_SOCKET=127.0.0.1:... ... printed to my TERMINAL and there is no output from my app anywhere neither in OUTPUT nor in TERMINAL.. At the same time if I open the terminal in VSCodium these work

$ which ocamlearlybird
/home/username/.opam/dev/bin/ocamlearlybird
$ _build/default/proj1.bc
Hello, world 42 42!
Hello, world 42 42!
Hello, world 42 42!

I have placed breakpoints into source code that doesn't help either.. It seems like the app is not launched at all.. Can't find anything relevant int he VSCodium logs either..

My ~/.profile doesn't include eval $(opam env) but I tried doing eval $(opam env) and then launching codium from the same terminal - that didn't help. All relevant libraries are installed in dev opam switch which I have made my default switch via opam switch dev for the purpose of debugging this issue. Normally I expected the dev switch to be activated by ocamllabs.ocaml-platform extension via this fragment in .vscode/settings.json in my project:

{
    "ocaml.sandbox": {
        "kind": "opam",
        "switch": "dev"
    },

but as I say for now this is my default switch which I can confirm by looking at my ~/.opam/config.

hackwaly commented 3 years ago

I think you made right reasoning. Try hard code your ocamlearlybird path in debug.js and then repackage the extension and try.

atagunov commented 3 years ago

I think you made right reasoning. Try hard code your ocamlearlybird path in debug.js and then repackage the extension and try.

Thanks a lot for getting back to me on this.

I have added eval $(opam env) to my ~/.profile and rebooted my computer. I can confirm that ocamlearlybird is now on my $PATH in a regular terminal.

I have also edited debug.js, re-run vsce package, uninstalled hackwaly.ocamlearlybird extension, closed VSCodium, deleted ~/.vscode-oss/extensions/hackwaly.ocamlearlybird-1.0.1 folder, started VSCodium, re-installed extension from the new ocamlearlybird-1.0.1.vsix, confirmed that ~/.vscode-oss/extensions/hackwaly.ocamlearlybird-1.0.1/debug.js now looks like this:

const child_process = require('child_process');

child_process.spawn('/home/username/.opam/dev/bin/ocamlearlybird', ['debug'], {
  stdio: ['inherit', 'inherit', 'inherit']
});

I am afraid this didn't help.. I'm still seeing the same behaviour: blue progress line runs for 5-10 seconds at top-left of my VSCodium window and then nothing happens. I still don't see /usr/bin/env CAML_DEBUG_SOCKET=127.0.0.1:... ... anywhere nor do I see the output from my toy program.

hackwaly commented 3 years ago

That's wired. I didn't tested it under linux, nor codium. But I tested it in WSL. It runs very well. Could you please upload your toy project onto some place such as github repo?

atagunov commented 3 years ago

That's wired. I didn't tested it under linux, nor codium.

I very seriously hoped codium would behave identically to code.. OCaml Platform and Haskell seem to work My feeling is that Linux may be a bigger difference between the environments we're trying to make it run in

Could you please upload your toy project onto some place such as github repo?

I've actually uploaded a tiny zip I hope it's as good as a project on github

hackwaly commented 3 years ago

Sorry, I missed it.

atagunov commented 3 years ago

I was hoping some extra logging could be inserted somewhere to make things clearer.. If you ever feel like adding extra logging statements and perhaps committing to a new branch in your github repo I will be happy to give it a go. I guess I will also need advice on which log file to look into/to send to you - there seems to be a lot of them

hackwaly commented 3 years ago

If you ever feel like adding extra logging statements and perhaps committing to a new branch in your github repo I will be happy to give it a go

Great idea! You are welcome. BTW. There's log mechanics. But only in OCaml side and not densely.

atagunov commented 3 years ago

Maybe I had phrased my message badly.. What I wanted to say is:

I suggested that if you didn't want to clog the master branch you could push the logging onto a new branch in your project on Github. If you do that I will be happy to checkout the new branch, build and try. I will also be happy to report back on the results and send the relevant logs if necessary. I don't know which log to send because there are so many but I think we can work it out.

I wish I could do this myself, however I'm still a total noob in all of OCaml, VSCode and nodejs, and.. well there are so many things to learn :)

hackwaly commented 3 years ago

Currently I have not enough time to do this because I have no desktop linux environment. And the financial support from ocaml-sf has been suspended for a while. I can't spend much time as I have another jobs to do.

hackwaly commented 3 years ago

Some users of ocamlearlybird maybe use linux too. Maybe they can help you.

hackwaly commented 3 years ago

@atagunov I have setted up an Linux environment and did reproduce your problem. This issue is expected to be solved in this week. Before that, you can exec ocamlearlybird serve --verbosity=debug --port=4712 in terminal and add debugServer: 4712 to your launch configuration to use ocamlearlybird to debug your toy project.

atagunov commented 3 years ago

I have setted up an Linux environment and did reproduce your problem. This issue is expected to be solved in this week

:+1: happy to test on my machine once done

Before that ...

No big rush learning OCaml is a kind of a side-project for me

atagunov commented 3 years ago

I can confirm that latest version from git works for me on Ubuntu. Many thanks for fixing this!