mongo-rust-driver v2.1.0 compilation failure - mongodb

rustc 1.60.0-nightly (17d29dcdc 2022-01-21) running on x86_64-pc-windows-msvc
I don't know how to solve, I deleted main to such an extent that it still reports an error
main.rs:
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
println!("Hello, world!");
Ok(())
}
error:
Compiling mongodb v2.1.0
error: internal compiler error: compiler\rustc_mir_transform\src\generator.rs:755:13: Broken MIR: generator contains type ClientOptionsParser in MIR, but typeck only knows about {ResumeTy, impl AsRef<str>, std::option::Option<resolver_config::ResolverConfig>, bool, client::options::ClientOptions, [closure#C:\Users\BORBER\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd\mongodb-2.1.0\src\client\options\mod.rs:1100:69: 1100:90], impl futures_util::Future<Output = std::result::Result<SrvResolver, error::Error>>, (), SrvResolver, &Vec<client::options::ServerAddress>, Vec<client::options::ServerAddress>, usize, &client::options::ServerAddress, client::options::ServerAddress, &str, impl futures_util::Future<Output = std::result::Result<ResolvedConfig, error::Error>>} and [impl AsRef<str>, std::option::Option<client::options::resolver_config::ResolverConfig>]
--> C:\Users\BORBER\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd\mongodb-2.1.0\src\client\options\mod.rs:1092:23
|
1092 | ) -> Result<Self> {
| _______________________^
1093 | | let parser = ClientOptionsParser::parse(uri.as_ref())?;
1094 | | let srv = parser.srv;
1095 | | let auth_source_present = parser.auth_source.is_some();
... |
1145 | | Ok(options)
1146 | | }
| |_____^
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/17d29dcdce9b9e838635eb0adefd9b8b1588410b\compiler\rustc_errors\src\lib.rs:1115:9
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.60.0-nightly (17d29dcdc 2022-01-21) running on x86_64-pc-windows-msvc
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [optimized_mir] optimizing MIR for `client::options::<impl at C:\Users\BORBER\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd\mongodb-2.1.0\src\client\options\mod.rs:973:1: 1261:2>::parse_uri::{closure#0}`
#1 [layout_of] computing layout of `[static generator#C:\Users\BORBER\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd\mongodb-2.1.0\src\client\options\mod.rs:1092:23: 1146:6]`
#2 [layout_of] computing layout of `core::future::from_generator::GenFuture<[static generator#C:\Users\BORBER\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd\mongodb-2.1.0\src\client\options\mod.rs:1092:23: 1146:6]>`
#3 [layout_of] computing layout of `impl core::future::future::Future<Output = [async output]>`
#4 [optimized_mir] optimizing MIR for `client::options::<impl at C:\Users\BORBER\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd\mongodb-2.1.0\src\client\options\mod.rs:973:1: 1261:2>::parse_uri`
end of query stack
error: aborting due to previous error
error: could not compile `mongodb` due to previous error

just use stable!
Finished dev [unoptimized + debuginfo] target(s) in 0.61s
Running `target\debug\my-mongodb.exe`
Hello, world!

Related

TcpStream::connect - match arms have incompatible type

I'm trying to write basic networking code in Rust, but running into an error I don't understand. I have been using match statements to error check everything in Rust so far, but when I try to error check TcpStream::connect(), I get an unexpected error:
My code:
use std::net::TcpStream;
fn main() {
let mut server = match TcpStream::connect("127.0.0.1:23456"){
Ok(x) => x,
Err(x) => println!("Could not connect to server: {x}"),
};
}
The compiler error:
error[E0308]: `match` arms have incompatible types
--> src/main.rs:8:19
|
6 | let mut server = match TcpStream::connect("127.0.0.1:23456"){
| ______________________-
7 | | Ok(x) => x,
| | - this is found to be of type `TcpStream`
8 | | Err(x) => println!("Could not connect to server: {x}"),
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
expected struct `TcpStream`, found `()`
9 | | };
| |_____- `match` arms have incompatible types
|
Every other time I use a match statement it allows me to destructure the Result type into a return value in the OK case (as above), or an error string in the error case.
It is the case that TcpStream::connect() returns a TcpStream, but why is the compiler insisting that the error case also needs to return a TcpStream?
The value of the match statement gets assigned to server.
However, both branches of your match statement return a different type.
Ok(x) returns x, which is of type TcpStream.
Err(x) returns the result of println!(), which has the return value ().
TcpStream and () are incompatible.
Just think about the code after the match statement. What should the server variable be? You don't stop the execution when the error happens, you simply println!() and continue. So something has to be written to the server variable.
If you panic!() instead of println!(), meaning print and abort, then it compiles because it knows that the Err case won't continue afterwards:
use std::net::TcpStream;
fn main() {
let mut server = match TcpStream::connect("127.0.0.1:23456") {
Ok(x) => x,
Err(x) => panic!("Could not connect to server: {x}"),
};
}
thread 'main' panicked at 'Could not connect to server: Connection refused (os error 111)', src/main.rs:6:19
That said, if this is your desired behavior, there is a short form for it:
use std::net::TcpStream;
fn main() {
let mut server = TcpStream::connect("127.0.0.1:23456").expect("Could not connect to server");
}
thread 'main' panicked at 'Could not connect to server: Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }', src/main.rs:4:60
I recommend handling the error properly, though.
There are many ways to do that, so this part will be opinionated.
I personally like miette (an alternative would be anyhow):
use miette::{Context, IntoDiagnostic};
use std::net::TcpStream;
fn main() -> miette::Result<()> {
let mut _server = TcpStream::connect("127.0.0.1:23456")
.into_diagnostic()
.wrap_err("Could not connect to server.")?;
// Do something with server
Ok(())
}
Error:
× Could not connect to server.
╰─▶ Connection refused (os error 111)
Your server variable can't be both TcpStream and the unit type ()
Try propagating the error instead.
Here is an example from the official documentation:
use std::io::prelude::*;
use std::net::TcpStream;
fn main() -> std::io::Result<()> {
let mut stream = TcpStream::connect("127.0.0.1:34254")?;
stream.write(&[1])?;
stream.read(&mut [0; 128])?;
Ok(())
}
If it can't connect to the server, it emits an error message
Error: Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }
And sets a non-zero exit code
$ echo $?
1

