I have followed esp-idf guideline to install and test to build the hello world and blink sample code but both the code met this problem.
Visual studio try to build hello world
> Executing task: ninja <
ninja: error: loading 'build.ninja': The system cannot find the file specified.
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command ninja " terminated with exit code: 1.
I have tested all the ways I can find to fix it but I'm not sure anything I missed or not.
This is one of the way that I test but also met some problem.
cmd try to run the command below
C:\Espressif\frameworks\esp-idf-v4.4>python -m pip install --user -r %IDF_PATH%/requirements.txt
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
This possible problem is the python environment is exist so I cannot do this command, but I try many ways to disabled or deactivated it still cannot.
python path
system environment
After trying to debug this for a long time, I made a backup copy of the entire project folder, then just went hog-wild deleting files. I deleted almost every file I didn't author. Only left the main/CMakeLists.txt, main/component.mk, main/main.c, main/main.h, .gitignore, CMakeLists.txt, and Makefile. Then I ran idf.py set-target esp32 and idf.py -p /dev/ttyACM0 flash monitor and it worked fine again.
VS Code & ESP-IDF on Ubuntu 20.04.05 LTS
Check if the compiler is properly selected. If you don't select a proper c/c++ compiler, then you might get this error. I had mingw in my system, but vs code did not auto detect the compiler. Then I manually added mingw and selected it for compilation after which this issue was resolved.
What worked for me after updating to the new stable release (v5.0) was
Go to the folder S:\esp\esp-idf\esp-idf-v5.0
Run command prompt at this directory and execute install.bat and later export.bat
After trying to build the program in VSCode the error "ninja: error: loading 'build.ninja'" shows up.
Update the path in the ESP-IDF extension in VSCode using ESP-IDF:Configure Paths
locate your project folder e.g. "V:\simpleTest_using_EspIDF_v5_0"
Open command prompt and execute: idf.py build
Now it builds also in VSCode using the Espressif IDF extension.
You not have a build.ninja file. Find this file on proje
I have a problem with building an application file (*.exe) on windows. I create a simple project and run on QtCreator the result is:
It hasn't any error and warning. After that, I build it with release using kit is Desktop Qt 5.12.1 MSVC2017 64-bit, I got a folder release after rebuild with qmlTest.exe
To continues, I deploy it to follow this link
Deployment Qt apps on Windows
I got some files into the release file of my project
But when I click on qmlTest.exe nothing appears, no error, no missing dll files notifications. I checked process task and no qmlTest was running.
Who can tell me what I was wrong?
Thanks for your kind help!
You are missing some folders & files like QtQml and QtQuick etc..
Qt has a tool called "windeployqt.exe" to do exactly this.
It is used from the Console like this:
windeployqt.exe --dir PATH_TO_DEPLOY --compiler-runtime --release --qmldir PATH_TO_QML MY_EXE
PATH_TO_DEPLOY: an empty folder where you would like the dependencies to be copied
PATH_TO_QML: the folder where you have your qml files
MY_EXE: path to your executable
So in your case, it would look something like this:
C:\Qt\5.12.1\msvc2017_64\bin\windeployqt.exe --dir C:\Users\...\Desktop\deployFolder --compiler-runtime --release --qmldir C:\Users\...\Desktop\QmlTest\qml C:\Users\...\Desktop\build-qmlTest-Desktop_Qt...-Release\release\qmlTest.exe
After running the tool, all the files you need will be in the deployFolder. You just have to copy the executable from the release folder and you're done.
More infos can be found here: https://doc.qt.io/qt-5/windows-deployment.html
I normally use Qt creator with cmake to program C++ projects. Lately I read quite a bit about meson and it's simplicity and I like to test it. This example explains how to setup meson.
When using meson, I like however to still use Qt creators shortcuts for building (ctrl + B) or running (ctrl + R). How can I configure Qt creator to build a meson project, when I'm using a "generic project"?
Meson is currently not directly supported by Qt Creator. There is a bug report requesting that: https://bugreports.qt.io/browse/QTCREATORBUG-18117 and I am considering to actually implement that.
For the time being I use meson via the "Generic Project". Go to "New File or Project", "Import Project" and there "Import Existing Project". That gets you a dialog where you can select the files that your project consists of.
After that is done you will need to edit "projectname.includes" and add the include directories (one per line) into that file. Then you need to edit "projectname.config" and add defines (one per line) there.
Finally you will need to edit the build configuration and call ninja instead of make there.
With that it works reasonably well for my small project.
Until the QtCreator supports directly meson.build project files, I find this python2 script useful to create QtCreator generic project files: https://github.com/mbitsnbites/meson2ide
with meson and ninja in your PATH, this should work:
$ meson builddir
$ python2 meson2ide.py builddir
this generates a .creator project file in builddir (if you get an error about "mesonintrospect" not found, try this PR: https://github.com/mbitsnbites/meson2ide/pull/1)
To make CTRL+B work properly, In QtCreator build settings, remove the make build step and add a custom build step with the path to the ninja executable, and add the command line arguments
3>&1 1>&2 2>&3
Those redirect allow QtCreator to capture build errors in the "issue" panel.
I'm trying to build ruby on visual studio with zlib and I'm having problems with it.
I have prepared everything to build it but I don't know how to specify where the zlib library and headers are.
I have the source code in $(ProjectDir)/..
I am buildin in $(ProjectDir)/$(Platform)/$(Configuration)
I build with command line, and I have it like this
mkdir $(Platform)\$(Configuration)
cd $(Platform)\$(Configuration)\
..\..\..\win32\configure.bat --target=i386-mswin32 --prefix=$(ProjectDir)$(Platform)\$(Configuration)\bin
If I go to ext/zlib, I can execute
extconf.rb --with-zlib-lib=$(ProjectDir)..\..\zlib-1.2.8\zlib-1.2.8\$(Platform)\$(Configuration)\lib --with-zlib-include=$(ProjectDir)..\..\zlib-1.2.8
and creates the makefile correcly, but I don't know how to pass zlib lib
and include paths to the configuration script.
I have tried with
..\..\..\win32\configure.bat --target=i386-mswin32 --prefix=$(ProjectDir)$(Platform)\$(Configuration)\bin --with-zlib-lib=$(ProjectDir)..\..\zlib-1.2.8\zlib-1.2.8\$(Platform)\$(Configuration)\lib --with-zlib-include=$(ProjectDir)..\..\zlib-1.2.8
but that doesn't works
I suppose it has something to do with the '--with-ext="a,b,..."' option or with the "--path" that is specified in the help command, but I don't know how to specify it and the documentation is really bad.
I would be very gratefull if you could help me.
The instructions below are for Ruby 2.2.5 – if you want to build some other version or use different folder paths, change accordingly. I used these to successfully build Ruby 2.2.5 and 2.3.1 from source with zlib using VS2013 Community Update 5 on Windows 8.1 Pro x64.
Create folders:
C:\ruby-2.2.5\build
C:\ruby-2.2.5\src
Untar ruby-2.2.5.tar.gz and put the sources in C:\ruby-2.2.5\src
Unzip the zlib distribution archive (zlib128-dll.zip) into C:\zlib128-dll
Run Developer Command Prompt for VS2013, then run:
SET INCLUDE=%INCLUDE%;C:\zlib128-dll\include
SET LIB=%LIB%;C:\zlib128-dll\lib
SET PATH=%PATH%;C:\zlib128-dll
cd C:\ruby-2.2.5\build
..\src\win32\configure.bat
nmake
nmake DESTDIR=C:/ruby-2.2.5 install
Done. You should now have a fully working, zlib-enabled, Ruby build in C:\ruby-2.2.5\usr.
I was trying to get Rust to work on my Windows box. I followed the instructions, however when I tried hello world program, it spits the below. It looks like it has not been able to link up to gcc.. and I have gcc out there. Could someone help me figure out what is the issue here?
$ rustc foo.rs
error: linking with `gcc` failed: exit code: 1
note: gcc arguments: '-m32' '-LC:\Program Files (x86)\Rust\bin\rustlib\i686-pc-m
ingw32\lib' '-o' 'foo' 'foo.o' '-shared-libgcc' '-LC:\MinGW\msys\1.0\home\ENwank
wo\.rust' '-LC:\MinGW\msys\1.0\home\ENwankwo' 'C:\Program Files (x86)\Rust\bin\r
ustlib\i686-pc-mingw32\lib\libstd-3e5aeb83-0.9.rlib' 'C:\Program Files (x86)\Rus
t\bin\rustlib\i686-pc-mingw32\lib\libgreen-83b1c0e5-0.9.rlib' 'C:\Program Files
(x86)\Rust\bin\rustlib\i686-pc-mingw32\lib\librustuv-2ba3695a-0.9.rlib' '-lws2_3
2' '-lpsapi' '-liphlpapi' '-lmorestack'
note: gcc: fatal error: -fuse-linker-plugin, but liblto_plugin-0.dll not found
compilation terminated.
error: aborting due to previous error
task 'rustc' failed at 'explicit failure', C:\bot\slave\dist2-win\build\src\libs
yntax\diagnostic.rs:75
task '<main>' failed at 'explicit failure', C:\bot\slave\dist2-win\build\src\lib
rustc\lib.rs:453
This is how to install Rust on windows with Visual Studio Code and optionally MSYS2 MinGW
You can Instal Rust without installing "Microsoft C++ Build Tools". You can also use Rust with the gcc or clang tools from the MSYS2 suite.
I didn't want to install Rust on Windows with the required "Microsoft C++ Build Tools" because this would need too much disk space.
To get Microsoft C++ Build Tools on Windows you need to download a full Windows SDK which is very large (I think more than 4GB).
You can run and debug Rust programs without installing MSYS2.
If you want to use the gcc or clang compilers that are included in MSYS2 (you will need to install them in a separate step from the MSYS2 installation, using the version of the pacman package manager from MSYS2), then you can install MSYS2.
(MSYS2 also allows you build very easily, C++ programs inside Visual Studio Code with the C++ extensions installed, using the gcc or clang compilers).
The MSYS2 installation version needs 1.61 GB for MSYS2 ( The tools installed using mingw-w64-x86_64-toolchain occupy 1083.49 MiB of disk space out of the 1.61 for the total MSYS2 suite).
Rust installs about 1.46 GB of files - mostly in the "C:\Users\user\.rustup" folder when using the parameter "x86_64-pc-windows-gnu" (for a MSYS MinGW install).
Rust takes up 900 MB after installation, when using "x86_64-pc-windows-msvc" (for a "Microsoft C++ Build Tools" install).
For a better Rust experience inside VS Code it is recommended to install the rust-analyzer extension Online from the VS Code Marketplace, or instead of it, the Rust plugin from [Link1] below, at the bottom of the post.
All you have to do is:
Install Visual Studio Code
(Optional - Install MSYS2)
Install Rust
Install Pyton if you don't have it
Add the required folders to the PATH variable
Install rust-analyzer and CodellDB extensions inside VS Code
At the end of this guide you should be able to run and debug rust programs inside Visual Studio Code.
MSYS2 is optional, you can install it if you want to use the gcc or clang from the suite - after creating the cargo config file, the cargo build and cargo run commands will use msys64\mingw64\bin\clang++.exe (by default if both compilers are installed, or ..\msys64\mingw64\bin\gcc.exe if you set it up to do this).
Just follow the installation from Part 1 - below.
(This part is just for reference - it lists the files and folders required for setup and how I chose the installation directories - )
I installed the programs inside these folders:
D:\Applications\msys64
D:\Applications\VSCode
rustup-init.exe installs the .cargo folder in the default location:
C:\Users\user\.cargo
( The settings files for VS Code are created and edited inside the Visual Studio Code editor, you don't need to open the files form windows explorer:
C:\Users\user\AppData\Roaming\Code\User\settings.json
C:\Users\user\AppData\Roaming\Code\User\keybindings.json
)
Part 1 - Installation Steps with Details:
I will use the code needed to run the installation programs inside "quotes" - remove the quotes when you run the commands.
For example: "pacman -Syu" - remove the quotes and just run pacman -Syu .
Change the paths in the tutorial, for your installations.
The programs needed are VS Code, MSYS2 (MSYS2 has files/tools from MinGW), the rust-analyzer extension for VS Code for code completion and the CodeLLDB extension (with the author Vadim Chugunov) for debugging.
Make sure to have the Windows Firewall setup to allow connections out for MSYS2, VS Code, the Rust installer - rustup-init.exe (maybe rustup later on - during this tutorial you don't need it) and D:\Applications\msys64\usr\bin\pacman.exe. This will allow the programs to download necessary files for components or plugins.
a)
Download Visual Studio Code portable version for Windows from filehorse.com and extract the files (or install it any way you like).
Open VS Code and disable the 2 telemetry options from the settings:
Click on Edit > Preferences > Settings, type telemetry in the input box and disble the 2 telemetry options (or press the key combo: Ctrl + Shift + P, type open settings and press Enter to open the 'settings.json' file)
this will put inside the "settings.json" file this code, between the main open and close curly braces:
"telemetry.enableCrashReporter": false,
"telemetry.enableTelemetry": false
Good fonts to use inside VS Code are: Fira Code, Consolas, DejaVu Sans Mono, Droid Sans Mono Slashed, Inconsolata-g, Bitstream Vera Sans Mono , Lucida Console, maybe Menlo Regular (was used in MacOS), Meslo LG DZ.
Fonts like 'Fira Code' have font ligatures present inside the font. 'Fire Code' doesn't have traditional font ligatures for example ft is not connected, but has ligatures specific for coding, for example the look of these character combinations are changed and usually look better with ligatures enabled: fl , -> , <= , >= . See the image below the post for an image with font ligatures on vs off.
To enable font ligatures, open the Preferences for Visual Studio Code, search for ligatures in the search box, and enable the setting: 'Editor:Font Ligatures' .
You can change the default user data directory from:
"C:\Users\user\AppData\Roaming\Code" to your desired location, e.g. :
"D:\Applications\VSCode\UserData\Code"
by creating a shortcut for VSCode with the parameter --user-data-dir, that you'll use to launch VS Code.
To do this create a shortcut for VSCode with the setting for Target: D:\Applications\VSCode\Code.exe --user-data-dir "D:\Applications\VSCode\UserData\Code"
b) This step is Optional, follow it only if you want to use gcc or clang from MSYS2:
You can run Rust programs and compile them in Visual Studio Code without installing MSYS2. Install MSYS2 only if you want to use its gcc or clang compiler.
Optional - Install MSYS2 - this is about 1.61 GB.
Download MSYS2 and follow the installation instructions - I will mention the most important steps:
Install MSYS2 and keep the checkbox selected: "run MSYS2 64bit" at the end of the installation.
Run pacman -Syu in the console that appears after the installation. This is the MSYS2 shell.
!!! For the next step, be careful an choose the right shortcut Don't choose the MinGW one, so
run the shortcut named "MSYS2 MSYS" from Start menu (it is "D:\Applications\msys64\msys2_shell.cmd -msys"). This is the MSYS2 shell.
Inside the shell run pacman -Su .
The next step is to download the programs needed to build the programs written in Rust, for the Windows Platform:
From the start menu run "MSYS2 MinGW 64-bit" (it is "D:\Applications\msys64\msys2_shell.cmd -mingw64"). This is for MinGW and it has a different parameter from the shortcut used above.
Run pacman -S mingw-w64-x86_64-toolchain.
Press Enter, Enter and type 'y' during the installation process.
( The guide on the msys2.org page said to also install some packages using the option '--needed base-devel' by runnig the command "pacman -S --needed base-devel mingw-w64-x86_64-toolchain", but I don't think they are needed here.
If you want, you can install single tools and their dependencies from the list of tools installed by the command "--needed base-devel", by selecting their corresponding number during the installation, for example you can just install make and not the rest of the tools present in the "--needed base-devel" package.
The simple rust "hello world" program that I wrote in rust using VS Code and the rustc and cargo tools/programs ran well without installing the "--needed base-devel" files.
The --needed base-devel files are not needed to run and debug simple Rust programs,but you can install them if you want.
To use the gcc or clang linker and compiler from MSYS2 you have to create the C:\Users\user\.cargo\config file:
To make the cargo use clang++.exe , add these lines to the C:\Users\user\.cargo\config file:
[target.x86_64-pc-windows-gnu]
linker = "D:\\Applications\\msys64\\mingw64\\bin\\clang++.exe"
ar = "D:\\Applications\\msys64\\mingw64\\bin\\llvm-ar.exe"
If you want to change the linker to gcc, create the C:\Users\user\.cargo\config file that contains the lines:
[target.x86_64-pc-windows-gnu]
linker = "D:\\Applications\\msys64\\mingw64\\bin\\gcc.exe"
ar = "D:\\Applications\\msys64\\mingw64\\bin\\ar.exe"
(clang++.exe is the same file as clang.exe from the same directory.)
I got everything installed and running well - I could run the programs and debug them using gcc or clang.
)
c)
Install Rust for Windows
Download the installer: rustup-init.exe from rust-lang.org
The browser should recognize that you ar using Windows and give you the link to "DOWNLOAD RUSTUP-INIT.EXE (64-BIT)" , that is:
[...]static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe
Run rustup-init.exe . It is better to launch a console with cmd.exe and launch rustup-init.exe from there.
choose "Continue? (y/N)" by typing y and hitting the Enter key.
choose "2) Customize installation" using the keyboard.
paste or type the option: x86_64-pc-windows-gnu .
Press enter for the rest of the options.
Finally type "1" as input in the console, then press Enter, to choose the option "1 to proceed" with the Current installation Options.
There might be problems if you had rustup already installed.
If you already have rustup installed follow the indications on the guide at Source 1 Link at the bottom of the page with the step-by-step-instruction-to-install-rust-and-cargo-for-mingw-with-msys2 :
This is a quote from that post:
"Note: If rustup is already installed, then rerunning rustup-init won't actually install the requested toolchain. Instead, run rustup toolchain install stable-x86_64-pc-windows-gnu if you already have the MSVC-based toolchain. Then run rustup default stable-x86_64-pc-windows-gnu to set the GNU-based toolchain as the default."
d) Add the folders to the PATH
Add the folders that have useful programs from rust and msys2 to the Windows system PATH variable:
Adding the folders to the system PATH variable will allow VS Conde console, which defaults to PowerShell (you can change it to Command Prompt or other shell if you want), to recognize the commands:
cargo, rustc, etc.
This will make running and debugging rust programs in VS Code with the rust-analyzer and CodeLLDB extensions easy because you don't have to configure anything else.
To add the folders to the PATH use the System Properties window:
Right click on "My Computer" and select "properties"
Click on Advanced System Settings
In the Advanced tab, click on "Environment Variables"
under 'User variables for user' click on the PATH Variable and add the locations of your cargo\bin folder and mingw64\bin folder, (plus \msys64):
;C:\Users\user\.cargo\bin;D:\Applications\msys64;D:\Applications\msys64\mingw64\bin
This will add the folders "C:\Users\user\.cargo\bin", "D:\Applications\msys64", "D:\Applications\msys64\mingw64\bin" to the PATH variable. (stackoverflow is bad at formatting \. backslash followed by a dot - you have to use another backslash as an escape character)
To test that the PATH variable is updated open a NEW Command Prompt or PowerShell window, and in this window run cargo --version or gcc --version (if you installed MSYS2 and gcc.exe) or rustc --version inside a 'Command Prompt' window and inside a PowerShell Window.
If the commands are not found, restart your computer so that Windows can update the PATH variable. For me the change worked without having to restart, I just had to open a new shell window.
e) Install the Rust extensions for VS Code
rust-analyzer and CodeLLDB require Python to be installed.
Install Python 3.6.3, for example, and select to add it to the path during installation.
From the VS Code Marketplace install the needed extensions.
Open VS Code, click on the Extensions button on the right toolbar, and search and install the extensions:
rust-analyzer - (publisher: matklad) ;
CodeLLDB (publisher: Vadim Chugunov);
( I didn't have to do this next step so you shouldn't either - if rust-analyzer doesn't load/run properly, you may need to install the rust source code.
Using the 'Command Prompt' run: rustup component add rust-src to install the rust Source Code.
I didn't have to install it, the rust-analyzer worked well [ by the way, the VS Code could connect to the internet during testing].
)
[While running Visual Studio Code you may get a message telling you to install .Net Framework 4.5.2. Download and install the Offline version if the online version fails to install. (On Windows 7 without some updates, you may have to download and install the certificate: MicRooCerAut2011_2011_03_22.crt, and install some windows updates: Windows6.1-KB2533623-x64, windows6.1-kb2813430-x64, and maybe Windows6.1-KB4019990-x64 ) ]
Part 2 - Running and Debugging Rust programs with VS Code
Running and compiling in Rust with VS Code and Msys2:
After adding the folders to the PATH and installing the extensions, you basically need to run:
cargo init
cargo run - to run the program.
press the F5 key, or click the debug button to debug the code.
First you need to:
Create a folder for your Rust app.
Open the folder inside VS Code.
Press Ctrl+{`} to open the terminal panel.
The default shell will be 'PowerShell'.
You can select the 'Command prompt' shell from the Terminal pane using the down arrow on the left, that is near the plus button and x button.
Or you can set VS Code to use 'Command Prompt' as the default shell by adding the lines to the 'settings.json' file - the main Visual Studio Settings file.
"terminal.integrated.defaultProfile.windows": "Command Prompt",
You can use PowerShell or 'Command Prompt', they both work fine.
Run cargo init inside the terminal to create the project files.
Edit the main.rs file if you want. It is located inside 'app folder'\src\main.rs
Run cargo run inside the terminal
If you have rust-analyzer installed, the extension puts 2 buttons as popups on top of the main() function.
They are named 'Run' and 'Debug' and if clicked they do what their names say.
To debug, put a breakpoint inside your main.rs file and hit F5 (the menu entry Run > Start Debugging) or click the Debug button on top of the main() function placed there by the rust-analyzer extension if you have it installed.
If you click the debug button you don't have to create a launch.json config file.
If you hit the F5 key or click the menu entry Run > Start Debugging, a launch.json file will be added to your folder.
Just click Yes in the message box to auto generate the launch.json file.
Then hit the F5 key again to start debugging.
Now you can step through your code during the debugging process.
Link 1: https://marketplace.visualstudio.com/items?itemName=rust-lang.rust
Link to Font Ligatures example - Image for the font 'Fira Code':
Image Link: Coding font with font ligatures
This question is old, but in the mean time a lot has changed.
The easiest way to install on Windows is to go to the Rust installation page and download and run rustup-init.exe. It installs rustc, rustup and similar tools. It just works™.