hackwaly / ocamlearlybird

OCaml debug adapter
MIT License
208 stars 23 forks source link

Unsupported file format error #33

Open NanaKay007 opened 2 years ago

NanaKay007 commented 2 years ago

Anytime I run the extension, I get this un-informative error "Unsupported file format". This is my launch.json file:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Ocamlearlybird",
            "type": "ocamlearlybird",
            "request": "launch",
            "program": "${workspaceRoot}/_build/default/src/main/main.exe",
            "console": "integratedTerminal",
            "cwd": "${workspaceRoot}",
            "arguments": ["${workspaceRoot}/src/tests/test_code/parser.mly"],
            "dotMerlins": [
                "${workspaceRoot}/.merlin"
            ],
            "noDebug": false,
            "stopOnEntry": false
        }
    ]
}
hackwaly commented 2 years ago

What's the version of your ocaml compiler?

sean78901 commented 2 years ago

There are two sections to this comment.

(1) When I run Ocamlearlybird, I get a "unsupported file format" error. This is how I get the error - I enter into VS Code a hello world program - print_string "Hello world!\n";; I click "Run without Debugging". Under "Select Environment" (pull down menu), I select Ocamlearlybird. I get the "Unsupported file format" error.

(2) When I launch a terminal and type in the following commands - $ ocamlc -o helloworld helloworld.ml # to compile 'helloworld.ml' into an executable 'helloworld' $ ./helloworld # to run the program , I successfully get a "Hello world! output.

Question - I would like to use the first method (clicking on "Run without Debugging") to get the "Hello world!" output. What must I do?

hackwaly commented 2 years ago

The debuggee program should be bytecode file. Native executable is not supported. And currently only ocaml.4.10 4.11 is supported

wangnianwu commented 2 years ago

bytecode

how to provide bytecode file in this case.

retato-snu commented 1 year ago

I have same problem. I followed the example [https://i.imgur.com/U3GDHXM.gif], but get "Unsupported file format".

I test with Ocaml Version 4.14.0 and 5.0.0 and get same problem. What should I do?

hackwaly commented 1 year ago

You need install the ext built from master branch

retato-snu commented 1 year ago

You need install the ext built from master branch

I clone this repo and install with "opam install .". If I command ocamlearlybird --help, I can get Ocamlearybird Manual. Anything more to do?

sim642 commented 1 year ago

Right now you also need to build the VSCode extension yourself. The one published on VSCode marketplace isn't compatible with newer OCaml versions.

sim642 commented 1 year ago

By the way, I'm planning to revive the effort to simply make the official VSCode OCaml Platform extension take care of that side: https://github.com/ocamllabs/vscode-ocaml-platform/issues/534 and https://github.com/ocamllabs/vscode-ocaml-platform/pull/650. This should make the process more user-friendly.

retato-snu commented 1 year ago

Right now you also need to build the VSCode extension yourself. The one published on VSCode marketplace isn't compatible with newer OCaml versions.

It works well. Thank you so much. I look forward to being added to the offical OCaml Platform extension.