rust-cross / cargo-zigbuild

Compile Cargo project with zig as linker
MIT License
1.45k stars 52 forks source link

= note: ld.lld: error: unable to find library -lusb-1.0 #154

Closed cosoc closed 1 year ago

cosoc commented 1 year ago

os info: debian 11

install lib

apt install libusb-dev libusb-1.0-0 libusb-1.0-0-dev

build

#!/bin/bash

SYSROOT=/usr/lib/x86_64-linux-gnu
export PKG_CONFIG_PATH=
export PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig
export PKG_CONFIG_SYSROOT_DIR=/usr/lib/x86_64-linux-gnu
export PKG_CONFIG_ALLOW_CROSS=1

export LD_LIBRARY_PATH=

cargo zigbuild --bin my_bin_cli --target=x86_64-unknown-linux-musl --features vendored  --release 

error

  = note: ld.lld: error: unable to find library -lusb-1.0
messense commented 1 year ago

You can't just mix gnu and musl libraries together.

cosoc commented 1 year ago

@messense

If target=x86_64-unknown-linux-gnu The problem is the same