belle-sip linphone yocto integration

Found Zlib: /belle-sip/git_d8c5e9e08b3bd6640898e46850333f1ad900c8d2-r0.0/recipe-sysroot/usr/include
| CMake Error /belle-sip/git_d8c5e9e08b3bd6640898e46850333f1ad900c8d2-r0.0/recipe-sysroot-native/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
| Could NOT find Antlr3 (missing: ANTLR3_COMMAND)
| Call Stack (most recent call first):
| /recipe-sysroot-native/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
| cmake/FindAntlr3.cmake:80 (find_package_handle_standard_args)
| CMakeLists.txt:82 (find_package)
|
|
| -- Configuring incomplete, errors occurred!
Any pointers on this
bb file
require belle-sip.inc
inherit gitpkgv
PR = "${INC_PR}.0"
python () {
if d.getVar('LATEST_REVISIONS', True) == "1":
d.setVar('SRCREV', '${AUTOREV}')
else:
d.setVar('SRCREV', 'd8c5e9e08b3bd6640898e46850333f1ad900c8d2')
}
# For visualisation
python () {
print("")
print("belle-sip")
print(d.getVar('SRCREV', True))
}
#SRCREV = "c840e2192b2d0151cc895b844e44bfe0d2103fcf"
SRC_URI = "git://git.linphone.org/BC/public/belle-sip.git;commit=${SRCREV}"
PV = "git_${SRCREV}"
PKGV = "${GITPKGVTAG}"

Pycuda test_driver.py raises Attribute Error

I'm trying to install pycuda on Linux Mint with a GeForce 960M and Cuda 8.0 installed. When I run the test_driver.py script it outputs the following error:
============================= test session starts ==============================
platform linux2 -- Python 2.7.12, pytest-3.0.3, py-1.4.31, pluggy-0.4.0
rootdir: /home/milton/Downloads/pycuda-2016.1.2, inifile:
collected 28 items
test_driver.py ...................x.....F..
=================================== FAILURES ===================================
________________________ TestDriver.test_multi_context _________________________
args = (,), kwargs = {}
pycuda = <module 'pycuda' from '/home/milton/miniconda2/lib/python2.7/site-packages/pycuda-2016.1.2-py2.7-linux-x86_64.egg/pycuda/init.pyc'>
ctx = <pycuda._driver.Context object at 0x7f540e39d758>
clear_context_caches = <function clear_context_caches at 0x7f540ee26758>
collect =<built-in function collect>
def f(*args, **kwargs):
import pycuda.driver
# appears to be idempotent, i.e. no harm in calling it more than once
pycuda.driver.init()
ctx = make_default_context()
try:
assert isinstance(ctx.get_device().name(), str)
assert isinstance(ctx.get_device().compute_capability(), tuple)
assert isinstance(ctx.get_device().get_attributes(), dict)
inner_f(*args, **kwargs)
../../../miniconda2/lib/python2.7/site-packages/pycuda-2016.1.2-py2.7-linux-x86_64.egg/pycuda/tools.py:460:
self = <test_driver.TestDriver instance at 0x7f540c21fc20>
#mark_cuda_test
def test_multi_context(self):
if drv.get_version() < (2,0,0):
return
if drv.get_version() >= (2,2,0):
if drv.Context.get_device().compute_mode == drv.compute_mode.EXCLUSIVE:
E AttributeError: type object 'compute_mode' has no attribute 'EXCLUSIVE'
test_driver.py:638: AttributeError
================ 1 failed, 26 passed, 1 xfailed in 6.92 seconds ================
python driver compute mode only supports following modes:
DEFAULT,
PROHIBITED,
EXCLUSIVE_PROCESS
so please change this:
if drv.Context.get_device().compute_mode == drv.compute_mode.EXCLUSIVE:
to
if drv.Context.get_device().compute_mode == drv.compute_mode.EXCLUSIVE_PROCESS:
in your test_driver.py file

