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

Sanity check ignores rust_args #11718

Open
YaLTeR opened this issue Apr 23, 2023 · 0 comments
Open

Sanity check ignores rust_args #11718

YaLTeR opened this issue Apr 23, 2023 · 0 comments

Comments

@YaLTeR
Copy link

YaLTeR commented Apr 23, 2023

Describe the bug
Sanity check doesn't pass rustc the rust_args from the cross file.

To Reproduce
For example, this cross file will fail the sanity check because it doesn't pass the --target to rustc, which causes it to pass wrong arguments to the linker.

[binaries]
c = 'x86_64-w64-mingw32-gcc'
cpp = 'x86_64-w64-mingw32-g++'
ar = 'x86_64-w64-mingw32-ar'
strip = 'x86_64-w64-mingw32-strip'
windres = 'x86_64-w64-mingw32-windres'
exe_wrapper = 'wine'
rust = 'rustc'

[built-in options]
rust_args = ['--target=x86_64-pc-windows-gnu']

[properties]
sys_root = '/usr/x86_64-w64-mingw32/sys-root/mingw'

[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
Sanity check compiler command line: rustc -C linker=x86_64-w64-mingw32-gcc -o /var/home/yalter/source/rs/hltas/build-mingw64-2/meson-private/rusttest /var/home/yalter/source/rs/hltas/build-mingw64-2/meson-private/sanity.rs
Sanity check compile stdout:

-----
Sanity check compile stderr:
error: linking with `x86_64-w64-mingw32-gcc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/var/home/yalter/source/py/meson/venv/bin:/var/home/yalter/.cargo/bin:/var/home/yalter/.local/bin:/var/home/yalter/.fzf/bin:/var/home/yalter/.cargo/bin:/var/home/yalter/.local/bin:/var/home/yalter/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/home/yalter/.local/share/JetBrains/Toolbox/scripts" VSLANG="1033" "x86_64-w64-mingw32-gcc" "-m64" "/tmp/rustcZkZEUK/symbols.o" "/var/home/yalter/source/rs/hltas/build-mingw64-2/meson-private/rusttest.sanity.37a5c72e-cgu.0.rcgu.o" "/var/home/yalter/source/rs/hltas/build-mingw64-2/meson-private/rusttest.sanity.37a5c72e-cgu.1.rcgu.o" "/var/home/yalter/source/rs/hltas/build-mingw64-2/meson-private/rusttest.sanity.37a5c72e-cgu.2.rcgu.o" "/var/home/yalter/source/rs/hltas/build-mingw64-2/meson-private/rusttest.sanity.37a5c72e-cgu.3.rcgu.o" "/var/home/yalter/source/rs/hltas/build-mingw64-2/meson-private/rusttest.sanity.37a5c72e-cgu.4.rcgu.o" "/var/home/yalter/source/rs/hltas/build-mingw64-2/meson-private/rusttest.5fbdtgmssthcma5k.rcgu.o" "-Wl,--as-needed" "-L" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-89bc084783fdc439.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-8bee4b287d4367c1.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-d61707aed80694c0.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-d85366256f22345b.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-96069b86b8a8cae9.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-d19d53abf68dfa6c.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-787cbccd19d64ac6.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-b3837a36b830e0d0.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-e3deb0e7e3f04966.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-dabbb79c9815def4.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-305b01f34c9409f2.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-f833521df6074e73.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-9ac333113350d171.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-1c126114322d0eee.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-bad9164fdeeecf92.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-f9374b1e480fa681.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-207f06e41d9603af.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-7e2768e66e984e85.rlib" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-957b4aff41f8cd46.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/var/home/yalter/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/var/home/yalter/source/rs/hltas/build-mingw64-2/meson-private/rusttest" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/lib/gcc/x86_64-w64-mingw32/12.2.1/../../../../x86_64-w64-mingw32/bin/ld: unrecognized option '--eh-frame-hdr'
          /usr/lib/gcc/x86_64-w64-mingw32/12.2.1/../../../../x86_64-w64-mingw32/bin/ld: use the --help option for usage information
          collect2: error: ld returned 1 exit status

If I put --target into the rust executable itself, then everything works fine:

[binaries]
c = 'x86_64-w64-mingw32-gcc'
cpp = 'x86_64-w64-mingw32-g++'
ar = 'x86_64-w64-mingw32-ar'
strip = 'x86_64-w64-mingw32-strip'
windres = 'x86_64-w64-mingw32-windres'
exe_wrapper = 'wine'
rust = ['rustc', '--target=x86_64-pc-windows-gnu']

[properties]
sys_root = '/usr/x86_64-w64-mingw32/sys-root/mingw'

[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

Expected behavior
rust_args are passed during sanity check.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)?
    • yes
  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
    • Fedora 38
  • what Python version are you using e.g. 3.8.0
    • 3.11.3
  • what meson --version
  • what ninja --version if it's a Ninja build
    • 1.11.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants