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

Cargo build failed in 0.6.4 [windows] #607

Closed
shinchiro opened this issue Jul 12, 2015 · 9 comments
Closed

Cargo build failed in 0.6.4 [windows] #607

shinchiro opened this issue Jul 12, 2015 · 9 comments

Comments

@shinchiro
Copy link

Error compiling openssl-sys:

Executing: cargo build
Compiling traitobject v0.0.1
Compiling lazy_static v0.1.11
Compiling libc v0.1.9
Compiling pkg-config v0.3.5
Compiling winapi-build v0.1.0
Compiling httparse v0.1.5
Compiling language-tags v0.0.7
Compiling bitflags v0.3.2
Compiling matches v0.1.2
Compiling rustc-serialize v0.3.15
Compiling unicase v0.1.0
Compiling gcc v0.3.8
Compiling typeable v0.1.2
Compiling log v0.3.1
Compiling num_cpus v0.2.6
Compiling winapi v0.1.23
Compiling kernel32-sys v0.1.2
Compiling hpack v0.2.0
Compiling mime v0.0.12
Compiling openssl-sys v0.6.4
Build failed, waiting for other jobs to finish...
failed to run custom build command for openssl-sys v0.6.4
Process didn't exit successfully: D:\a\b\target\debug\build\openssl-sys-149f6ef08ad7404d\build-script-build (exit code: 101)
--- stdout
cargo:rustc-link-lib=dylib=eay32
cargo:rustc-link-lib=dylib=ssl32
TARGET = Some("x86_64-pc-windows-gnu")
TARGET = Some("x86_64-pc-windows-gnu")
CARGO_MANIFEST_DIR = Some("C:\Users\anon.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-sys-0.6.4")
OUT_DIR = Some("D:\a\b\target\debug\build\openssl-sys-149f6ef08ad7404d\out")
OPT_LEVEL = Some("0")
PROFILE = Some("debug")
debug 0
TARGET = Some("x86_64-pc-windows-gnu")
HOST = Some("x86_64-pc-windows-gnu")
CC_x86_64-pc-windows-gnu = None
CC_x86_64_pc_windows_gnu = None
HOST_CC = None
CC = None
TARGET = Some("x86_64-pc-windows-gnu")
HOST = Some("x86_64-pc-windows-gnu")
CFLAGS_x86_64-pc-windows-gnu = None
CFLAGS_x86_64_pc_windows_gnu = None
HOST_CFLAGS = None
CFLAGS = None
TARGET = Some("x86_64-pc-windows-gnu")
HOST = Some("x86_64-pc-windows-gnu")
CC_x86_64-pc-windows-gnu = None
CC_x86_64_pc_windows_gnu = None
HOST_CC = None
CC = None
running: "gcc" "-O0" "-c" "-ffunction-sections" "-fdata-sections" "-mwin32" "-m64" "-fPIC" "C:\Users\anon.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-sys-0.6.4\src/openssl_shim.c" "-o" "D:\a\b\target\debug\build\openssl-sys-149f6ef08ad7404d\out\src\openssl_shim.o"

failed to execute command: The system cannot find the file specified.
(os error 2)
Is gcc not installed? (see https://github.com/alexcrichton/gcc-rs#windows-notes for help)

--- stderr
thread '

' panicked at 'explicit panic', C:\Users\anon.cargo\registry\src\github.com-1ecc6299db9ec823\gcc-0.3.8\src\lib.rs:497

@reem
Copy link
Contributor

reem commented Jul 12, 2015

@shinchiro openssl requires some native dependencies to build on windows, see this section from the rust-openssl README: https://github.com/sfackler/rust-openssl#windows.

@abonander
Copy link
Contributor

I have a weirder, but I think related, error:

$ cargo test --features hyper
   Compiling rand v0.3.8
   Compiling num_cpus v0.2.6
   Compiling winapi v0.1.23
   Compiling log v0.3.1
   Compiling memchr v0.1.3
   Compiling url v0.2.36
   Compiling openssl-sys v0.6.4
Build failed, waiting for other jobs to finish...
failed to run custom build command for `openssl-sys v0.6.4`
Process didn't exit successfully: `C:\users\austin\Rust\multipart\target\debug\build\openssl-sys-765ddf9de3c5179c\build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=dylib=eay32
cargo:rustc-link-lib=dylib=ssl32
TARGET = Some("x86_64-pc-windows-gnu")
TARGET = Some("x86_64-pc-windows-gnu")
CARGO_MANIFEST_DIR = Some("C:\\msys64\\home\\Austin\\.cargo\\registry\\src\\github.com-0a35038f75765ae4\\openssl-sys-0.6.4")
OUT_DIR = Some("C:\\users\\austin\\Rust\\multipart\\target\\debug\\build\\openssl-sys-765ddf9de3c5179c\\out")
OPT_LEVEL = Some("0")
PROFILE = Some("debug")
debug 0
TARGET = Some("x86_64-pc-windows-gnu")
HOST = Some("x86_64-pc-windows-gnu")
CC_x86_64-pc-windows-gnu = None
CC_x86_64_pc_windows_gnu = None
HOST_CC = None
CC = None
TARGET = Some("x86_64-pc-windows-gnu")
HOST = Some("x86_64-pc-windows-gnu")
CFLAGS_x86_64-pc-windows-gnu = None
CFLAGS_x86_64_pc_windows_gnu = None
HOST_CFLAGS = None
CFLAGS = None
TARGET = Some("x86_64-pc-windows-gnu")
HOST = Some("x86_64-pc-windows-gnu")
CC_x86_64-pc-windows-gnu = None
CC_x86_64_pc_windows_gnu = None
HOST_CC = None
CC = None
running: "gcc" "-O0" "-c" "-ffunction-sections" "-fdata-sections" "-mwin32" "-m64" "-fPIC" "C:\msys64\home\Austin\.cargo\registry\src\github.com-0a35038f75765ae4\openssl-sys-0.6.4\src/openssl_shim.c" "-o" "C:\users\austin\Rust\multipart\target\debug\build\openssl-sys-765ddf9de3c5179c\out\src\openssl_shim.o"


command did not execute successfully, got: exit code: 1



--- stderr
C:\msys64\home\Austin\.cargo\registry\src\github.com-0a35038f75765ae4\openssl-sys-0.6.4\src/openssl_shim.c:1:0: warning: -fPIC ignored for target (all code is position independent)
 #include <openssl/hmac.h>
 ^
In file included from /usr/include/openssl/x509.h:107:0,
                 from /usr/include/openssl/ssl.h:156,
                 from C:\msys64\home\Austin\.cargo\registry\src\github.com-0a35038f75765ae4\openssl-sys-0.6.4\src/openssl_shim.c:2:
/usr/include/openssl/sha.h:184:16: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘h’
     SHA_LONG64 h[8];
                ^
thread '<main>' panicked at 'explicit panic', C:\msys64\home\Austin\.cargo\registry\src\github.com-0a35038f75765ae4\gcc-0.3.8\src\lib.rs:497

Compiling with MSYS2, I made sure OpenSSL was installed with pacman -S openssl. Maybe gcc is trying to link with the wrong dialect for the header file? I dunno.

@seanmonstar
Copy link
Member

Also, if you don't want https support (or at least, from openssl), you can
disable the 'ssl' feature.

On Tue, Jul 14, 2015, 6:37 AM Artem notifications@github.com wrote:

It's not about the OpenSSL installation!
Mind this message above: "failed to execute command: The system cannot
find the file specified.
"
The message says that gcc tried to execute something and failed.

If you run with cargo build --verbose and then manually repeat the gcc
command with an extra -v flag then you'll see gcc trying to execute cc1
and there's no cc1 in the Rust installation.

smolny:~/AgaSleep$ gcc -v -O0 -c -ffunction-sections -fdata-sections -mwin32 -m64 -fPIC -I c:/spool/OpenSSL-Win64/include C:/spool/cygwin/home/Artem/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-sys-0.6.4/src/openssl_shim.c -o C:/spool/Promo/projects/AgaSleep/target/debug/build/openssl-sys-765ddf9de3c5179c/out/src/openssl_shim.o
Using built-in specs.
COLLECT_GCC=C:\spool\Rust\bin\rustlib\x86_64-pc-windows-gnu\bin\gcc.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-4.9.1/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw491/x86_64-491-win32-seh-rt_v3-rev1/mingw64 --with-gxx-include-dir=/mingw64/x86_64-w64-mingw32/include/c++ --enable-shared --enable-static --disable-multilib --enable-languages=ada,c,c++,fortran,objc,obj-c++,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw491/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw4
91/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw491/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw491/prerequisites/x86_64-w64-mingw32-static --with-cloog=/c/mingw491/prerequisites/x86_64-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='x86_64-win32-seh-rev1, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/c/mingw491/x86_64-491-win32-seh-rt_v3-rev1/mingw64/opt/include -I/c/mingw491/prerequisites/x86_64-zlib-static/include -I/c/mingw491/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/c/mingw491/x86_64-491-win32-seh-rt_v3-rev1/mingw64/opt/include -I/c/mingw491/prerequisites/x86_64-zlib-static/include -I/c/mingw491/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/c/mingw491/x86_64-491-win32-seh-rt_v3-rev1/mingw64/opt/lib -L/c/mingw491/prerequisites/x86_64-zlib-static/lib -L/c/mingw491/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: win32
gcc version 4.9.1 (x86_64-win32-seh-rev1, Built by MinGW-W64 project)
COLLECT_GCC_OPTIONS='-v' '-O0' '-c' '-ffunction-sections' '-fdata-sections' '-mwin32' '-m64' '-fPIC' '-I' 'c:/spool/OpenSSL-Win64/include' '-o' 'C:/spool/Promo/projects/AgaSleep/target/debug/build/openssl-sys-765ddf9de3c5179c/out/src/openssl_shim.o' '-mtune=core2' '-march=nocona'
cc1 -quiet -v -I c:/spool/OpenSSL-Win64/include -iprefix C:/spool/Rust/bin/rustlib/x86_64-pc-windows-gnu/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/ -U_REENTRANT C:/spool/cygwin/home/Artem/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-sys-0.6.4/src/openssl_shim.c -quiet -dumpbase openssl_shim.c -mwin32 -m64 -mtune=core2 -march=nocona -auxbase-strip C:/spool/Promo/projects/AgaSleep/target/debug/build/openssl-sys-765ddf9de3c5179c/out/src/openssl_shim.o -O0 -version -ffunction-sections -fdata-sections -fPIC -o C:\spool\cygwin\tmp\ccZSgpmE.s
gcc.exe: error: CreateProcess: No such file or directory


Reply to this email directly or view it on GitHub
#607 (comment).

@semmaz
Copy link

semmaz commented Jul 23, 2015

@cybergeek94 Im pretty sure you're using wrong gcc, MSYS2 one, instead of gcc that comes with mingw-w64-x86_64-toolchain. Maybe you missed step 3 from here?

To make sure see what $ which gcc gives you (should be /mingw64/bin/gcc). Also, with pacman -S openssl you, most likely, just reinstalled openssl that used by msys2, while openssl that youl need comes with mingw-w64-x86_64-toolchain and have name mingw-w64-x86_64-openssl, thus instead of pacman -S something use pacman -S mingw-w64-x86_64-something to get missing package

@semmaz
Copy link

semmaz commented Jul 23, 2015

@shinchiro I think something "wrong" with your gcc setup (see this issue from gcc-rs). If you want to build hyper with openssl just follow build instructions from rust repo (this also mentioned in rust-openssl here).

@shinchiro
Copy link
Author

@semmaz Thanks..finally I managed to compile hyper via mingw64_shell.bat.

But is it possible to compile it inside IDE like atom (build package) with mingw64_shell or something like that

@semmaz
Copy link

semmaz commented Jul 24, 2015

@shinchiro Just bring gcc from mingw-w64-x86_64-toolchain into PATH environment variable (e.g. set PATH=C:\msys64\mingw64\bin;%PATH%), preferably temporarily, as this might cause issue with cmd elsewhere, and you should be golden.

As for atom specific build package, this is achievable with custom build command, but, it seems that setting PATH with this is broken right now on windows, you might overcome this by good old bat file:

set PATH=C:\msys64\mingw64\bin;%PATH%
cargo build

and launching it from custom build command.

@shinchiro
Copy link
Author

Got it..thanks :)
To make the bat more flexible, I changed to this so it can accept any parameter aside 'build'

set PATH=C:\msys64\mingw64\bin;%PATH%
cargo %*

@seanmonstar
Copy link
Member

Closing as this seems to be an openssl issue, and it seems to have been fixed-ish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants