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

Rust can detect GNU/Meson style named libraries but the MSVC linker backend ignores them #122455

Open
amyspark opened this issue Mar 13, 2024 · 1 comment · May be fixed by #123436
Open

Rust can detect GNU/Meson style named libraries but the MSVC linker backend ignores them #122455

amyspark opened this issue Mar 13, 2024 · 1 comment · May be fixed by #123436
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-windows Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@amyspark
Copy link

Hi all,

I'm coming from https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1495#note_2324261 to report an inconsistency in how Rust passes library names to Visual Studio's LINK.EXE. In the gst-plugins-rs project, which is driven through Meson, I expected all libraries to be found correctly. Instead, I get an error of library not found at linking time.

This is caused by the following snippet of code.

fn link_staticlib_by_name(
&mut self,
name: &str,
verbatim: bool,
whole_archive: bool,
_search_paths: &SearchPaths,
) {
let prefix = if whole_archive { "/WHOLEARCHIVE:" } else { "" };
let suffix = if verbatim { "" } else { ".lib" };
self.cmd.arg(format!("{prefix}{name}{suffix}"));

The above snippet hardcodes the xxx.lib convention when passing import or static libraries' names. However, this is not consistent with Meson's import library naming policy, which is already handled correctly in a separate portion of the Rust compiler:

let os = (sess.target.staticlib_prefix.clone(), sess.target.staticlib_suffix.clone());
// On Windows, static libraries sometimes show up as libfoo.a and other
// times show up as foo.lib
let unix = ("lib".into(), ".a".into());
if os == unix { vec![os] } else { vec![os, unix] }
};
for path in search_paths {
for (prefix, suffix) in &formats {
let test = path.join(format!("{prefix}{name}{suffix}"));

The result of the above is that Rust, under MSVC, will happily put together staticlibs and rlibs, but will fail utterly when a dylib is demanded under the present set of circumstances.

This is the other half required to completely address the issue in gdesmott/system-deps#77 -- I tried working around this by inserting static:+verbatim plus setting the correct file name, as shown in amyspark/system-deps@10b342e, but it returns an error:

   Compiling gstreamer-webrtc-sys v0.23.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#3246f4fb)
error: overriding linking modifiers from command line is not supported

error: could not compile `glib-sys` (lib) due to previous error

This is already known and was never addressed: #95575 (comment)

Meta

rustc --version --verbose:

rustc 1.76.0 (07dca489a 2024-02-04)
binary: rustc
commit-hash: 07dca489ac2d933c78d3c5158e3f43beefeb02ce
commit-date: 2024-02-04
host: x86_64-pc-windows-msvc
release: 1.76.0
LLVM version: 17.0.6
Backtrace of the big linker error

error: linking with `link` failed: exit code: 1181
  |
  = note: "link" "/DEF:C:\\Users\\Amalia\\AppData\\Local\\Temp\\rustctTM4aY\\lib.def" "/NOLOGO" "C:\\Users\\Amalia\\AppData\\Local\\Temp\\rustctTM4aY\\symbols.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.17wz7xqkdhzcev1x.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.1a8x2dtlxqing4e8.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.1co7be2ni4utuxr9.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.1je055do5g5iahua.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.1l76n9fb2lvw298p.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.1omqbmldb4s0sdt2.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.1pu9xlpvi3og510m.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.1ql1cp84pma28cu1.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.1t9sx9bf4w1rj3jz.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.1vkt09ufbgf8t8cn.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.211hdkz22vb3msle.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.22gxtpmibtapjqo6.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.2jxus968qvlsdcau.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.2rggsjrye60wv3q8.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.2snszquag18oxnl5.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.2xstm66ca62kfllj.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.2y9hy9p4wamjs345.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.33ufwptus1u4qljn.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.35v7wapiwokmbtms.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.367prtivrl49f0kg.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.3hj6xzklwcijholy.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.3m9sutf3qpue5i0c.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.3macqza9z0tl7fni.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.3p6tdvg17sizgudi.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.3vorgw1nt7nk2coy.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.3xytnu9th3i3w2mi.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.3ye61sx47y3v47o7.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.4bcrgwpqnddcause.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.4bxyusslt3whyqwk.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.4cim2y013oyck969.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.4gat637njsvz09j.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.4j9j51lizuerd5g8.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.4l37kggiox28n9gr.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.4n4er75klgsdn0k9.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.4o647pts3glcowdo.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.4pzz2ktuaa659d1u.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.4wyiibbg66mp2jd8.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.4x9rp223xph7gwlr.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.54vws7lrv4at7ki3.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.565pgth8vo73c9wz.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.57oeti8uf49moolg.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.59xih176kvw2bkca.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.5gq2l3t75adsf7kg.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.9wh7zpzonplr3yw.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.j82tnopls5ioips.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.le1kv276f4jqb6e.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.ly4tdz2hqnaj53o.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.pnytrg8nckyohji.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.rn3k7w4ougmplbc.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.rwloceih1pgkwx1.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.xsyxbi1vuzp34yr.rcgu.o" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.41jhnr01nzx8uob.rcgu.o" "/LIBPATH:E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps" "/LIBPATH:E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\debug\\deps" "/LIBPATH:E:/gstreamer/build/subprojects/glib-2.78.3/gio" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/zlib-1.2.13" "/LIBPATH:E:/gstreamer/build/subprojects/glib-2.78.3/gobject" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/libffi/src" "/LIBPATH:E:/gstreamer/build/subprojects/glib-2.78.3/gmodule" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/glib-2.78.3/glib" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/pcre2-10.42" "/LIBPATH:E:/gstreamer/build/subprojects/glib-2.78.3/glib" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/pcre2-10.42" "/LIBPATH:E:/gstreamer/build/subprojects/glib-2.78.3/gobject" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/libffi/src" "/LIBPATH:E:/gstreamer/build/subprojects/glib-2.78.3/glib" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/pcre2-10.42" "/LIBPATH:E:/gstreamer/build/subprojects/glib-2.78.3/gobject" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/libffi/src" "/LIBPATH:E:/gstreamer/build/subprojects/glib-2.78.3/glib" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/pcre2-10.42" "/LIBPATH:C:\\Users\\Amalia\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\windows_x86_64_msvc-0.52.4\\lib" "/LIBPATH:E:/gstreamer/build/subprojects/gstreamer/gst" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/glib-2.78.3/gobject" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/libffi/src" "/LIBPATH:E:/gstreamer/build/subprojects/glib-2.78.3/gmodule" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/glib-2.78.3/glib" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/pcre2-10.42" "/LIBPATH:E:/gstreamer/build/subprojects/gstreamer/libs/gst/base" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/gstreamer/gst" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/glib-2.78.3/gobject" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/libffi/src" "/LIBPATH:E:/gstreamer/build/subprojects/glib-2.78.3/gmodule" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/glib-2.78.3/glib" "/LIBPATH:E:/gstreamer/build/subprojects/proxy-libintl" "/LIBPATH:E:/gstreamer/build/subprojects/pcre2-10.42" "/LIBPATH:C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libgstreamer_base-45037631e0ff1fce.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libatomic_refcell-a281618e8e7db238.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libgstreamer_base_sys-1787b32c8cf84409.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\liburl-6bd60e7095eb4beb.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libidna-7772261202f0e54a.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libunicode_normalization-1b073f57909edbea.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libtinyvec-94b8c2bd85cda91f.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libtinyvec_macros-9549bb5648c2b1fa.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libunicode_bidi-1072a203c50bff4e.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libform_urlencoded-956660cd245b2d84.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libpercent_encoding-2f0376e7cd999742.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libgstreamer-21bfdadf150da19d.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libcfg_if-f71af3f919aee094.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\liboption_operations-cda10743559ebedc.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libmuldiv-62b46e4a52da0f63.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libitertools-9eaa9c4264cb7657.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libeither-0bca8e86cc33fa07.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libnum_rational-a861fe609c8331ad.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libnum_integer-5cfd532259c1e482.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libnum_traits-5aa867b4ecf1ee79.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libonce_cell-80b87a6e1d2aa422.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libglib-a62c530b9fd0b5e9.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libfutures_executor-5bdbe86a7f79ac72.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libsmallvec-a1638065646cd3b9.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libgio_sys-1a52cb560d974307.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libwindows_sys-d28a4c7ed1351593.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libwindows_targets-a050c2c8c5662fa1.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libthiserror-4ce702dcc9040def.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libfutures_util-8e4b31e435f33f82.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libmemchr-8812170d14d5d3de.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libfutures_io-b9c0d6c314e11bf6.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libslab-1cd8f3a279dd7951.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libpin_project_lite-a6cb5de165fd284e.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libpin_utils-0978a60699ab7dc3.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libfutures_task-cb647a19b3488fff.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libfutures_channel-3435817acfcaccaf.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libfutures_sink-af7131941b8034f6.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libfutures_core-342118864540fc9b.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libbitflags-be59e2918babb64f.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libgstreamer_sys-720f7b1223bb3166.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libgobject_sys-5bafd4162484a53d.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libglib_sys-e1b9a39aa9c22c38.rlib" "E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\liblibc-208bc620f8f9a2d1.rlib" "C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-e493bcbfdc66a475.rlib" "C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-467acea86c440d1f.rlib" "C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-8bcec20f8d868561.rlib" "C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_detect-e75d865d889e433e.rlib" "C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-cd24a5810f58b720.rlib" "C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-44b4ecbbc95939b2.rlib" "C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-ff93d2b34eb6aecc.rlib" "C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-17346c417f0e9166.rlib" "C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-ff5a06ebf4571d10.rlib" "C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-cb2478631e21007b.rlib" "C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-58d59322b34f2b51.rlib" "C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-c192803e6895f627.rlib" "C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-20106e86b5dab94f.rlib" "ws2_32.lib" "winmm.lib" "gobject-2.0.lib" "shlwapi.lib" "dnsapi.lib" "iphlpapi.lib" "ws2_32.lib" "winmm.lib" "windows.0.52.0.lib" "ws2_32.lib" "winmm.lib" "ws2_32.lib" "winmm.lib" "ws2_32.lib" "winmm.lib" "legacy_stdio_definitions.lib" "kernel32.lib" "advapi32.lib" "bcrypt.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "kernel32.lib" "ws2_32.lib" "kernel32.lib" "ntdll.lib" "kernel32.lib" "msvcrt.lib" "/NXCOMPAT" "/LIBPATH:C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "/OUT:E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.dll" "/OPT:REF,ICF" "/DLL" "/IMPLIB:E:\\gstreamer\\build\\subprojects\\gst-plugins-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\gstrsfile.dll.lib" "/DEBUG" "/NATVIS:C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\Amalia\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis"
  = note: LINK : fatal error LNK1181: cannot open input file 'gobject-2.0.lib'


error: could not compile `gst-plugin-file` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...

@amyspark amyspark added the C-bug Category: This is a bug. label Mar 13, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 13, 2024
@amyspark amyspark changed the title MSVC linker backend cannot link against GNU/Meson style named libraries Rust can detect GNU/Meson style named libraries but the MSVC linker backend ignores them Mar 13, 2024
@Nilstrieb Nilstrieb added A-linkage Area: linking into static, shared libraries and binaries O-windows Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 14, 2024
@SeeRich
Copy link

SeeRich commented Mar 27, 2024

Any update on this issue?

amyspark added a commit to amyspark/rust that referenced this issue Apr 3, 2024
amyspark added a commit to amyspark/rust that referenced this issue Apr 3, 2024
This allows for implementing looking up Meson and MinGW import
libraries.

See rust-lang#122455
amyspark added a commit to amyspark/rust that referenced this issue Apr 3, 2024
amyspark added a commit to amyspark/rust that referenced this issue Apr 18, 2024
amyspark added a commit to amyspark/rust that referenced this issue Apr 18, 2024
This allows for implementing looking up Meson and MinGW import
libraries.

See rust-lang#122455
amyspark added a commit to amyspark/rust that referenced this issue Apr 18, 2024
amyspark added a commit to amyspark/rust that referenced this issue Apr 18, 2024
This allows for implementing looking up Meson and MinGW import
libraries.

See rust-lang#122455
amyspark added a commit to amyspark/rust that referenced this issue Apr 18, 2024
gnomesysadmins pushed a commit to GNOME/librsvg that referenced this issue Apr 18, 2024
Back when I implemented the mesonification of librsvg, I forced the
installable target of rsvg-2 to be a shared library. This was because
Meson and Rust, at link time, differ on the naming convention expected
of static libraries:

rust-lang/rust#122455

https://mesonbuild.com/FAQ.html#why-does-building-my-project-with-msvc-output-static-libraries-called-libfooa

I did not realise at the time that the fix merged in !938 (commit
73d7167) was not aware of this issue,
and so it broke the Cerbero builds targeting Microsoft compilers.
This commit works around the Rust bug by following the Linux convention for
static libraries, and then using a custom target to rename the Rust-generated
library if under MSVC.

All targets that depend on librsvg_lib do so now unconditionally, given
they must link at a time where the file outputs are settled.

Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/957>
amyspark added a commit to amyspark/rust that referenced this issue Apr 20, 2024
amyspark added a commit to amyspark/rust that referenced this issue Apr 20, 2024
amyspark added a commit to amyspark/rust that referenced this issue Apr 20, 2024
amyspark added a commit to amyspark/rust that referenced this issue Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-windows Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants