Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1694165 - mingw64-meson fails to link with rust
Summary: mingw64-meson fails to link with rust
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: mingw-filesystem
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kalev Lember
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-29 17:01 UTC by Marc-Andre Lureau
Modified: 2019-03-29 17:26 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:


Attachments (Terms of Use)
Use GNU target (deleted)
2019-03-29 17:01 UTC, Marc-Andre Lureau
no flags Details

Description Marc-Andre Lureau 2019-03-29 17:01:22 UTC
Created attachment 1549555 [details]
Use GNU target

Mingw is not using MSVC, but GNU toolchains:

With the patch attached, this will not fail.

 ✘ elmarco@boraha  ~/src/meson/test cases/rust/5 polyglot static/build   sourceset  mingw64-meson              
The Meson build system
Version: 0.50.0
Source dir: /home/elmarco/src/meson/test cases/rust/5 polyglot static
Build dir: /home/elmarco/src/meson/test cases/rust/5 polyglot static/build
Build type: cross build
Project name: static rust and c polyglot executable
Project version: undefined
Appending CFLAGS from environment: '-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
Appending LDFLAGS from environment: '-Wl,-z,relro   -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'
Native C compiler: ccache cc (gcc 8.3.1 "cc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2)")
Cross C compiler: /usr/bin/x86_64-w64-mingw32-gcc (gcc 8.3.0)
WARNING: Env var AR seems to point to the cross compiler.
This is probably wrong, it should always point to the native compiler.
Appending LDFLAGS from environment: '-Wl,-z,relro   -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'
error: linking with `/usr/bin/x86_64-w64-mingw32-gcc` failed: exit code: 1
  |
  = note: "/usr/bin/x86_64-w64-mingw32-gcc" "-L" "/home/elmarco/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib" "/home/elmarco/src/meson/test cases/rust/5 polyglot static/build/meson-private/rusttest.sanity.7rcbfp3g-cgu.0.rcgu.o" "/home/elmarco/src/meson/test cases/rust/5 polyglot static/build/meson-private/rusttest.sanity.7rcbfp3g-cgu.1.rcgu.o" "/home/elmarco/src/meson/test cases/rust/5 polyglot static/build/meson-private/rusttest.sanity.7rcbfp3g-cgu.2.rcgu.o" "/home/elmarco/src/meson/test cases/rust/5 polyglot static/build/meson-private/rusttest.sanity.7rcbfp3g-cgu.3.rcgu.o" "/home/elmarco/src/meson/test cases/rust/5 polyglot static/build/meson-private/rusttest.sanity.7rcbfp3g-cgu.4.rcgu.o" "-o" "/home/elmarco/src/meson/test cases/rust/5 polyglot static/build/meson-private/rusttest" "/home/elmarco/src/meson/test cases/rust/5 polyglot static/build/meson-private/rusttest.y3ku8mxgq5v8qc0.rcgu.o" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "/home/elmarco/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/home/elmarco/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libstd-3be6ac1114b14fa9.rlib" "/home/elmarco/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libpanic_unwind-2acbe9f11ad99028.rlib" "/home/elmarco/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libbacktrace_sys-02d26172a291c7c1.rlib" "/home/elmarco/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libunwind-8e24e48754158417.rlib" "/home/elmarco/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/librustc_demangle-670c55144854e053.rlib" "/home/elmarco/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/liblibc-ecb1697ce7fb6936.rlib" "/home/elmarco/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/liballoc-22198aca0b14133e.rlib" "/home/elmarco/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/librustc_std_workspace_core-4ab90f1f02345891.rlib" "/home/elmarco/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libcore-b98f41fa2dac386b.rlib" "-Wl,--end-group" "/home/elmarco/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libcompiler_builtins-5fcb08748623a7c4.rlib" "-Wl,-Bdynamic" "-ladvapi32" "-lws2_32" "-luserenv" "-lmsvcrt"
  = note: /usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/crt2.o: In function `pre_c_init':
          /builddir/build/BUILD/mingw-w64-v5.0.4/mingw-w64-crt/build_win64/../crt/crtexe.c:133: undefined reference to `_encode_pointer'
          /builddir/build/BUILD/mingw-w64-v5.0.4/mingw-w64-crt/build_win64/../crt/crtexe.c:141: undefined reference to `_setargv'
          /builddir/build/BUILD/mingw-w64-v5.0.4/mingw-w64-crt/build_win64/../crt/crtexe.c:145: undefined reference to `_matherr'
          /builddir/build/BUILD/mingw-w64-v5.0.4/mingw-w64-crt/build_win64/../crt/crtexe.c:145: undefined reference to `__mingw_setusermatherr'
          /usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/crt2.o: In function `__tmainCRTStartup':
          /builddir/build/BUILD/mingw-w64-v5.0.4/mingw-w64-crt/build_win64/../crt/crtexe.c:254: undefined reference to `__imp_Sleep'
          /builddir/build/BUILD/mingw-w64-v5.0.4/mingw-w64-crt/build_win64/../crt/crtexe.c:280: undefined reference to `_pei386_runtime_relocator'

Comment 1 Kalev Lember 2019-03-29 17:06:17 UTC
Can I add you as a co-maintainer so you can fix it yourself? I haven't done any mingw related work in a long while and aren't really up to date with things here. Someone else contributed the meson script and I don't really know how this all works.

Comment 2 Kalev Lember 2019-03-29 17:15:24 UTC
I went ahead and added you to mingw-filesystem, hope it's ok.

Comment 3 Marc-Andre Lureau 2019-03-29 17:21:24 UTC
You may, although it's always nice to have a second eye! 

Elliott, since you wrote the original meson support, could you take a look at the proposed patch. Thanks

(fwiw, I was trying to build meson test cases, and it also has issues https://github.com/mesonbuild/meson/issues/5175)

Comment 4 Kalev Lember 2019-03-29 17:26:38 UTC
Great! :)

Looks sane to me, just wonder if the target triplet should be "i686-w64-mingw32" instead of "i686-pc-windows" (and likewise for the x86_64 triplet)?


Note You need to log in before you can comment on or make changes to this bug.