Missing external crate when trying to build near-lake - nearprotocol

I was trying to build near-lake on a fresh repo cloned from https://github.com/near/near-lake
the build fails with no external crate `itertools` on tokio-stream
cargo build --release
Compiling parity-secp256k1 v0.7.0
Compiling brotli-sys v0.3.2
Compiling libz-sys v1.1.3
Compiling bzip2-sys v0.1.11+1.0.8
Compiling zstd-sys v1.6.3+zstd.1.5.2
Compiling librocksdb-sys v0.6.1+6.28.2
Compiling lzma-sys v0.1.17
Compiling openssl v0.10.38
Compiling openssl-sys v0.9.72
Compiling tokio-openssl v0.6.2
Compiling borsh v0.9.2
Compiling backtrace v0.3.64
Compiling tokio-stream v0.1.8
Compiling tower v0.4.12
Compiling tokio-native-tls v0.3.0
error[E0432]: unresolved import `itertools`
--> /Users/USR/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-stream-0.1.8/src/wrappers/mpsc_bounded.rs:2:5
|
2 | use itertools;
| ^^^^^^^^^ no external crate `itertools`
Compiling brotli2 v0.3.2
For more information about this error, try `rustc --explain E0432`.
error: could not compile `tokio-stream` due to previous error
warning: build failed, waiting for other jobs to finish...
Building [====================> ] 551/633: librocksdb-sys(build)
error: build failed
rustc --version
rustc 1.60.0 (7737e0b5c 2022-04-04)

Related

Rust build error: failed to run custom build command for `glib-sys v0.8.0`

I am trying to build a Rust program on Windows 10. When trying to compile a Rust file with I keep getting the following error messages.
cargo run
Compiling glib-sys v0.8.0
Compiling const_fn v0.4.9
Compiling quote v1.0.21
Compiling socket2 v0.4.4
Compiling net2 v0.2.37
Compiling winreg v0.7.0
error: failed to run custom build command for `glib-sys v0.8.0`
They are caused by:
Caused by:
process didn't exit successfully: `C:\Users\artem\zabotay\backend\target\debug\build\glib-sys-b1ba74e042d8283d\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_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_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=HOST_PKG_CONFIG_LIBDIR
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
`"pkg-config" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.42"` did not exit successfully: exit code: 1
error: could not find system library 'glib-2.0' required by the 'glib-sys' crate
I look through other questions, but found no answer about glib2.0 fix
--- stderr
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing glib-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'glib-2.0' found Package glib-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found
warning: build failed, waiting for other jobs to finish...
How to fix this error?

Can't find executable `mac_listener` while running mix phx.server

Mac listener cannot be found on Macos Mojave, though it is installed.
I tried to recompile the dependency and reinstall the modules but still the problem persists.
the mix deps.compile file_system returns this error.
mix deps.compile file_system
14:34:40.227 [info] Compiling file system watcher for Mac...
==> file_system
c_src/mac/cli.c:1:10: fatal error: 'getopt.h' file not found
#include <getopt.h>
^~~~~~~~~~
1 error generated.
14:34:40.469 [error] Could not compile file system watcher for Mac, try to run "clang -framework CoreFoundation -framework CoreServices -Wno-deprecated-declarations c_src/mac/*.c -o priv/mac_listener" manually inside the dependnecy.
Finally the solution was this.
First
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
Then
mix do deps.get, deps.compile

Cross-compile for MIPS MT7688 OpenWRT on OSX (mipsel-unknown-linux-musl)

When I try to cross-compile a Cargo starter main.rs file for little-endian MIPS (MT7688 processor running OpenWRT) on OSX using rustc 1.32.0-nightly, I get the following error:
cargo build --target=mipsel-unknown-linux-musl
Compiling led v0.1.0 (/Users/petrus/Projects/led)
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-Wl,--eh-frame-hdr" "-L" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps/led-fb2a88ec64854daf.2kthj4han7xcr84g.rcgu.o" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps/led-fb2a88ec64854daf.440j3fk0cam0b0pu.rcgu.o" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps/led-fb2a88ec64854daf.482rers61msj2848.rcgu.o" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps/led-fb2a88ec64854daf.498udk2wtgjsw4ib.rcgu.o" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps/led-fb2a88ec64854daf.4uh6jdaux45o6bh1.rcgu.o" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps/led-fb2a88ec64854daf.5fq5qqfqkwjepod2.rcgu.o" "-o" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps/led-fb2a88ec64854daf" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps/led-fb2a88ec64854daf.49n6u1xnbbs66t12.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps" "-L" "/Users/petrus/Projects/led/target/debug/deps" "-L" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/libstd-27a0dffe96f2ad3e.rlib" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/libpanic_unwind-fe8b80af161a561e.rlib" "/var/folders/rl/b7dvjss14wj6415t0v4f7z3m0000gn/T/rustcFd840X/libunwind-ecc019d8c6cb3f8a.rlib" "/var/folders/rl/b7dvjss14wj6415t0v4f7z3m0000gn/T/rustcFd840X/liblibc-5d68beb2e4661bda.rlib" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/liballoc-de565f8c0b8e0971.rlib" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/librustc_std_workspace_core-0a55bee6cc97e346.rlib" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/libcore-4075eb2b0854a330.rlib" "-Wl,--end-group" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/libcompiler_builtins-ecf284221505c8a3.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lc"
= note: clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
ld: unknown option: --as-needed
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Running with RUSTFLAGS="-C linker=lld" throws:
RUSTFLAGS="-C linker=lld" cargo build --target=mipsel-unknown-linux-musl
Compiling led v0.1.0 (/Users/petrus/Projects/led)
error: linker `lld` not found
|
= note: No such file or directory (os error 2)
error: aborting due to previous error
error: Could not compile `led`.
To learn more, run the command again with --verbose.
Also tried with RUSTFLAGS="-C linker=rust-lld", which throws:
rust-lld: error: unable to find library -lgcc_s
rust-lld: error: unable to find library -lc
As I understand, I need to specify a linker toolchain, which I don't know how to procure. I also tried compiling with xargo and cross and dockcross/linux-mipsel, with no luck.
I would build it on the device itself, but rustup won't install Rust on the MT7688. How do I get and specify the correct MIPS (little-endian) linker toolchain?
Update: I found a pre-compiled MIPS GCC for macOS, which throws `mipsel-elf/bin/ld: unrecognized option '-Wl,--as-needed' or "error adding symbols: Bad value" when I try to specify mipsel-elf-gcc it as the linker:
rustc --target=mipsel-unknown-linux-musl -C linker=/Users/petrus/Projects/wallfly/respeaker/bin/gcc-mips/bin/mipsel-elf-gcc ./src/main.rs
error: linking with `/Users/petrus/Projects/bin/gcc-mips/bin/mipsel-elf-gcc` failed: exit code: 1
|
= note: "/Users/petrus/Projects/bin/gcc-mips/bin/mipsel-elf-gcc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-Wl,--eh-frame-hdr" "-L" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib" "main.main.7rcbfp3g-cgu.0.rcgu.o" "main.main.7rcbfp3g-cgu.1.rcgu.o" "main.main.7rcbfp3g-cgu.2.rcgu.o" "main.main.7rcbfp3g-cgu.3.rcgu.o" "main.main.7rcbfp3g-cgu.4.rcgu.o" "main.main.7rcbfp3g-cgu.5.rcgu.o" "-o" "main" "main.4s37gsrti678ik8u.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/libstd-27a0dffe96f2ad3e.rlib" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/libpanic_unwind-fe8b80af161a561e.rlib" "/var/folders/rl/b7dvjss14wj6415t0v4f7z3m0000gn/T/rustcLDTUyV/libunwind-ecc019d8c6cb3f8a.rlib" "/var/folders/rl/b7dvjss14wj6415t0v4f7z3m0000gn/T/rustcLDTUyV/liblibc-5d68beb2e4661bda.rlib" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/liballoc-de565f8c0b8e0971.rlib" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/librustc_std_workspace_core-0a55bee6cc97e346.rlib" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/libcore-4075eb2b0854a330.rlib" "-Wl,--end-group" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/libcompiler_builtins-ecf284221505c8a3.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lc"
= note: /Users/petrus/Projects/bin/gcc-mips/bin/../lib/gcc/mipsel-elf/7.1.0/../../../../mipsel-elf/bin/ld: /Users/petrus/Projects/bin/gcc-mips/bin/../lib/gcc/mipsel-elf/7.1.0/crtbegin.o: relocation R_MIPS_HI16 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/Users/petrus/Projects/bin/gcc-mips/bin/../lib/gcc/mipsel-elf/7.1.0/crtbegin.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Maybe I'm specifying it wrong?
try
cargo install cross
and then
cross build --release --target mipsel-unknown-linux-musl

checking whether the C compiler works... no; configure: error: C compiler cannot create executables

I am using OSx, attempting to install a haskell package 'SDL-mixer' via 'cabal install SDL-mixer'. I get the following error:
$ cabal install SDL-mixerResolving dependencies...
Configuring SDL-mixer-0.6.2.0...
Failed to install SDL-mixer-0.6.2.0
Build log ( /Users/matthewherzl/.cabal/logs/SDL-mixer-0.6.2.0.log ):
cabal: Entering directory '/var/folders/v7/gzwp_4j12gd_3d2pt2cl52yr0000gn/T/cabal-tmp-7633/SDL-mixer-0.6.2.0'
[1 of 1] Compiling Main ( /var/folders/v7/gzwp_4j12gd_3d2pt2cl52yr0000gn/T/cabal-tmp-7633/SDL-mixer-0.6.2.0/dist/setup/setup.hs, /var/folders/v7/gzwp_4j12gd_3d2pt2cl52yr0000gn/T/cabal-tmp-7633/SDL-mixer-0.6.2.0/dist/setup/Main.o )
Linking /var/folders/v7/gzwp_4j12gd_3d2pt2cl52yr0000gn/T/cabal-tmp-7633/SDL-mixer-0.6.2.0/dist/setup/setup ...
Configuring SDL-mixer-0.6.2.0...
configure: WARNING: unrecognized options: --with-compiler
checking for sdl-config... /usr/local/bin/sdl-config
checking for gcc... /usr/bin/clang
checking whether the C compiler works... no
configure: error: in `/private/var/folders/v7/gzwp_4j12gd_3d2pt2cl52yr0000gn/T/cabal-tmp-7633/SDL-mixer-0.6.2.0':
configure: error: C compiler cannot create executables
See `config.log' for more details.
cabal: Leaving directory '/var/folders/v7/gzwp_4j12gd_3d2pt2cl52yr0000gn/T/cabal-tmp-7633/SDL-mixer-0.6.2.0'
cabal: Error: some packages failed to install:
SDL-mixer-0.6.2.0 failed during the configure step. The exception was:
ExitFailure 77
Other questions pose similar errors, but I have not found a solution that works for my case.
Some things I've tried:
validated that gcc is present on my machine, and works to successfully compile a c program.
restarted my machine
removed and reinstalled xcode
uninstalled and reinstalled gcc
installed clang
attempted to install in sandbox
I get the same error in each case.
It seems there is something I need to change in my OS setup; any ideas on how to fix?

ERROR: Failed to build gem native extension (ruby extconf.rb): Mac OSX [duplicate]

This question already has answers here:
Ruby Gem install Json fails on Mavericks and Xcode 5.1 - unknown argument: '-multiply_definedsuppress'
(11 answers)
Closed 8 years ago.
I am attempting to install a gem, and I get this error, which myself and the gem author have never seen before. How do I fix this?
Davids-MacBook-Pro:web david$ sudo /usr/bin/gem install compass --pre
Password:
Building native extensions. This could take a while...
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... yes
checking for ffi_call() in -lffi... yes
checking for ffi_prep_closure()... yes
checking for ffi_raw_call()... no
checking for rb_thread_blocking_region()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
checking for ffi_prep_cif_var()... no
creating extconf.h
creating Makefile
make "DESTDIR="
compiling AbstractMemory.c
compiling ArrayType.c
compiling Buffer.c
compiling Call.c
Call.c:303:5: warning: implicit declaration of function 'rb_thread_call_without_gvl' is invalid in C99 [-Wimplicit-function-declaration]
rbffi_thread_blocking_region(call_blocking_function, data, (void *) -1, NULL);
^
./Thread.h:78:39: note: expanded from macro 'rbffi_thread_blocking_region'
# define rbffi_thread_blocking_region rb_thread_call_without_gvl
^
1 warning generated.
compiling ClosurePool.c
compiling DataConverter.c
DataConverter.c:43:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
1 warning generated.
compiling DynamicLibrary.c
compiling ffi.c
compiling Function.c
Function.c:479:33: warning: incompatible pointer types passing 'VALUE (void *)' to parameter of type 'void *(*)(void *)' [-Wincompatible-pointer-types]
rb_thread_call_with_gvl(callback_with_gvl, &cb);
^~~~~~~~~~~~~~~~~
Function.c:102:46: note: passing argument to parameter 'func' here
extern void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1);
^
Function.c:563:9: warning: implicit declaration of function 'rb_thread_call_without_gvl' is invalid in C99 [-Wimplicit-function-declaration]
rb_thread_call_without_gvl(async_cb_wait, &w, async_cb_stop, &w);
^
Function.c:738:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
3 warnings generated.
compiling FunctionInfo.c
compiling LastError.c
compiling LongDouble.c
compiling MappedType.c
compiling MemoryPointer.c
compiling MethodHandle.c
compiling Platform.c
compiling Pointer.c
compiling Struct.c
compiling StructByReference.c
compiling StructByValue.c
compiling StructLayout.c
compiling Thread.c
compiling Type.c
compiling Types.c
compiling Variadic.c
linking shared-object ffi_c.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [ffi_c.bundle] Error 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.3 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.3/ext/ffi_c/gem_make.out
If this is occuring in OSX Mavericks, please ensure the command line tools are installed by running the following.
Older editions of OSX & XCode had the install for Command Line Tools in the XCode IDE itself. In OSX Mavericks I had to run the commands below to fix my command line tools so that I could install rubygems using native extensions.
$ sudo xcode-select --install
$ xcode-select --print-path
/Library/Developer/CommandLineTools
Try this:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install <gemName>
For an explanation see this answer
On OSX-10.9.5 using xcode-select --install did not work for me. It started and asked to confirm the licence but then reported that it could not find the software.
I ended up visiting: https://developer.apple.com/downloads/index.action#, downloading the appropriate CommandLineTools dmg for OSX-10.9.5, installing the tools manually from the pkg, and then using: xcode-select --switch=/Library/Developer/CommandLineTools, to set the path.
After which everything worked fine.
This is an Apple LLVM error.
For now, you can:
export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
Though as you can see from the warning name this not a permanent solution.
Source: https://langui.sh/2014/03/10/wunused-command-line-argument-hard-error-in-future-is-a-harsh-mistress/

Resources