Page 1 of 1

vlc-rs 0.3.0 can't link to 'vlc.lib' (3.0.17.4) on windows

Posted: 31 Jul 2022 07:40
by Turbo_Slowpoke
Hello,

I'm trying to compile the example from the vlc-rs package and I'm facing this issue:

Code: Select all

x86_64-pc-windows-msvc\lib\vlc.lib : fatal error LNK1107: invalid or corrupt file: cannot read at 0x12
According to this guide https://code.videolan.org/videolan/vlc-rs, all I need to do is to set the env variables which should point to the 'vlc.lib' which comes from the 'sdk' directory if you download the *.zip package (installer doesn't have the 'sdk' directory at all). Setting VLC_LIB_DIR didn't work for me actually, so I've put vlc.lib directly into the toolchain lib dir like so:

Code: Select all

.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\vlc.lib
I there anything else I need to do? Seems like linker is having some troubles...

Re: vlc-rs 0.3.0 can't link to 'vlc.lib' (3.0.17.4) on windows

Posted: 02 Aug 2022 14:01
by Turbo_Slowpoke
Okay, so I made it work. Apparently, my linker didn't like vlc.lib, so I duplicated libvlc and renamed it into vlc.lib.
I also had to add support for legacy stdio definitions:

build.rs:

Code: Select all

fn main() { println!("cargo:rustc-link-lib=dylib=legacy_stdio_definitions"); }