cargo install cargo-generate --features vendored-openssl failed - rust

I am trying to install terrain from terra-money. For that, the instructions said to follow the commands. I have run these instructions on ubuntu 20.04
1. Set 'stable' as the default release channel:
rustup default stable
# 2. Add WASM as the compilation target:
rustup target add wasm32-unknown-unknown
# 3. Install the following packages to generate the contract:
cargo install cargo-generate --features vendored-openssl
cargo install cargo-run-script
but when I run it, I am getting an error in the 3rd instruction. Can anyone please help
error: failed to run custom build command for `openssl-sys v0.9.72`
Caused by:
process didn't exit successfully: `/tmp/cargo-installLlewUy/release/build/openssl-sys-3aec6783a3bc6a31/build-script-main` (exit status: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_NO_VENDOR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_NO_VENDOR unset
cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
OPENSSL_NO_VENDOR unset
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running "perl" "./Configure" "--prefix=/tmp/cargo-installLlewUy/release/build/openssl-sys-d4c820e0a8c7c40f/out/openssl-build/install" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64"
Configuring OpenSSL version 1.1.1n (0x101010efL) for linux-x86_64
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile
**********************************************************************
*** ***
*** OpenSSL has been successfully configured ***
*** ***
*** If you encounter a problem while building, please open an ***
*** issue on GitHub <https://github.com/openssl/openssl/issues> ***
*** and include the output from the following command: ***
*** ***
*** perl configdata.pm --dump ***
*** ***
*** (If you are new to OpenSSL, you might want to consult the ***
*** 'Troubleshooting' section in the INSTALL file first) ***
*** ***
**********************************************************************
running "make" "depend"
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /home/raju/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-src-111.18.0+1.1.1n/src/lib.rs:477:39
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-generate v0.13.0`, intermediate artifacts can be found at `/tmp/cargo-installLlewUy`
Caused by:
build failed

I just stumbled across the same error. I checked the OpenSSL requirements as per INSTALL file:
OPENSSL INSTALLATION
--------------------
This document describes installation on all supported operating
systems (the Unix/Linux family (which includes Mac OS/X), OpenVMS,
and Windows).
To install OpenSSL, you will need:
* A make implementation
* Perl 5 with core modules (please read NOTES.PERL)
* The perl module Text::Template (please read NOTES.PERL)
* an ANSI C compiler
* a development environment in the form of development libraries and C
header files
* a supported operating system
I did not had perl installed, after installing it the build completed successfully.
I hope you are only missing this perl installation.

Related

How to Cross Compile a Rust application from Linux to Windows including the ring lib without docker

I wrote an application with Rust, which is working quite fine on Windows and Linux using cargo run and cargo build.
To have only one system capable of compiling for both targets x86_64-unknown-linux-gnu and x86_64-pc-windows-msvc I set up a Ubuntu 22.04 minimum server installation with these additional commands
apt update
apt upgrade -y
apt install curl build-essential gcc make -y
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > ~/rustup.sh
cd ~
chmod u+x rustup.sh
./rustup.sh -y
. ~/.cargo/env
rustup target add x86_64-unknown-linux-gnu --toolchain stable
rustup target add x86_64-pc-windows-msvc --toolchain stable
Then switching to the application directory
cargo build --release --target x86_64-unknown-linux-gnu
works fine and produces the artifact as expected. But
cargo build --release --target x86_64-pc-windows-msvc
failes with the error message
error: failed to run custom build command for `ring v0.16.20`
Caused by:
process didn't exit successfully: `/test/backend/target/release/build/ring-3857f585b2d049fe/build-script-build` (exit status: 101)
--- stdout
OPT_LEVEL = Some("3")
TARGET = Some("x86_64-pc-windows-msvc")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-pc-windows-msvc = None
CC_x86_64_pc_windows_msvc = None
TARGET_CC = None
CC = None
CROSS_COMPILE = None
CFLAGS_x86_64-pc-windows-msvc = None
CFLAGS_x86_64_pc_windows_msvc = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
--- stderr
running "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-m64" "-I" "include" "-Wall" "-Wextra" "/GS" "/Gy" "/EHsc" "/GR-" "/Zc:wchar_t" "/Zc:forScope" "/Zc:inline" "/Zc:rvalueCast" "/sdl" "/Wall" "/wd4127" "/wd4464" "/wd4514" "/wd4710" "/wd4711" "/wd4820" "/wd5045" "/Ox" "-DNDEBUG" "-c" "/Fo/test/backend/target/x86_64-pc-windows-msvc/release/build/ring-e02c6ae3738202e7/out/aes_nohw.obj" "crypto/fipsmodule/aes/aes_nohw.c"
cc: error: -E or -x required when input is from standard input
thread 'main' panicked at 'execution failed', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/build.rs:656:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
As stated by the ring library I need to
When you build ring for a target that is different than the one you are using for the build process you need to install the rust tool chain and a C/C++ compiler that can produce binaries for the intended target.
Besides the required dependencies you need to set the environment variables TARGET_CC and TARGET_AR to the full path of the cross-compiler and the cross-archiver respectively.
Still I was not able to figure out which package to install and how to set the mentioned variables TARGET_CC and TARGET_AR in order to make the build working.
Is there a way how to cross-compile a Rust-Application for Windows under Ubuntu Linux 22.04 without using a VM or Docker-Container with a Windows installation?

Gcc.exe not installed error not letting me install sqlx-cli

So when I run cargo install sqlx-cli I get this error, I can run rust code, I have checked windows SDK and C++ boxes. I dont k so what can I do to solve this problem? I’m using windows 11
error: failed to run custom build command for `wepoll-ffi v0.1.2`
Caused by:
process didn't exit successfully: `C:\Users\ali07\AppData\Local\Temp\cargo-installitFylM\release\build\wepoll-ffi-cc6f1ac54f6b60ea\build-script-build` (exit code: 1)
--- stdout
TARGET = Some("x86_64-pc-windows-gnu")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-pc-windows-gnu")
CC_x86_64-pc-windows-gnu = None
CC_x86_64_pc_windows_gnu = None
HOST_CC = None
CC = None
CFLAGS_x86_64-pc-windows-gnu = None
CFLAGS_x86_64_pc_windows_gnu = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "gcc.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-m64" "-Wall" "-Wextra" "-DNULL_OVERLAPPED_WAKEUPS_PATCH" "-o" "C:\\Users\\ali07\\AppData\\Local\\Temp\\cargo-installitFylM\\release\\build\\wepoll-ffi-74b6f87d03081710\\out\\vendor/wepoll/wepoll.o" "-c" "vendor/wepoll/wepoll.c"
--- stderr
error occurred: Failed to find tool. Is `gcc.exe` installed? (see https://github.com/alexcrichton/cc-rs#compile-time-requirements for help)
warning: build failed, waiting for other jobs to finish...
error: failed to compile `sqlx-cli v0.5.9`, intermediate artifacts can be found at `C:\Users\ali07\AppData\Local\Temp\cargo-installitFylM`
Caused by:
build failed
The line TARGET = Some("x86_64-pc-windows-gnu") means cargo is trying to build your project with a gnu toolchain (gcc). However if you have only installed the msvc (visual studio) c++ compiler then you will not have gcc.
There are two solutions:
A: Easiest: Tell cargo to use msvc
Add the --target flag to use msvc instead:
cargo install sqlx-cli --target x86_64-pc-windows-msvc
B: Install gcc
This depends on your development envrionment. If you are using cygwin then you have to rerun the cygwin setup and make sure to install gcc during the setup process. See: https://superuser.com/questions/304541/how-to-install-new-packages-on-cygwin

trying to use the gstreamer-player rust crate, I get this pkg-config error

This is the full log
error: failed to run custom build command for `glib-sys v0.10.1`
Caused by:
process didn't exit successfully: `C:\Users\Wu\Documents\RustProjects\mechanical\target\debug\build\glib-sys-b6b5049ea9ffd484\build-script-build` (exit code: 1)
--- stdout
cargo:rerun-if-env-changed=GLIB_2.0_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=GLIB_2.0_STATIC
cargo:rerun-if-env-changed=GLIB_2.0_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
--- stderr
Failed to run `"pkg-config" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.42"`: The system cannot find the file specified. (os error 2)
warning: build failed, waiting for other jobs to finish...
error: build failed
I have this error when I try to build my project (it's empty but it's using the gstreamer-player crate
I was told to install pkg-config (I'm on windows) so I used MSYS2 to install it with pacman -S mingw-w64-x86_64-pkg-config
The error persisted so I added the environment variable PKG_CONFIG_PATH = H:\MSYS2\usr\lib\pkgconfig, and I added H:\MSYS2\usr\lib\pkgconfig to the path variable
The error still persists, anyone has any idea of what I could do or what am I doing wrong? Any help appreciated

PCL 1.8.0 installation: Compile error for including QtGui

I'm trying to build PCL 1.8.0 on my Ubuntu 14.04 machine from source, following these instructions. But every time I get the following error:
[ 73%] Building CXX object apps/CMakeFiles/pcl_manual_registration.dir/include/pcl/apps/moc_manual_registration.cpp.o
In file included from ~/pcl/release/apps/ui_manual_registration.h:26:0,
from ~/pcl/release/apps/include/pcl/apps/../../../../../apps/include/pcl/apps/manual_registration.h:37,
from ~/pcl/release/apps/include/pcl/apps/moc_manual_registration.cpp:9:
/usr/include/vtk-5.8/QVTKWidget.h:40:25: fatal error: QtGui/QWidget: No such file or directory
#include <QtGui/QWidget>
^
compilation terminated.
make[2]: *** [apps/CMakeFiles/pcl_manual_registration.dir/include/pcl/apps/moc_manual_registration.cpp.o] Error 1
make[1]: *** [apps/CMakeFiles/pcl_manual_registration.dir/all] Error 2
make: *** [all] Error 2
for locate QWidget I get amongst others the following output:
...
/usr/include/qt4/QtGui/QWidget
...
/usr/include/qt5/QtWidgets/QWidget
...
So how can I resolve the error and install pcl?
The problem happens because your configuration is trying to mix Qt4 and Qt5 during PCL build.
According to the link you've provided, PCL is suppossed so be built against Qt4 in this case.
Try to remove everything in release directory and re-initialize CMake config with correct version of Qt.
Like that (following provided example):
cd ~/Documents/pcl
rm -rf relese
mkdir release
cd release
cmake -DCMAKE_BUILD_TYPE=Release -DPCL_QT_VERSION=4 -DBUILD_GPU=ON -DBUILD_apps=ON -DBUILD_examples=ON ..
make

Unbound module llvm

I have been working through the LLVM Kaleidoscope Tutorial for OCaml. On the third part of the tutorial, I have navigated to the example code in the folder
OCaml-Kaleidoscope\Chapter3
I am encountering an issue when compiling with
ocamlbuild toy.byte
on cygwin. This is the code given in the tutorial to compile.
The error I am getting is
''ocamlc.opt -c -o codegen.cmo codegen.ml
File "codegen.ml", line 5, characters 5-9:
Error: Unbound module Llvm
Exit code 2 while executing this command:
''ocamlc.opt -c -o codegen.cmo codegen.ml
I looked up some solutions to this issue. One solution I found was to use
ocamlbuild -use-ocamlfind toy.byte -package llvm
instead of
ocamlbuild toy.byte
However, when I tried that I received this error:
Failure: ocamlfind not found on path, but -no-ocamlfind not used.
To fix this I tried:
opam install ocamlfind
But ocamlfind is already installed.
Another solution I found was to use:
opam install llvm
This resulted in:
The following actions will be performed:
- install llvm 3.7
=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[llvm: ./install.sh 3.7] Command started
[ERROR] The installation of llvm failed at "./install.sh 3.7 make
C:\\cygwin64\\home\\setup\\.opam\\system
C:\\cygwin64\\home\\setup\\.opam\\system\\lib".
[llvm: ocamlfind remove] Command started
#=== ERROR while installing llvm.3.7 ==========================================#
# opam-version 1.3.0~dev2 (d4f7e01216dbb44af4e7cc6539a1b0afa9be9d2c)
# os win32
# command bash -c ./install.sh 3.7 make C:/cygwin64/home/setup/.opa m/system C:/cygwin64/home/setup/.opam/system/lib
# path C:\cygwin64\home\setup\.opam\system\build\llvm.3.7
# exit-code 2
# env-file C:\cygwin64\home\setup\.opam\system\build\llvm.3.7\llvm-1 0768-58c514.env
# stdout-file C:\cygwin64\home\setup\.opam\system\build\llvm.3.7\llvm-1 0768-58c514.out
# stderr-file C:\cygwin64\home\setup\.opam\system\build\llvm.3.7\llvm-1 0768-58c514.err
### stdout ###
# [...]
# config.status: executing bindings/ocaml/Makefile.ocaml commands
# make: Entering directory '/home/setup/.opam/system/build/llvm.3.7/build/bindin gs'
# llvm[0]: Constructing LLVMBuild project information.
# make[1]: Entering directory '/home/setup/.opam/system/build/llvm.3.7/build/bin dings/ocaml'
# make[2]: Entering directory '/home/setup/.opam/system/build/llvm.3.7/build/bin dings/ocaml/llvm'
# llvm[2]: Compiling llvm_ocaml.c for Release+Asserts build
# /home/setup/.opam/system/build/llvm.3.7/Makefile.rules:1536: recipe for target '/home/setup/.opam/system/build/llvm.3.7/build/bindings/ocaml/llvm/Release+Asse rts/llvm_ocaml.o' failed
# make[2]: Leaving directory '/home/setup/.opam/system/build/llvm.3.7/build/bind ings/ocaml/llvm'
# /home/setup/.opam/system/build/llvm.3.7/Makefile.rules:880: recipe for target 'all' failed
# make[1]: Leaving directory '/home/setup/.opam/system/build/llvm.3.7/build/bind ings/ocaml'
# /home/setup/.opam/system/build/llvm.3.7/Makefile.rules:939: recipe for target 'ocaml/.makeall' failed
# make: Leaving directory '/home/setup/.opam/system/build/llvm.3.7/build/binding s'
### stderr ###
# [...]
# configure: WARNING: dlopen() not found - disabling plugin support
# configure: WARNING: mmap() of a fixed address required but not supported
# configure: WARNING: mmap() of files required but not found
# configure: WARNING: --enable-bindings=ocaml specified, but OUnit 2 is not inst alled. Tests will not run
# + make -C bindings all SYSTEM_LLVM_CONFIG=llvm-config
# gcc.exe: error: /home/setup/.opam/system/build/llvm.3.7/bindings/ocaml/llvm/ll vm_ocaml.c: No such file or directory
# gcc.exe: fatal error: no input files
# compilation terminated.
# /usr/bin/rm: cannot remove '/home/setup/.opam/system/build/llvm.3.7/build/bind ings/ocaml/llvm/Release+Asserts/llvm_ocaml.d.tmp': No such file or directory
# make[2]: *** [/home/setup/.opam/system/build/llvm.3.7/build/bindings/ocaml/llv m/Release+Asserts/llvm_ocaml.o] Error 1
# make[1]: *** [all] Error 1
# make: *** [ocaml/.makeall] Error 2
=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions failed
- install llvm 3.7
No changes have been performed
=-=- llvm.3.7 troubleshooting -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=> This package relies on external (system) dependencies that may be missing.
`opam depext llvm.3.7' may help you find the correct installation for your
system.
I am using version 3.8.0 of llvm and version 4.02.3 of OCaml from this link.
Am I on the right track? What do I need to do to fix this?
As I have answered in your question LLVM tutorial OCaml Compilation Assembler Error, your best way is not to use Windows.
OPAM is now usable in Cygwin OCaml or even in MinGW OCaml (using Cygwin opam binary) but packages in the OPAM repository are not tested in these environments. Just avoid them unless you are experienced with OCaml program development in Windows.
If you stick to Windows, then check the build at C:\cygwin64\home\setup\.opam\system\build\llvm.3.7. There should be stdout and stderr log files which can help to understand what happend.

Resources