Play framework 1.2.4 Error while loading DocViewerPlugin

I've a web application based on Play 1.2.4 and GWT.
It works well on my own computer, but it does not work on another one.
It looks like the error comes from Play, but I use the same version of play on both computers...
Could you help me with this error please ?
Thank you very much
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.2.4, http://www.playframework.org
~
~ Ctrl+C to stop
~
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option UseSplitVerifier; sup
port was removed in 8.0
Listening for transport dt_socket at address: 8000
13:43:16,622 INFO ~ Starting C:\AppRessources\AppWeb
13:43:16,638 INFO ~ Module crud is available (C:\play-1.2.4\modules\crud)
13:43:16,638 INFO ~ Module secure is available (C:\play-1.2.4\modules\secure)
13:43:19,696 ERROR ~
#6kb811e5p
Error loading plugin LoadingPluginInfo{name='DocViewerPlugin', index=1000, url=f
ile:/C:/play-1.2.4/modules/docviewer/app/play.plugins}
Oops: ClassFormatException
An unexpected error occured caused by exception ClassFormatException: null
play.exceptions.UnexpectedException: Unexpected Error
at play.classloading.ApplicationCompiler$1.findType(ApplicationCompiler.
java:195)
at play.classloading.ApplicationCompiler$1.findType(ApplicationCompiler.
java:144)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType
(LookupEnvironment.java:97)
at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.r
esolve(UnresolvedReferenceBinding.java:49)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveTyp
e(BinaryTypeBinding.java:102)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFro
mTypeSignature(LookupEnvironment.java:1264)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFro
mVariantTypeSignature(LookupEnvironment.java:1316)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeArg
umentsFromSignature(LookupEnvironment.java:1107)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFro
mTypeSignature(LookupEnvironment.java:1269)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createMeth
od(BinaryTypeBinding.java:486)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createMeth
ods(BinaryTypeBinding.java:554)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.cacheParts
From(BinaryTypeBinding.java:334)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBina
ryTypeFrom(LookupEnvironment.java:719)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBina
ryTypeFrom(LookupEnvironment.java:699)
at org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:294)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType
(LookupEnvironment.java:102)
at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.r
esolve(UnresolvedReferenceBinding.java:49)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveTyp
e(BinaryTypeBinding.java:102)
at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.res
olve(ParameterizedTypeBinding.java:835)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveTyp
e(BinaryTypeBinding.java:118)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveTyp
eFor(BinaryTypeBinding.java:901)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getField(B
inaryTypeBinding.java:735)
at org.eclipse.jdt.internal.compiler.lookup.Scope.findField(Scope.java:8
49)
at org.eclipse.jdt.internal.compiler.lookup.BlockScope.getBinding(BlockS
cope.java:472)
at org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference.resolveT
ype(QualifiedNameReference.java:984)
at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(Message
Send.java:344)
at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(Message
Send.java:344)
at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalD
eclaration.java:186)
at org.eclipse.jdt.internal.compiler.ast.Block.resolve(Block.java:101)
at org.eclipse.jdt.internal.compiler.ast.IfStatement.resolve(IfStatement
.java:233)
at org.eclipse.jdt.internal.compiler.ast.Block.resolve(Block.java:101)
at org.eclipse.jdt.internal.compiler.ast.IfStatement.resolve(IfStatement
.java:233)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resol
veStatements(AbstractMethodDeclaration.java:444)
at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatem
ents(MethodDeclaration.java:191)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resol
ve(AbstractMethodDeclaration.java:403)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDec
laration.java:1096)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDec
laration.java:1184)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.reso
lve(CompilationUnitDeclaration.java:535)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:743)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:444)
at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.jav
a:282)
at play.classloading.ApplicationClasses$ApplicationClass.compile(Applica
tionClasses.java:277)
at play.classloading.ApplicationClassloader.loadApplicationClass(Applica
tionClassloader.java:164)
at play.classloading.ApplicationClassloader.loadClass(ApplicationClasslo
ader.java:84)
at java.lang.ClassLoader.loadClass(Unknown Source)
at play.plugins.PluginCollection.loadPlugins(PluginCollection.java:158)
at play.Play.init(Play.java:294)
at play.server.Server.main(Server.java:158)
Caused by: org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(Cla
ssFileReader.java:369)
at play.classloading.ApplicationCompiler$1.findType(ApplicationCompiler.
java:163)
... 47 more
13:43:19,726 WARN ~ You're running Play! in DEV mode
13:43:20,115 INFO ~ Listening for HTTP on port 9000 (Waiting a first request to
start) ...
Java 8 and Play 1.2.x don't mix. Source: the same issue as reported on the Play Google group.
I think this should be the version of the problem, if the words are replaced java7 not have this problem, I am also there, and then I replaced java7, then it is normal

Why am I getting a "ScriptC sym lookup failed" error?

I am trying to implement a simple luminance histogram in RenderScript using the
atomic arithmetic function rsAtomicInc,
but I get a runtime error which seems to say that function does not exist:
ScriptC sym lookup failed for _Z11rsAtomicIncPVj.
(To verify that this is the correct symbol, you can use:
$ echo "unsigned int __attribute__((overloadable))
rsAtomicInc ( volatile unsigned int *addr ) { return 0; }" > rsai.c
$ clang -c rsai.c; nm rsai.o
dumpbin can be substituted for nm on
Windows.) I have tried using the other atomic functions, which yield similar errors. I get the errors regardless of whether I use them in a kernel or an invokable function.
// histogram.rs:
#pragma version(1)
#pragma rs java_package_name(com.example.android.rs.hellocompute)
#pragma rs_fp_imprecise //relax math- allows NEON and other optimizations
const static float3 gMonoMult = {0.299f, 0.587f, 0.114f};
volatile uint32_t *luminanceHistogram;
void luminance(const uchar4 *img, const void *usrData, uint32_t x, uint32_t y) {
float4 f4 = rsUnpackColor8888(*img);
float3 mono = dot(f4.rgb, gMonoMult);
uchar lum = rsPackColorTo8888(mono).r;
rsAtomicInc(luminanceHistogram + lum);
}
void increment(int lum) {
rsAtomicInc(luminanceHistogram + lum);
}
// HelloCompute.java
int[] luminance = new int[256];
Allocation luminanceHistogram = Allocation.createSized(mRS,
Element.U32(mRS), luminance.length);
ScriptC_histogram histo = new ScriptC_histogram(mRS); // ERROR
Error log:
E/bcc ( 3539): Invalid RS info file /data/data/com.example.android.rs.hellocompute/cache/com.android.renderscript.cache/histogram.o.info! (No such file or directory)
E/RenderScript( 3539): ScriptC sym lookup failed for _Z11rsAtomicIncPVj
E/bcc ( 3539): Some symbols are found to be undefined during relocation!
E/bcc ( 3539): Error occurred when performs relocation on /data/data/com.example.android.rs.hellocompute/cache/com.android.renderscript.cache/histogram.o!
E/RenderScript( 3539): bcc: FAILS to prepare executable for 'histogram'
D/AndroidRuntime( 3539): Shutting down VM
W/dalvikvm( 3539): threadid=1: thread exiting with uncaught exception (group=0x415c6700)
E/AndroidRuntime( 3539): FATAL EXCEPTION: main
E/AndroidRuntime( 3539): android.renderscript.RSRuntimeException: Loading of ScriptC script failed.
E/AndroidRuntime( 3539): at android.renderscript.ScriptC.<init>(ScriptC.java:60)
...
The first error concerning histogram.o.info is probably spurious- a complete uninstall of the app makes it (but none of the other errors) go away for the first run.
This looks like a bug on our part (Android RenderScript team). It looks like those functions just don't exist in our implemented runtime library (even though they exist in the header). I will file a bug internally and get this cleaned up for future releases.