Skip to content

"bundled" feature compiles on Linux but resulting executable does not show window #1447

Open
@pozix604

Description

@pozix604

On Debian 12, without libsdl2-dev installed, I have the following project. I compile with cargo b -vv (build.log) which succeeds, but when running the executable, nothing shows. Same if I add the static-link feature.

Cargo.toml:

[package]
name = "tsdl2"
version = "0.1.0"
edition = "2021"

[dependencies]
sdl2 = { version = "0.37.0", features = ["bundled"] }

main.rs:

use sdl2::pixels::Color;
use std::thread::sleep;
use std::time::Duration;

fn main() -> Result<(), String> {
    let window = sdl2::init()?
        .video()?
        .window("SDL Window", 256, 256)
        .position_centered()
        .opengl()
        .build()
        .map_err(|e| e.to_string())?;

    let mut renderer = window.into_canvas().build().map_err(|e| e.to_string())?;
    renderer.set_draw_color(Color::RGB(0, 255, 128));
    renderer.clear();
    renderer.present();

    sleep(Duration::new(2, 0));
    Ok(())
}

Removing the bundled feature, then sudo apt install libsdl2-dev, recompiling and re-runing works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions