Closed hchargois closed 2 months ago
Please try this way:
To allow debugging inside VSCode you will also require a GDB extension or other suitable debugger. All the requirements, build and debug settings have been pre-configured in the .workspace file (simply open the project by doubleclick on this file).
Thanks for your help. I installed the extension (I didn't think it was necessary as I don't want to debug the program, I just want to run it). And VSCode does say that the workspace is "open".
But it doesn't change anything, I'm still unsure about what to do after opening the workspace, and if I try to click the "run" icon on the main.c, I still have the same error I posted above.
It works well for me on Linux, but I've tried on Windows with someone and I had the same issue. I still don't know what could be the problem.
@gcopoix, @danyyliu do you have any idea what could be the problem?
I checked what @hchargois written above, if I am taking it correctly, I think what @hchargois wants is: build and execute main program with vscode, instead of shell commands.
I think it should be done in this way:
Please let me know if I am take it correctly, @hchargois
Thank you for your help, adding the task and running it as you've shown works fine, the demo builds and runs correctly!
But I'm very confused... I'm not sure that's what I want? I mean, since that task was not provided already, this makes me think that it was not how I was supposed to use this project? So, I'm back to my very first question: what does this project do and how to use it?
Maybe it would help if I explain how I arrived at this point.
I came to this project because of the "Get Started" documentation:
https://lvgl.io/get-started -> "Set up a simulator" -> https://docs.lvgl.io/master/integration/ide/pc-simulator.html
This doc forces us to choose an IDE. I chose VScode as that's what I'm writing code with. And the doc says to "read the README" of the project. So I read the README of this project, but I don't see anything about how to use it. The "Usage" section only explains how to install dependencies, but not what to do after that, i.e. how to actually use the project.
BTW I would absolutely, 100% prefer NOT to use an IDE, and instead just run commands in a terminal myself. However the get started documentation doesn't offer this option; and I don't see any documentation about how to "get started" with the simulator & demos by just running commands in a terminal.
So, yeah, the "get started" doc promises "10 minutes" to set up a simulator, and I'm hours into this and I still don't know what to do :sweat_smile:
Well, it's clear that it's not a technical question, either a question I can answer. Maybe @kisvegabor can help us with this.
Hi, this project is meant as a VisualStudio Code project with configured workspace file, which
The process should be:
("All the requirements, build and debug settings have been pre-configured in the .workspace file (simply open the project by doubleclick on this file)"
"cmake.configureOnOpen": true
)
This can be later done manually too by selecting Ctrl+Shift+P and choosing CMake: Configureunspecified
and let cmake guess a suitable compiler
This can be later done manually too by selecting Ctrl+Shift+P and choosing CMake: Select a Kit
If building doesn't work, please make sure a Kit has been selected (only necessary once, VSCode keeps this configuration for the project folder)If this doesn't work, please try changing the tasks section to
// tasks.json section
"tasks": {
"version": "2.0.0",
"tasks": [
{
"type": "cmake",
"label": "Build",
"command": "build",
"group": "build",
"problemMatcher": [],
"detail": "CMake template build task"
},
],
},
Thanks for the detailed steps. Everything works fine.
Looking back at my first post, I now see that the "Debug LVGL demo with GDB" option was there all along. Had I clicked on it, I think it would have worked right off the bat. It's just unfortunate that VSCode adds 2 unrelated C/C++ tasks, which I guess are automatically added whenever it detects a C file, but these fail to build since they're not invoking the actual build system. And it even puts those tasks at the very top of the list. Even the "Detected task" mention may have made things even more confusing for me by making me believe these were "detected" in the workspace file.
I really think these steps (or at the very least the name of the task that we're expected to run) should be in the README in a usage section.
I guess I can close this ticket, thanks all for the help.
Based on your feedback I've updated the README. I've mentioned "Debug LVGL demo with gdb" and how to use it purely from the Terminal.
What do you think?
It's great! Especially having both options. Thanks.
BTW a few days ago I stumbled upon another project, https://github.com/lvgl/lv_port_linux After some tweaking of the lv_conf.h, of the build system and of the initialization functions, I was able to make it work with the SDL simulator backend instead of the default framebuffer. I see that it has been improved just a few hours ago to support the SDL backend out of the box simply by editing the lv_conf.h.
That is exactly the project I would have loved to see as the one true official way to "get started". Something simple that can be reliably configured and run with a few simple, documented commands, without having to worry about a complex IDE.
That is exactly the project I would have loved to see as the one true official way to "get started". Something simple that can be reliably configured and run with a few simple, documented commands, without having to worry about a complex IDE.
Oh, very nice! It's great that the change was useful! :blush:
I've just opened https://github.com/lvgl/lvgl/pull/6205 to mention lv_port_linux
as a simulator option.
Hi, I'm a bit confused about how to use this project.
The README has a "Usage" section but it only contains info about how to clone the project and install dependencies... What should we do after that?
I saw that there's a
CMakeLists.txt
file, so I rancmake .
, which created aMakefile
, so I then ranmake
, and that did create abin/main
binary which runs correctly. But I don't think this is how we're supposed to compile and run the project, right? We're supposed to build and run it from within VSCode I think.If I open VSCode by running
code simulator.code-workspace
, openmain/src/main.c
and click the "Run" icon, it asks me to select a "debug configuration":The first one seems alright, but if I click on it, the compilation within VSCode fails:
Is this the right way to do? Should this work? If not, what's the correct way to run the project from VSCode?