toradex / vscode-torizon-templates

VS Code Torizon Integrated Development Environment Templates
MIT License
14 stars 20 forks source link

Rust dependencies not being installed correctly through apt #199

Closed andreriesco closed 3 months ago

andreriesco commented 3 months ago

Rust dependencies are not being installed correctly through apt, therefore they need to be installed through a installation script


Checking dependencies ...
πŸ‘ openssh-client debian package dependency installed
πŸ‘ sshpass debian package dependency installed
😡 cargo debian package dependency not installed
😡 rustc debian package dependency not installed
😡 rust-clippy debian package dependency not installed
😡 rust-lldb debian package dependency not installed
😡 rust-src debian package dependency not installed
😡 rust-gdb debian package dependency not installed
Try to install the missing debian packages and execute the missing installation scripts? <y/N>: y
[sudo] password for andreriesco: 
Hit:1 http://br.archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://br.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]                                                                                                                 
Hit:3 https://nvidia.github.io/libnvidia-container/stable/deb/amd64  InRelease                                                                                                             
Get:4 https://download.docker.com/linux/ubuntu jammy InRelease [48,8 kB]                                                                                                                   
Hit:5 http://br.archive.ubuntu.com/ubuntu jammy-backports InRelease                                                                                              
Hit:6 https://packages.microsoft.com/ubuntu/22.04/prod jammy InRelease                                       
Get:7 http://br.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1.678 kB]
Hit:8 https://packages.microsoft.com/repos/code stable InRelease               
Get:9 http://br.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1.074 kB]
Get:10 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]      
Get:11 http://br.archive.ubuntu.com/ubuntu jammy-updates/universe Translation-en [246 kB]   
Fetched 3.276 kB in 1s (2.767 kB/s)                                                               
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libssh2-1 libstd-rust-1.75 libstd-rust-dev rustc
Suggested packages:
  cargo-doc llvm-17 lld-17 clang-17
The following NEW packages will be installed:
  cargo libssh2-1 libstd-rust-1.75 libstd-rust-dev rustc
0 upgraded, 5 newly installed, 0 to remove and 9 not upgraded.
Need to get 98,2 MB of archives.
After this operation, 392 MB of additional disk space will be used.
Get:1 http://br.archive.ubuntu.com/ubuntu jammy/universe amd64 libssh2-1 amd64 1.10.0-3 [109 kB]
Get:2 http://br.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libstd-rust-1.75 amd64 1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04 [46,3 MB]
Get:3 http://br.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libstd-rust-dev amd64 1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04 [41,6 MB]
Get:4 http://br.archive.ubuntu.com/ubuntu jammy-updates/main amd64 rustc amd64 1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04 [3.404 kB]
Get:5 http://br.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 cargo amd64 1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04 [6.700 kB]
Fetched 98,2 MB in 3s (33,0 MB/s)
Selecting previously unselected package libssh2-1:amd64.
(Reading database ... 246902 files and directories currently installed.)
Preparing to unpack .../libssh2-1_1.10.0-3_amd64.deb ...
Unpacking libssh2-1:amd64 (1.10.0-3) ...
Selecting previously unselected package libstd-rust-1.75:amd64.
Preparing to unpack .../libstd-rust-1.75_1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04_amd64.deb ...
Unpacking libstd-rust-1.75:amd64 (1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04) ...
Selecting previously unselected package libstd-rust-dev:amd64.
Preparing to unpack .../libstd-rust-dev_1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04_amd64.deb ...
Unpacking libstd-rust-dev:amd64 (1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04) ...
Selecting previously unselected package rustc.
Preparing to unpack .../rustc_1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04_amd64.deb ...
Unpacking rustc (1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04) ...
Selecting previously unselected package cargo.
Preparing to unpack .../cargo_1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04_amd64.deb ...
Unpacking cargo (1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04) ...
Setting up libstd-rust-1.75:amd64 (1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04) ...
Setting up libstd-rust-dev:amd64 (1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04) ...
Setting up rustc (1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04) ...
Setting up libssh2-1:amd64 (1.10.0-3) ...
Setting up cargo (1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.7) ...
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
rustc is already the newest version (1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04).
rustc set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  rust-clippy
0 upgraded, 1 newly installed, 0 to remove and 9 not upgraded.
Need to get 2.695 kB of archives.
After this operation, 10,3 MB of additional disk space will be used.
Get:1 http://br.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 rust-clippy amd64 1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04 [2.695 kB]
Fetched 2.695 kB in 0s (12,1 MB/s)    
Selecting previously unselected package rust-clippy.
(Reading database ... 247037 files and directories currently installed.)
Preparing to unpack .../rust-clippy_1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04_amd64.deb ...
Unpacking rust-clippy (1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04) ...
Setting up rust-clippy (1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04) ...
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 rust-lldb : Depends: lldb-17 but it is not installable
             Depends: python3-lldb-17 but it is not installable
E: Unable to correct problems, you have held broken packages.
❌ error trying to install package rust-lldb

 *  The terminal process "pwsh '-nop', '/home/andreriesco/Documents/IDE2.0/apollox/apollox-vscode/IDE2autoTests/autoTests-242-arm64-2024-05-15T19-08-19.590Z/autoTestrustSlint/.conf/checkDeps.ps1'" terminated with exit code: 69. 
 *  Terminal will be reused by tasks, press any key to close it. 
``
andreriesco commented 3 months ago

On a post in the Ubuntu website it is recommended to install Rust on Ubuntu through rustup, with this commands:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup toolchain install stable
andreriesco commented 3 months ago

@tronical perhaps you can help me here. What would you say is the proper way to install the Rust packages that the rustSlint template depends on?

    "packages": [
        "openssh-client",
        "sshpass",
        "cargo",
        "rustc",
        "rust-clippy",
        "rust-lldb",
        "rust-src",
        "rust-gdb"
    ]
andreriesco commented 3 months ago

Or if they should be installed through apt what extra steps are needed, like adding a source for example. So the installation of this packages can be changed to an installation script, like is being done for the .NET SDK packages for examples

tronical commented 3 months ago

I would advise against installing Rust from distro packages. For rustSlint we take it from the slint-sdk container, packaged here:

https://github.com/slint-ui/Containerfiles/blob/fd25741667722fc49959f729889c53c487bfbcf5/slint-sdk/Containerfile#L59

(so rustup)

andreriesco commented 3 months ago

Can this slint-sdk container also be used to build x86 code to run on the host OS, for local debugging? Right now, for the local debugging on the host OS, the code is being built natively on the host, by this task. This is the way the code is built for local debugging on all templates, but if for the Rust Slint is complex to set the build environment on the host and if there is a slint-sdk container that can be used to build x86 code, maybe we can change this for the Rust Slint template and start building the code in the slint-sdk x86 container.

tronical commented 3 months ago

In theory it can be used for x86-64 builds. In practice a proper local build will be faster and give an overall much better development experience. Slint is cross-platform, so for example the local builds also work on macOS and Windows - as opposed to the docker Linux approach.

andreriesco commented 3 months ago

@tronical I tried installing Rust using the following script, as described in the Rust Get Started, and with that the Local Debugging on the rustSlint template seem to have worked. Are the dependencies installed through this script enough for the proper template compilation and runtime on the host OS or there is something extra that needs to be installed or configured?

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
tronical commented 3 months ago

Hi, yes, that should about cover it. On Windows I think you also need the MSVC build tools, Xcode on macOS. The typical dev setup.