Skip to content

rustdoc beta linking trouble in MinGW #41607

Closed
@tspiteri

Description

@tspiteri

I have a crate rugflo which depends on a crate gmp-mpfr-sys. The gmp-mpfr-sys crate includes three C libraries that are compiled during crate compilation. One of the C libraries apparently makes use of __emutls_get_address, and the rugflo crate makes use of this library.

If I run

cargo +beta test -p rugflo

the #[test] tests succeed, but the inline documentation tests fail. On stable, both #[test] and inline documentation tests succeed. I'm including part of the error message below.

This is on the beta-x86_64-pc-windows-gnu toolchain, with beta version 1.18.0-beta.1 (4dce672 2017-04-25).

failures:

---- src\float.rs - float::Float::assign_str (line 1566) stdout ----
	error: linking with `gcc` failed: exit code: 1
  |
  = note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "C:\\Users\\Trevor\\.rustup\\toolchains\\beta-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\crt2.o" "C:\\Users\\Trevor\\.rustup\\toolchains\\beta-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\Users\\Trevor\\.rustup\\toolchains\\beta-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "C:\\Users\\Trevor\\AppData\\Local\\Temp\\rustdoctest.SrhC8rnnvQEZ\\rust_out.0.o" "-o" "C:\\Users\\Trevor\\AppData\\Local\\Temp\\rustdoctest.SrhC8rnnvQEZ\\rust_out.exe" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "c:\\Users\\Trevor\\projects\\t\\target\\debug\\deps" "-L" "c:\\Users\\Trevor\\projects\\t\\target\\debug\\build\\gmp-mpfr-sys-0cc9b17adf0b6ee9\\out\\lib" "-L" "C:\\Users\\Trevor\\.rustup\\toolchains\\beta-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bstatic" "C:\\Users\\Trevor\\projects\\t\\target\\debug\\deps\\librugflo-b0b353c1d0de4acc.rlib" "C:\\Users\\Trevor\\projects\\t\\target\\debug\\deps\\librugrat-06b8c4776c6f6356.rlib" "C:\\Users\\Trevor\\projects\\t\\target\\debug\\deps\\librugint-0f0e67a952d13d05.rlib" "C:\\Users\\Trevor\\projects\\t\\target\\debug\\deps\\libgmp_mpfr_sys-ec78d94836c71bdb.rlib" "C:\\Users\\Trevor\\projects\\t\\target\\debug\\deps\\librand-76456d761c2cb637.rlib" "-L" "C:\\Users\\Trevor\\.rustup\\toolchains\\beta-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bdynamic" "-l" "std-e2451a256f66ac19" "-Wl,-Bstatic" "C:\\Users\\Trevor\\.rustup\\toolchains\\beta-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-91b619d34dd1f5aa.rlib" "-Wl,-Bdynamic" "-l" "advapi32" "-l" "advapi32" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\Users\\Trevor\\.rustup\\toolchains\\beta-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
  = note: C:\Users\Trevor\projects\t\target\debug\deps\libgmp_mpfr_sys-ec78d94836c71bdb.rlib(exceptions.o):exceptions.c:(.text+0xc): undefined reference to `__emutls_get_address'
          C:\Users\Trevor\projects\t\target\debug\deps\libgmp_mpfr_sys-ec78d94836c71bdb.rlib(exceptions.o):exceptions.c:(.text+0x42): undefined reference to `__emutls_get_address'
          C:\Users\Trevor\projects\t\target\debug\deps\libgmp_mpfr_sys-ec78d94836c71bdb.rlib(exceptions.o):exceptions.c:(.text+0x7c): undefined reference to `__emutls_get_address'
          C:\Users\Trevor\projects\t\target\debug\deps\libgmp_mpfr_sys-ec78d94836c71bdb.rlib(exceptions.o):exceptions.c:(.text+0xb2): undefined reference to `__emutls_get_address'
          C:\Users\Trevor\projects\t\target\debug\deps\libgmp_mpfr_sys-ec78d94836c71bdb.rlib(exceptions.o):exceptions.c:(.text+0xec): undefined reference to `__emutls_get_address'
          C:\Users\Trevor\projects\t\target\debug\deps\libgmp_mpfr_sys-ec78d94836c71bdb.rlib(exceptions.o):exceptions.c:(.text+0x10c): more undefined references to `__emutls_get_address' follow
          

error: aborting due to previous error

thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:453
note: Run with `RUST_BACKTRACE=1` for a backtrace.
thread 'rustc' panicked at 'couldn't compile the test', src\librustdoc\test.rs:273

---- src\float.rs - float::Constant (line 130) stdout ----
	error: linking with `gcc` failed: exit code: 1
  |

...
(repetitions)
...

thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:453
thread 'rustc' panicked at 'couldn't compile the test', src\librustdoc\test.rs:273


failures:
    src\float.rs - float::Constant (line 130)
    src\float.rs - float::Float::assign_random_bits_round (line 1237)
    src\float.rs - float::Float::assign_random_cont_round (line 1344)
    src\float.rs - float::Float::assign_str (line 1566)
    src\float.rs - float::Float::assign_str_radix (line 1583)
    src\float.rs - float::Float::assign_str_radix_round (line 1625)
    src\float.rs - float::Float::assign_str_round (line 1605)
    src\float.rs - float::Float::to_integer_exp (line 344)
    src\float.rs - float::Float::to_string_radix (line 1463)
    src\float.rs - float::Rational::assign (line 2090)
    src\float.rs - float::Rational::from (line 2033)
    src\float.rs - float::Round::Nearest (line 92)
    src\lib.rs -  (line 51)

test result: FAILED. 0 passed; 13 failed; 0 ignored; 0 measured

error: test failed, to rerun pass '--doc'

Metadata

Metadata

Assignees

Labels

A-linkageArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.P-mediumMedium priorityT-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions