Commit Graph

1 Commits

Author SHA1 Message Date
Jordan Justen e127e47d7a tests/rust: Add rust case linking to libm in rust static library
When building on Linux, I see:

rustc -C linker=cc --color=always --crate-type rlib --crate-name rs_math -g --emit dep-info=rs_math.d --emit link -L /usr/lib/x86_64-linux-gnu -o librs_math.rlib -l static=m ../rs_math.rs
error: failed to add native library /usr/lib/x86_64-linux-gnu/libm.a: file too small to be an archive

I think the "file too small to be an archive" message is coming from
libLLVM, and is a case of LLVM not handling this type of "script
archive". So, possibly this is just LLVM not handling a linking case.

The rust_args usage in meson.build is invalid, but required to
reproduce the issue in the test case. Perhaps meson should
automatically add the library include path via the dep_m meson object,
or maybe the meson.build can add the link path in a better way.

Changing '-l static=m' to '-l dylib=m' appears to fix this case. (See
comments in meson.build.)
2021-02-26 11:58:47 -08:00