Skip to content

Ubuntu Gnome X11 Error while running #653

Open
@vladceresna

Description

@vladceresna
  1. Operating system
    Ubuntu Gnome X11
  2. The way you installed OpenCV: package, official binary distribution, manual compilation, etc.
    OpenCV installed via cargo package
  3. OpenCV version
    opencv = "0.94.2"
  4. rustc version (rustc --version)
    rustc 1.82.0 (2024-10-15)
  5. Attach the full output of the following command from your project directory: shell script RUST_BACKTRACE=full cargo build -vv
    cargo run RUST_BACKTRACE=full cargo build -vv
    target/debug/opencvx: symbol lookup error: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE

My code:

use opencv::prelude::*;
use opencv::{highgui, videoio, Result};

fn main() -> Result<()> {
    
    let window = "video capture";
    highgui::named_window(window, highgui::WINDOW_AUTOSIZE)?;

    let mut cam = videoio::VideoCapture::new(0, videoio::CAP_ANY)?;
    let opened = videoio::VideoCapture::is_opened(&cam)?;
    if !opened {
        panic!("Unable to open default camera!");
    }

    loop {
        let mut frame = Mat::default();
        cam.read(&mut frame)?;
        if frame.size()?.width > 0 {
            highgui::imshow(window, &frame)?;
        }
        let key = highgui::wait_key(10)?;
        if key > 0 && key != 255 {
            break;
        }
    }

    // Очистка
    highgui::destroy_all_windows()?;
    Ok(())
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions