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

Make the code compiles on Windows #1

Open
rgiot opened this issue May 18, 2024 · 0 comments
Open

Make the code compiles on Windows #1

rgiot opened this issue May 18, 2024 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@rgiot
Copy link
Contributor

rgiot commented May 18, 2024

I have no issues a all to compile these crates under Linux and to use them as dependencies of other projects.

However, I know nothing to windows compilation world and I hit an issue I am unable to solve myself. Some guidance is expected. The cradte does not compile on windows. Neither on my machine or the github pipeline.

cargo +nightly-x86_64-pc-windows-msvc test
fails with this error



    error: failed to run custom build command for hxcadaptor-sys v0.1.5 (C:\Users\giotr\Perso\CPC\hxc_rust\hxcadaptor-sys)

    Caused by:
    process didn't exit successfully: C:\Users\giotr\Perso\CPC\hxc_rust\target\debug\build\hxcadaptor-sys-e2dbf5a5627a8eb0\build-script-build (exit code: 101)
    --- stdout
    cargo:rerun-if-changed=build.rs
    cargo:rerun-if-changed=wrapper.h
    cargo:include=C:\Users\giotr\Perso\CPC\hxc_rust\target\debug\build\hxcadaptor-sys-8215fdc0317b9735\out\hxccode\libhxcadaptor\sources
    cargo:rustc-link-search=native=C:\Users\giotr\Perso\CPC\hxc_rust\target\debug\build\hxcadaptor-sys-8215fdc0317b9735\out\hxccode\libhxcadaptor\build
    cargo:rustc-link-lib=hxcadaptor
    cargo:rerun-if-env-changed=TARGET
    cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64-pc-windows-msvc
    cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64_pc_windows_msvc
    cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS

    --- stderr
    Really build the library
    gcc -o libhxcadaptor.o -c ../sources/libhxcadaptor.c -O3 -I../sources/ -I ../../libhxcfe/sources -I ../../libusbhxcfe/sources -I ../../build -Wall
    gcc -o fs.o -c ../sources/fs.c -O3 -I../sources/ -I ../../libhxcfe/sources -I ../../libusbhxcfe/sources -I ../../build -Wall
    gcc -o network.o -c ../sources/network.c -O3 -I../sources/ -I ../../libhxcfe/sources -I ../../libusbhxcfe/sources -I ../../build -Wall
    ar r libhxcadaptor.a libhxcadaptor.o fs.o network.o
    copy libhxcadaptor.a ....\build
    1 fichier(s) copi�(s).

    process_begin: CreateProcess(NULL, uname, ...) failed.
    Makefile:5: pipe: No error
    ar: creating libhxcadaptor.a

    Build the windows library
    Generate bindings
    clang version 17.0.6
    Target: x86_64-pc-windows-msvc
    Thread model: posix
    InstalledDir:
    ignoring nonexistent directory "lib\clang\17\include"
    ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 10.0/VC/include"
    ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 9.0/VC/include"
    ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include"
    ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 8/VC/include"
    ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include"
    #include "..." search starts here:
    #include <...> search starts here:
    C:\Users\giotr\Perso\CPC\hxc_rust\target\debug\build\hxcadaptor-sys-8215fdc0317b9735\out\hxccode\libhxcadaptor\sources
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include (framework directory)
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include
    C:\Program Files\LLVM\lib\clang\17\include
    End of search list.
    C:\Users\giotr\Perso\CPC\hxc_rust\target\debug\build\hxcadaptor-sys-8215fdc0317b9735\out\hxccode\libhxcadaptor\sources\libhxcadaptor.h:65:10: fatal error: 'sys/stat.h' file not found
    thread 'main' panicked at hxcadaptor-sys\build.rs:59:10:
    Unable to generate bindings: ClangDiagnostic("C:\Users\giotr\Perso\CPC\hxc_rust\target\debug\build\hxcadaptor-sys-8215fdc0317b9735\out\hxccode\libhxcadaptor\sources\libhxcadaptor.h:65:10: fatal error: 'sys/stat.h' file not found\n")
    note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

while cargo +nightly-x86_64-pc-windows-gnu test
fails with



    error: failed to run custom build command for hxcadaptor-sys v0.1.5 (C:\Users\giotr\Perso\CPC\hxc_rust\hxcadaptor-sys)

    Caused by:
    process didn't exit successfully: C:\Users\giotr\Perso\CPC\hxc_rust\target\debug\build\hxcadaptor-sys-38e0a4ba988ace0e\build-script-build (exit code: 101)
    --- stdout
    cargo:rerun-if-changed=build.rs
    cargo:rerun-if-changed=wrapper.h
    cargo:include=C:\Users\giotr\Perso\CPC\hxc_rust\target\debug\build\hxcadaptor-sys-f5334dff9f4ff3f4\out\hxccode\libhxcadaptor\sources
    cargo:rustc-link-search=native=C:\Users\giotr\Perso\CPC\hxc_rust\target\debug\build\hxcadaptor-sys-f5334dff9f4ff3f4\out\hxccode\libhxcadaptor\build
    cargo:rustc-link-lib=hxcadaptor
    cargo:rerun-if-env-changed=TARGET
    cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64-pc-windows-gnu
    cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64_pc_windows_gnu
    cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS

    --- stderr
    Really build the library
    gcc -o libhxcadaptor.o -c ../sources/libhxcadaptor.c -O3 -I../sources/ -I ../../libhxcfe/sources -I ../../libusbhxcfe/sources -I ../../build -Wall
    gcc -o fs.o -c ../sources/fs.c -O3 -I../sources/ -I ../../libhxcfe/sources -I ../../libusbhxcfe/sources -I ../../build -Wall
    gcc -o network.o -c ../sources/network.c -O3 -I../sources/ -I ../../libhxcfe/sources -I ../../libusbhxcfe/sources -I ../../build -Wall
    ar r libhxcadaptor.a libhxcadaptor.o fs.o network.o
    copy libhxcadaptor.a ....\build
    1 fichier(s) copi�(s).

    process_begin: CreateProcess(NULL, uname, ...) failed.
    Makefile:5: pipe: No error
    ar: creating libhxcadaptor.a

    Build the windows library
    Generate bindings
    clang version 17.0.6
    Target: x86_64-pc-windows-gnu
    Thread model: posix
    InstalledDir:
    ignoring nonexistent directory "lib\clang\17\include"
    ignoring nonexistent directory "C:\Strawberry\c\x86_64-w64-mingw32\usr/include"
    ignoring duplicate directory "C:\Strawberry\c\x86_64-w64-mingw32\include"
    ignoring duplicate directory "C:\Strawberry\c\include"
    #include "..." search starts here:
    #include <...> search starts here:
    C:\Users\giotr\Perso\CPC\hxc_rust\target\debug\build\hxcadaptor-sys-f5334dff9f4ff3f4\out\hxccode\libhxcadaptor\sources
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include (framework directory)
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include
    C:\Program Files\LLVM\lib\clang\17\include
    C:\Strawberry\c\x86_64-w64-mingw32\include
    C:\Strawberry\c\include
    End of search list.
    wrapper.h:83:26: error: expected ';' after top level declarator
    wrapper.h:84:21: error: typedef redefinition with different types ('unsigned int' vs 'int')
    wrapper.h:83:19: note: previous definition is here
    wrapper.h:84:28: error: expected ';' after top level declarator
    C:\Users\giotr\Perso\CPC\hxc_rust\target\debug\build\hxcadaptor-sys-f5334dff9f4ff3f4\out\hxccode\libhxcadaptor\sources\libhxcadaptor.h:37:1: error: unknown type name 'uintptr_t'
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vadefs.h:61:26: error: typedef redefinition with different types ('unsigned int' vs 'int')
    wrapper.h:83:19: note: previous definition is here
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vadefs.h:61:33: error: expected ';' after top level declarator
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:96:1: error: expected identifier
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:96:20: error: expected ';' after top level declarator
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:193:22: error: typedef redefinition with different types ('unsigned int' vs 'int')
    wrapper.h:83:19: note: previous definition is here
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:193:29: error: expected ';' after top level declarator
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:194:30: error: typedef redefinition with different types ('__int64' (aka 'int') vs 'long long')
    C:\Program Files\LLVM\lib\clang\17\include\stddef.h:35:26: note: previous definition is here
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:386:51: error: unknown type name 'uintptr_t'
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:387:67: error: unknown type name 'uintptr_t'
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:391:8: error: unknown type name 'uintptr_t'
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:399:1: error: a parameter list without types is only allowed in a function definition
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\crtdefs.h:10:10: fatal error: 'corecrt.h' file not found
    thread 'main' panicked at hxcadaptor-sys\build.rs:59:10:
    Unable to generate bindings: ClangDiagnostic("wrapper.h:83:26: error: expected ';' after top level declarator\nwrapper.h:84:21: error: typedef redefinition with different types ('unsigned int' vs 'int')\nwrapper.h:84:28: error: expected ';' after top level declarator\nC:\Users\giotr\Perso\CPC\hxc_rust\target\debug\build\hxcadaptor-sys-f5334dff9f4ff3f4\out\hxccode\libhxcadaptor\sources\libhxcadaptor.h:37:1: error: unknown type name 'uintptr_t'\nC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vadefs.h:61:26: error: typedef redefinition with different types ('unsigned int' vs 'int')\nC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vadefs.h:61:33: error: expected ';' after top level declarator\nC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:96:1: error: expected identifier\nC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:96:20: error: expected ';' after top level declarator\nC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:193:22: error: typedef redefinition with different types ('unsigned int' vs 'int')\nC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:193:29: error: expected ';' after top level declarator\nC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:194:30: error: typedef redefinition with different types ('__int64' (aka 'int') vs 'long long')\nC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:386:51: error: unknown type name 'uintptr_t'\nC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:387:67: error: unknown type name 'uintptr_t'\nC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:391:8: error: unknown type name 'uintptr_t'\nC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:399:1: error: a parameter list without types is only allowed in a function definition\nC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\crtdefs.h:10:10: fatal error: 'corecrt.h' file not found\n")

I am pretty sure at the early stages of development of these crates, I have been able to build them at least with one of these versions of rustc.
I do not expect anyone to solve the issue at my place, but I will be very greatful to have some guidance to know where to look at.

@rgiot rgiot added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant