Time 64bit on windows - compile issues

I wanted to use hyper, with rustc beta 1.1, on windows 7, with MinGW
installed, but don't get around a compile error in time v0.1.26:
sorry, unimplemented: 64-bit mode not compiled in thread ''
panicked at 'explicit panic',C:\cygwin64\home\emabee.cargo\registry\src\github.com-1ecc6299db9ec823\gcc-0.3.6\src\lib.rs:459.

Am I doing sth wrong? Is there any workaround?

I had the same problems when setting up Windows tests for Rustful. I think you have to make sure everything adds up. rustc, MinGW, gcc and everything else should be 64bit for it to work, if I understand it correctly. The alternative, which I ended up doing, is to switch things to 32bit instead, but I chose that path because Appveyor already had 32bit MinGW installed in their systems and I didn't want to fuzz around any more.

I'm sorry that I can't give you any better help.

Here's what I have:
$ rustc --version --verbose
rustc 1.1.0-beta (cd7d89af9 2015-05-16) (built 2015-05-16)
binary: rustc
commit-hash: cd7d89af9169885642d43597302af69f842bbd78
commit-date: 2015-05-16
build-date: 2015-05-16
host: x86_64-pc-windows-gnu
release: 1.1.0-beta

$ gcc --version --verbose
Using built-in specs.
gcc.exe (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO

Target: mingw32
Configured with: ../gcc-4.8.1/configure --prefix=/mingw --host=mingw32 --build=mingw32 --without-pic --enable-shared --enable-static --with-gnu-ld --enable-lto --enable-libssp --disable-multilib --enable-languages=c,c++,fortran,objc,obj-c++,ada --dis
able-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --with-gmp=/usr/src/pkg/gmp-5.1.2-1-mingw32-src/bld --with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld --with-mpfr= --with-sy
stem-zlib --with-gnu-as --enable-decimal-float=yes --enable-libgomp --enable-threads --with-libiconv-prefix=/mingw32 --with-libintl-prefix=/mingw --disable-bootstrap LDFLAGS=-s CFLAGS=-D_USE_32BIT_TIME_T
Thread model: win32
gcc version 4.8.1 (GCC)
COLLECT_GCC_OPTIONS='--version' '-v' '-mtune=generic' '-march=pentiumpro'
c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/cc1.exe -quiet -v -iprefix c:\mingw\bin../lib/gcc/mingw32/4.8.1/ help-dummy -quiet -dumpbase help-dummy -mtune=generic -march=pentiumpro -auxbase help-dummy -version --version -o C:\Users\d020383\AppData\Lo
GNU C (GCC) version 4.8.1 (mingw32)
compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='--version' '-v' '-mtune=generic' '-march=pentiumpro'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/as.exe -v --version -o C:\Users\d020383\AppData\Local\Temp\ccv64MCm.o C:\Users\d020383\AppData\Local\Temp\ccuIqzAe.s
GNU assembler version 2.24 (mingw32) using BFD version (GNU Binutils) 2.24
GNU assembler (GNU Binutils) 2.24
Copyright 2013 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `mingw32'.
COLLECT_GCC_OPTIONS='--version' '-v' '-mtune=generic' '-march=pentiumpro'
c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/collect2.exe -Bdynamic --version c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../crt2.o c:/mingw/bin/../lib/gcc/mingw32/4.8.1/crtbegin.o -Lc:/mingw/bin/../lib/gcc/mingw32/4.8.1 -Lc:/mingw/bin/../lib/gcc -Lc:/
mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib -Lc:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../.. C:\Users\d020383\AppData\Local\Temp\ccv64MCm.o -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32
-lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt c:/mingw/bin/../lib/gcc/mingw32/4.8.1/crtend.o
collect2 version 4.8.1
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe -Bdynamic --version c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../crt2.o c:/mingw/bin/../lib/gcc/mingw32/4.8.1/crtbegin.o -Lc:/mingw/bin/../lib/gcc/mingw32/4.8.1 -Lc:/mingw/bin/../
lib/gcc -Lc:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib -Lc:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../.. C:\Users\d020383\AppData\Local\Temp\ccv64MCm.o -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser
32 -lkernel32 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt c:/mingw/bin/../lib/gcc/mingw32/4.8.1/crtend.o
GNU ld (GNU Binutils) 2.24
Copyright 2013 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

(sorry, lot's of output).

So, I guess rustc is OK for 64bit, but gcc is not.
I used the recommended MinGW installation (https://github.com/alexcrichton/gcc-rs#windows-notes%20for%20help). Is there an alternative for 64 bit?

That's https://github.com/rust-lang/time/issues/78

If you don't mind switching to MSYS2, follow instructions Building on Windows (just omit step 4) and you should be Okay.

Thanks a lot, that helped - a bit. The compile steps were successful, but the linker says
note: ld: cannot find -leay32
ld: cannot find -lssl32

There are lots of eay32-related files in /c/msys64/mingw64/bin/, including libeay32.dll

Is some config setting missing?

Ensure that /mingw64/bin/ is in your PATH.
Output of echo $PATH should contain /mingw64/bin/ if you target is 64bit:

$ echo $PATH
/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/system32 etc...

This should be the case if you launched Term from "MinGW-w64 Win64 Shell" shortcut (or mingw64_shell.bat in msys2 root folder)

This is given already. I tried again with otherwise minimized PATH (I had some other PERL stuff in my windows path) but it didn't help:

emabee@w3190537 MINGW64 /c/dev/rust/projects/hytst
$ echo $PATH
/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/Program Files/Rust beta 1.1/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

emabee@w3190537 MINGW64 /c/dev/rust/projects/hytst
$ cargo clean

emabee@w3190537 MINGW64 /c/dev/rust/projects/hytst
$ cargo build
Compiling gcc v0.3.8
Compiling pkg-config v0.3.4
Compiling httparse v0.1.3
Compiling typeable v0.1.2
Compiling lazy_static v0.1.11
Compiling rustc-serialize v0.3.15
Compiling matches v0.1.2
Compiling traitobject v0.0.1
Compiling libc v0.1.8
Compiling bitflags v0.1.1
Compiling unicase v0.1.0
Compiling num_cpus v0.2.6
Compiling log v0.3.1
Compiling time v0.1.26
Compiling openssl-sys v0.6.2
Compiling mime v0.0.11
Compiling openssl v0.6.2
Compiling url v0.2.35
Compiling cookie v0.1.21
Compiling hyper v0.5.2
Compiling hytst v0.1.0 (file:///C:/dev/rust/projects/hytst)
error: linking with gcc failed: exit code: 1
note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-static-libgcc" "-m64" "-L" "C:\Program Files\Rust beta 1.1\bin\rustlib\x86_64-pc-windows-gnu\lib" "-o" "C:\dev\rust\projects\hytst\target\debug\hytst.exe" "C:\dev\rust\projects\hytst\target\debug\hytst.o" "-Wl,--gc-sections" "C:\dev\rust\projects\hytst\target\debug\deps\libhyper-595d44f1fae15675.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\libtypeable-10065b0bbdf3bed9.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\libnum_cpus-d64cdaf0c78cf4e8.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\libunicase-29c711cff0d04b16.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\libtraitobject-dc1e70e5c4501fdd.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\libmime-e3d384f950d18291.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\liblog-54cf393d3c69686f.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\libhttparse-a22b71e5e0845e38.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\libcookie-ac7973d866daef44.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\liburl-a4f53e129e04fc84.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\librustc_serialize-0e2cbfb69293d88f.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\libtime-f08bec52f4924e95.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\libmatches-68db25b520030534.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\libopenssl-a36d86f1beea2185.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\libbitflags-518ea12e21428edd.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\liblazy_static-7e1b752366784e2f.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\libopenssl_sys-5040130ff99796a0.rlib" "C:\dev\rust\projects\hytst\target\debug\deps\liblibc-2eda841eb12a3090.rlib" "C:\Program Files\Rust beta 1.1\bin\rustlib\x86_64-pc-windows-gnu\lib\libstd-e4d77fca.rlib" "C:\Program Files\Rust beta 1.1\bin\rustlib\x86_64-pc-windows-gnu\lib\libcollections-e4d77fca.rlib" "C:\Program Files\Rust beta 1.1\bin\rustlib\x86_64-pc-windows-gnu\lib\librustc_unicode-e4d77fca.rlib" "C:\Program Files\Rust beta 1.1\bin\rustlib\x86_64-pc-windows-gnu\lib\librand-e4d77fca.rlib" "C:\Program Files\Rust beta 1.1\bin\rustlib\x86_64-pc-windows-gnu\lib\liballoc-e4d77fca.rlib" "C:\Program Files\Rust beta 1.1\bin\rustlib\x86_64-pc-windows-gnu\lib\liblibc-e4d77fca.rlib" "C:\Program Files\Rust beta 1.1\bin\rustlib\x86_64-pc-windows-gnu\lib\libcore-e4d77fca.rlib" "-L" "C:\dev\rust\projects\hytst\target\debug" "-L" "C:\dev\rust\projects\hytst\target\debug\deps" "-L" "C:\dev\rust\projects\hytst\target\debug\build\openssl-sys-5040130ff99796a0\out" "-L" "C:\dev\rust\projects\hytst\target\debug\build\time-f08bec52f4924e95\out" "-L" "C:\Program Files\Rust beta 1.1\bin\rustlib\x86_64-pc-windows-gnu\lib" "-L" "C:\dev\rust\projects\hytst.rust\bin\x86_64-pc-windows-gnu" "-L" "C:\dev\rust\projects\hytst\bin\x86_64-pc-windows-gnu" "-Wl,--whole-archive" "-Wl,-Bstatic" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "-leay32" "-lssl32" "-lws2_32" "-luserenv" "-lcompiler-rt"
note: ld: cannot find -leay32
ld: cannot find -lssl32

error: aborting due to previous error
Could not compile hytst.

To learn more, run the command again with --verbose.

emabee@w3190537 MINGW64 /c/dev/rust/projects/hytst
$ rustc --version
rustc 1.1.0-beta (cd7d89af9 2015-05-16) (built 2015-05-16)

emabee@w3190537 MINGW64 /c/dev/rust/projects/hytst
$ cargo --version
cargo 0.2.0-nightly (a483581 2015-05-14) (built 2015-05-16)

You may have to install OpenSSL separately, as described in the rust-openssl Readme.

The rust-openssl readme mentions placing the files in "locations that Cargo can find". http://www.mingw.org/wiki/HOWTO_Specify_the_Location_of_Libraries_for_use_with_MinGW helped me figure that out. In short, if you look at the gcc call above, the paths following the "-L" arguments are some of the paths that work. Your build would have failed earlier if it couldn't successfully find the openssl includes, so it is finding some version of the header files but is failing to find the dlls.

Rust prefers bundled gcc and its' libs to any other gcc installation on the PATH.
You can either:

  • Remove the "Linker and platform libraries" component of your Rust installation. Rustc will then invoke the external gcc.
  • Add location of libssl to the library search path. I think the easiest way to do that at this time is to set the gcc LIBRARY_PATH environment variable.

Tried and failed with both options you mentioned, all you really need is supply gcc with path in which openssl libs could be found. Following guide mentioned by @ogeon will help. Either by copying files or setting proper environment variables that used by build script. There is nothing specific to gcc here.

I submitted PR to rust-openssl, which should help build openssl-sys dependency (for hyper in this case) with mingw (after merge and openssl-sys crate update) without need to install openssl separately and setting environment variables.

I applied the change in your PR locally and it works perfectly. Thanks!

How can I use "my own" version of rust-openssl (with the PR patch applied) to get past this? I'm just trying to learn Hyper.

I applied the change from the PR to my version of the build.rs (since I'm using msys64, it is at C:\msys64\home\emabee.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-sys-0.6.2), called in my normal project cargo clean and cargo build, and that was it.

time is now pure Rust code, so you should no longer need a MinGW setup for that. In addition OpenSSL support in hyper is now optional and there will soon be a pure Rust alternative using the Windows Schannel API for SSL support.