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

Tutorial demo project bzip cannot be compiled with GNU toolchain on Windows #1527

Open
cheblin opened this issue Mar 2, 2019 · 1 comment

Comments

@cheblin
Copy link

cheblin commented Mar 2, 2019

I'v got tutorial bzip2 demo project and add C source files.
got compiler error:
under MSVC toolchain it compiled but some complains on generated bindings.
under GNU toolchain it cannot be compiled. the error:

Compiling bindgen-tutorial-bzip2-sys v0.1.0 (D:\bindgen-tutorial-bzip2-sys-master)
error: failed to run custom build command for `bindgen-tutorial-bzip2-sys v0.1.0 (D:\bindgen-tutorial-bzip2-sys-master)`
process didn't exit successfully: `D:\bindgen-tutorial-bzip2-sys-master\target\debug\build\bindgen-tutorial-bzip2-sys-6642fcf83988627d\build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=bz2

--- stderr
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\vadefs.h:28:33: error: expected ';' after top level declarator
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\vcruntime.h:83:1: error: expected identifier
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\vcruntime.h:83:20: error: expected ';' after top level declarator
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\vcruntime.h:180:29: error: expected ';' after top level declarator
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\vcruntime.h:283:51: error: unknown type name 'uintptr_t'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\vcruntime.h:284:67: error: unknown type name 'uintptr_t'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\vcruntime.h:288:8: error: unknown type name 'uintptr_t'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\vcruntime.h:296:1: error: a parameter list without types is only allowed in a function definition
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h:12:1: error: expected function body after function declarator
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h:287:16: error: unknown type name 'uintptr_t'
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h:561:13: error: unknown type name 'size_t'
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h:2010:1: error: a parameter list without types is only allowed in a function definition
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_stdio_config.h:12:1: error: expected function body after function declarator
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_stdio_config.h:31:10: error: Unsupported architecture
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_wstdio.h:31:14: error: unknown type name 'FILE'
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_wstdio.h:49:17: error: unknown type name 'FILE'
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_wstdio.h:58:17: error: unknown type name 'FILE'
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_wstdio.h:67:17: error: unknown type name 'FILE'
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_wstdio.h:79:38: error: unknown type name 'FILE'
fatal error: too many errors emitted, stopping now [-ferror-limit=]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\vadefs.h:28:33: error: expected ';' after top level declarator, err: true
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\vcruntime.h:83:1: error: expected identifier, err: true
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\vcruntime.h:83:20: error: expected ';' after top level declarator, err: true
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\vcruntime.h:180:29: error: expected ';' after top level declarator, err: true
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\vcruntime.h:283:51: error: unknown type name 'uintptr_t', err: true
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\vcruntime.h:284:67: error: unknown type name 'uintptr_t', err: true
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\vcruntime.h:288:8: error: unknown type name 'uintptr_t', err: true
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\vcruntime.h:296:1: error: a parameter list without types is only allowed in a function definition, err: true
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h:12:1: error: expected function body after function declarator, err: true
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h:287:16: error: unknown type name 'uintptr_t', err: true
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h:561:13: error: unknown type name 'size_t', err: true
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h:2010:1: error: a parameter list without types is only allowed in a function definition, err: true
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_stdio_config.h:12:1: error: expected function body after function declarator, err: true
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_stdio_config.h:31:10: error: Unsupported architecture, err: true
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_wstdio.h:31:14: error: unknown type name 'FILE', err: true
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_wstdio.h:49:17: error: unknown type name 'FILE', err: true
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_wstdio.h:58:17: error: unknown type name 'FILE', err: true
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_wstdio.h:67:17: error: unknown type name 'FILE', err: true
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_wstdio.h:79:38: error: unknown type name 'FILE', err: true
fatal error: too many errors emitted, stopping now [-ferror-limit=], err: true
thread 'main' panicked at 'Unable to generate bindings: ()', src\libcore\result.rs:997:5
stack backtrace:
   0: std::sys_common::backtrace::_print
             at src\libstd\sys\windows\backtrace/mod.rs:95
             at src\libstd\sys\windows\backtrace/mod.rs:82
             at src\libstd\sys_common/backtrace.rs:71
   1: std::panicking::default_hook::{{closure}}
             at src\libstd\sys_common/backtrace.rs:59
             at src\libstd/panicking.rs:200
   2: std::panicking::default_hook
             at src\libstd/panicking.rs:215
   3: std::panicking::rust_panic_with_hook
             at src\libstd/panicking.rs:478
   4: std::panicking::continue_panic_fmt
             at src\libstd/panicking.rs:385
   5: rust_begin_unwind
             at src\libstd/panicking.rs:312
   6: core::panicking::panic_fmt
             at src\libcore/panicking.rs:85
   7: core::result::unwrap_failed
             at /rustc/350674b7180a41c8e508d93c6ab8e203b69d3df7\src\libcore/macros.rs:17
   8: <core::result::Result<T, E>>::expect
             at /rustc/350674b7180a41c8e508d93c6ab8e203b69d3df7\src\libcore/result.rs:825
   9: build_script_build::main
             at .\build.rs:9
  10: std::rt::lang_start::{{closure}}
             at /rustc/350674b7180a41c8e508d93c6ab8e203b69d3df7\src\libstd/rt.rs:64
  11: std::panicking::try::do_call
             at src\libstd/rt.rs:49
             at src\libstd/panicking.rs:297
  12: _rust_maybe_catch_panic
             at src\libpanic_unwind/lib.rs:87
  13: std::rt::lang_start_internal
             at src\libstd/panicking.rs:276
             at src\libstd/panic.rs:388
             at src\libstd/rt.rs:48
  14: std::rt::lang_start
             at /rustc/350674b7180a41c8e508d93c6ab8e203b69d3df7\src\libstd/rt.rs:64
  15: main
  16: _tmainCRTStartup
  17: mainCRTStartup
  18: unit_addrs_search
  19: unit_addrs_search


Process finished with exit code 101

the demo project is available here
LLVM-7.0.1-win64
bindgen = "0.47.3"

sorry for nonformatted style.

@cheblin cheblin changed the title Tutorial demo project bzip cannot be compiled with GNU toolchain . Tutorial demo project bzip cannot be compiled with GNU toolchain on Windows Mar 2, 2019
@emilio
Copy link
Contributor

emilio commented Mar 28, 2019

I cannot debug this unfortunately, since I have no windows machine. The root cause may be a target mismatch, it may be worth trying on master, which has #1543, or try to add --target explicitly to the clang arguments in build.rs

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

2 participants