Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

official docker image linking error #113

Closed
happy-machine opened this issue Aug 20, 2022 · 5 comments
Closed

official docker image linking error #113

happy-machine opened this issue Aug 20, 2022 · 5 comments

Comments

@happy-machine
Copy link

happy-machine commented Aug 20, 2022

My very simple cli program wont compile in the official rust image but will compile on mac. The official image shouldn't need tinkering to build.

to reproduce

build docker image from latest official image:

FROM rust:1.63
RUN apt-get update -y && apt-get install -y vim tmux htop nano gcc-multilib libgpgme-dev unixodbc unixodbc-dev
WORKDIR /
CMD ["sleep", "86400"]

cargo new test

use this cargo.toml:

[package]
name = "test"
version = "0.1.0"
edition = "2021"
author = "NA"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
crossterm = { version = "0.19", features = [ "serde" ] }
serde = {version = "1.0", features = ["derive"] }
serde_json = "1.0"
chrono = { version = "0.4", features = ["serde"] }
rand = { version = "0.7.3", default-features = false, features = ["std"] }
tui = { version = "0.14", default-features = false, features = ['crossterm', 'serde'] }
thiserror = "1.0"
clipboard = "0.5.0"
itertools = "0.10.3"

cargo build --release or cargo run

result:

error: linking with cc failed: exit status: 1

note: /usr/bin/ld: cannot find -lxcb-shape
          /usr/bin/ld: cannot find -lxcb-xfixes

Note: have tried also installing gcc-multilib libgpgme-dev unixodbc unixodbc-dev to no effect and running
RUSTFLAGS='-L /db2-query/clidriver/lib' cargo build --release

to no effect.

@happy-machine happy-machine changed the title linking error official docker image linking error Aug 20, 2022
@quorth0n
Copy link

The error message is telling you to install the lxcb-shape library. apt install libxcb-shape0-dev

@happy-machine
Copy link
Author

Thanks for your help. I don't mean this to sound critical i appreciate that you guys are doing amazing things with no doubt limited resources.

I installed that (which didnt fix the build but led me to my next missing dependency) and then after some further searching around discovered i also needed libxcb-composite0-dev as you have made clear it is not transparent what is missing.

My issue is more to do with the behaviour of cargo as a dependency management tool. I would expect as is the case with NPM or PYPY that cargo would manage the installation of sub-dependencies? and that i shouldn't need to install these things on top of the official docker image?

@sfackler
Copy link
Member

My issue is more to do with the behaviour of cargo as a dependency management tool.

That would probably be better directed to https://github.com/rust-lang/cargo.

and that i shouldn't need to install these things on top of the official docker image?

Are you requesting that the official docker image install every -dev package in existence?

@happy-machine
Copy link
Author

happy-machine commented Aug 20, 2022

This program which builds fine on mac will also not run after cargo finally gave me: Finished release [optimized] target(s)

thread 'main' panicked at 'called Result::unwrap()on anErr value: XcbConn(ClosedParseErr)

refers to:
let mut ctx: ClipboardContext = ClipboardProvider::new().unwrap();

@happy-machine
Copy link
Author

happy-machine commented Aug 20, 2022

My issue is more to do with the behaviour of cargo as a dependency management tool.

That would probably be better directed to https://github.com/rust-lang/cargo.

I will do so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants