How can I install using cargo when offline? - installation

I want to use bat and lsd in my work area.
But my company's Centos 6 Linux server is disconnected from the internet for security.
But we can do it that is install something that is helping to work.
> cargo install --locked bat
Updating crates.io index
warning: spurious network error (2 tries remaining): failed to resolve address for github.com: Temporary failure in name resolution; class=Net (12)
warning: spurious network error (1 tries remaining): failed to resolve address for github.com: Temporary failure in name resolution; class=Net (12)
error: failed to fetch `https://github.com/rust-lang/crates.io-index`
Caused by:
failed to resolve address for github.com: Temporary failure in name resolution; class=Net (12)
How can I do that?

The directions below aren't much different for any other crate.
Download the repository:
git clone https://github.com/sharkdp/bat.git --depth 1 --branch v0.18.1
cd bat
This just gets the 0.18.1 version of the bat crate.
Use cargo vendor to download and bundle up the package's dependencies on the local machine:
cargo vendor
optionally specify a toolchain if different than the other machine (i.e. cargo +<TOOLCHAIN> vendor)
optionally specify a target if different than the other machine (i.e. cargo vendor --target <TARGET>)
Be sure to follow the directions at the end to create/add to the .cargo/config.toml file. You can also inspect all the dependencies that are now in the vendor/ directory.
Zip up and transfer the whole current directory to the other machine.
Use cargo install to install it:
cargo install --offline --path <PATH>
use --path to tell it the directory to install from
use --offline to prevent it from accessing the network for any reason

Related

Getting error while running mediapipe on macOS; Building C++ command-line example apps

I am trying to use mediapipe for a university project and have installed it, even successfully ran the Hello World! in C++ example app but when I am trying to build the C++ command-line example, it is giving me errors.
I ran this:
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu
and the result I got is this:
DEBUG: /private/var/tmp/_bazel_kanzashaikh/c191ae13e9137350b50f6a19ce94bf21/external/rules_foreign_cc/workspace_definitions.bzl:15:10: WARNING: This branch is deprecated and no longer recieving updates. Please update to main or choose a specific commit to pin in your workspace.
INFO: Build option --compilation_mode has changed, discarding analysis cache.
ERROR: Error fetching repository: java.io.IOException: The repository's path is "/usr/local/opt/opencv#3" (absolute: "/usr/local/opt/opencv#3") but this directory does not exist.
ERROR: /Users/kanzashaikh/development/mediapipe/third_party/BUILD:178:6: //third_party:opencv_binary depends on #macos_opencv//:opencv in repository #macos_opencv which failed to fetch. no such package '#macos_opencv//': The repository's path is "/usr/local/opt/opencv#3" (absolute: "/usr/local/opt/opencv#3") but this directory does not exist.
ERROR: Analysis of target '//mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.194s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 237 targets co
nfigured)
How do I solve it?
before building desktop examples, you should setup opencv. also for android examples you should setup android sdk and ndk.
there is a builtin script for setting up opencv and you can execute it.
for setting up opencv:
bash setup_opencv.sh
and for android sdk and ndk:
bash setup_android_sdk_and_ndk.sh
I am assuming you are running a M1 machine, as Homebrew is now installing Intel binaries under /usr/local and ARM ones under /opt/homebrew.
In your case, when building, bazel is looking for opencv#3 package at /usr/local/opt/opencv#3 and immediately throws an error as the package is located at /opt/homebrew/opt/opencv#3.
Thus, you have two choices:
Open WORKSPACE file from your bazel project and modify the path for each package accordingly
Make a symbolic link to /opt/homebrew/opt in /usr/local by running: sudo ln -s /opt/homebrew/opt opt

How to fix library dependence in a conan package

I am trying to install qt/5.14.2 with conan.
Using
qt/5.14.2#bincrafters/stable
I receive
ERROR: libpq/11.5: Error in package_info() method, line 211
self.cpp_info.components["pq"].requires.append("zlib::zlib")
AttributeError: 'Component' object has no attribute 'requires'
OK, there is a bug in libpq/11.5
I am trying to downgrade to
libpq/11.4#bincrafters/stable
ERROR: Conflict in qt/5.14.2#bincrafters/stable:
'qt/5.14.2#bincrafters/stable' requires 'zlib/1.2.11' while 'libpq/11.4#bincrafters/stable' requires 'zlib/1.2.11#conan/stable'.
To fix this conflict you need to override the package 'zlib' in your root package.
BTW:
Why is it not enough to require the correct version of the library, and requiring the same repository? (and require two different repositories in two different packages for the same dependence)
OK, I attempted
zlib/1.2.11#bincrafters/stable
WARN: libpq/11.4#bincrafters/stable: requirement zlib/1.2.11#conan/stable overridden by your conanfile to zlib/1.2.11#bincrafters/stable
zlib/1.2.11#bincrafters/stable: Not found in local cache, looking in remotes...
zlib/1.2.11#bincrafters/stable: Trying with 'conan-center'...
zlib/1.2.11#bincrafters/stable: Trying with 'minres'...
zlib/1.2.11#bincrafters/stable: Trying with 'bincrafters'...
ERROR: Failed requirement 'zlib/1.2.11#bincrafters/stable' from 'libpq/11.4#bincrafters/stable'
ERROR: Unable to find 'zlib/1.2.11#bincrafters/stable' in remotes
Finally, I arrived at
libpq/11.4#bincrafters/stable
zlib/1.2.11#conan/stable
qt/5.14.2#bincrafters/stable
After this, it looks like it was oK:
Installing (downloading, building) binaries...
qt/5.14.2#bincrafters/stable: Retrieving package 93c70de10405da9f2d5a1f42b8c299ca7af869d2 from remote 'bincrafters'
Downloading conanmanifest.txt
Downloading conaninfo.txt
Downloading conan_package.tgz
....qt/5.14.2#bincrafters/stable: Package installed 93c70de10405da9f2d5a1f42b8c299ca7af869d2
qt/5.14.2#bincrafters/stable: Downloaded package revision 0
However, the install fails with
CMake was unable to find Qt5, put qmake in your path or set
QTDIR/QT_QMAKE_EXECUTABLE.
The package is downloaded, I see all components in the corresponding subdirectory in my home directory. However, unlike the other components, it is not installed, before CMake attempts to find it.
What do I wrong?
In case of any strange behavior of conan, upgrade! For me, switch 1.24.0 -> 1.28.1 with configs clean up fixed the same problem with libpq/11.5

warning: cannot resolve "python2-audit", a dependency of "selinux-python2" - Arch linux

Following the guide here to install and use all needed utilities to use SELinux - https://wiki.archlinux.org/index.php/SELinux#Installing_SELinux and using the git repo, I get the following error:
warning: cannot resolve "python2-audit", a dependency of "selinux-python2"
:: The following package cannot be upgraded due to unresolvable dependencies:
selinux-python2
:: Do you want to skip the above package for this upgrade? [y/N]
error: failed to prepare transaction (could not satisfy dependencies)
:: unable to satisfy dependency 'python2-audit' required by selinux-python2
Error: the following command failed, sudo LANG=C pacman --noconfirm --ask=4 -U ./selinux-python/selinux-python2-2.9-1-x86_64.pkg.tar.xz ./selinux-python/selinux-python-2.9-1-x86_64.pkg.tar.xz
while running ./build_and_install_all.sh
I have the core repo enabled, and have tried refreshing the db repeatedly
Why is it saying that python2-audit is not available, when the wiki says it is available in the core repo?
And unless I can somehow get it installed, can I and how do I bypass that requirement?

Stack and git are incompatible in Windows 7?

I have been using Stack for dependencies management and building system for Haskell programs in Windows 7 Pro without problems.
stack --version
Version 1.3.2, Git revision 3f675146590da4f3edf768b89355f798229da2a5 x86_64 hpack-0.15.0
I have recently installed git for Windows, and Stack cannot download lts files anymore. It seems that Stack is trying using the new git client instead of the internal one.
git --version
git version 2.13.3.windows.1
The error I get when I try to create a new project is the following:
C:\proj>stack new newProject
Downloading template "new-template" to create project "newProject" in newProject\ ...
Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- newProject\newProject.cabal
Selecting the best among 11 snapshots...
Fetching package index ...fatal: Not a git repository: '.git'
Process exited with ExitFailure 128: C:\dev\git\apps\Git\cmd\git.EXE --git-dir=.git fetch --tags
Failed to fetch package index, retrying.
removeDirectoryRecursive: permission denied (Acceso denegado.)
If I rename the directory where git is installed, Stack works again. But that is not a real solution.
Any help will be apreciated

Why is /var/lib/dpkg/status missing on a BitBake-generated OS?

I have installed apt onto a system built by BitBake by adding the apt package to the IMAGE_INSTALL variable in my recipe.
apt-get and apt-cache now execute on the built system, but if I try to do anything useful with them (such as apt-get update or apt-cache search), I get the following error:
E: Could not open file /var/lib/dpkg/status - open (2: No such file or directory)
E: The package lists or status file could not be parsed or opened
After some preliminary searching, I found this exchange on the Yocto Project mailing list:
Hi,
I have some requirement with apt-get in yocto genearted rootfs.
I built the yocto source code with enabling the apt package.
But after booting the image on my machine and run the "apt-get" command for installing some package it gives the following error.
Could not open the file /var/lib/dpkg/status open(2: no such a file or directory).
The package lists or status files could not be parsed or opened.
This error is because you need to add package-management to EXTRA_IMAGE_FEATURES in local.conf,
PACKAGE_CLASSES ?= "package_deb"
EXTRA_IMAGE_FEATURES = "debug-tweaks package-management"
I've added package-management but don't see any different output.
After a touch /var/lib/dpkg/status, apt-get update returns the following:
Reading package lists...Done
How can I get apt into a functioning state through the use of BitBake metadata?
I have found a similar thread from the NXP website.
You would need to set up your own web server and provide all those packages and add the server URL to the source list. SourceList
In addition, you have to update the package manifest by running bitbake package-index and add PACKAGE_CLASSES ?= " package_deb" to conf/local.conf
I have successfully set up OPKG before. The steps are similar, you can find it here

Resources