Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error when compiling on Windows #8

Open
AlexisHuvier opened this issue Apr 6, 2020 · 10 comments
Open

Error when compiling on Windows #8

AlexisHuvier opened this issue Apr 6, 2020 · 10 comments

Comments

@AlexisHuvier
Copy link

AlexisHuvier commented Apr 6, 2020

Hey, i want to use rust-qt but when i launch a basic example i have this error :

CMake Error at CMakeLists.txt:5 (project):
  The CMAKE_CXX_COMPILER:

    C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe

  is not a full path to an existing compiler tool.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


[2020-04-06T23:19:15Z ERROR ritual_common::errors] Error:
[2020-04-06T23:19:15Z ERROR ritual_common::errors]    command failed with exit code: 1: "cmake" "-Wno-dev" "C:\\Users\\LavaPower\\.cargo\\registry\\src\\github.heygears.com-1ecc6299db9ec823\\qt_ui_tools-0.5.0\\c_lib" "-G" "NMake Makefiles" "-DRITUAL_LIBRARY_TYPE=STATIC" "-DRITUAL_CPP_LIB_VERSION=51300" "-DRITUAL_INCLUDE_PATH=D:/Qt/5.13.0/msvc2017_64/include;D:/Qt/5.13.0/msvc2017_64/include\\QtUiTools;D:/Qt/5.13.0/msvc2017_64/include\\QtCore;D:/Qt/5.13.0/msvc2017_64/include\\QtGui;D:/Qt/5.13.0/msvc2017_64/include\\QtWidgets" "-DRITUAL_LIBRARY_PATH=D:/Qt/5.13.0/msvc2017_64/lib" "-DRITUAL_FRAMEWORK_PATH=" "-DRITUAL_LINKED_LIBS=Qt5UiTools;Qt5Core;Qt5Gui;Qt5Widgets" "-DRITUAL_LINKED_FRAMEWORKS=" "-DRITUAL_COMPILER_FLAGS=" "-DRITUAL_QT=1" "-DRITUAL_QT=1" "-DRITUAL_QT=1" "-DRITUAL_QT=1" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=D:\\Programmation\\Rust\\lycos_novation\\target\\debug\\build\\qt_ui_tools-371e25d1510ccec1\\out\\c_lib_install"

Thanks.

@AlexisHuvier
Copy link
Author

I got another error :

 Change Dir: D:/Programmation/Rust/lycos_novation/target/debug/build/qt_ui_tools-371e25d1510ccec1/out/c_lib_build/CMakeFiles/CMakeTmp

    Run Build Command(s):nmake /nologo cmTC_cf498\fast &&       "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX64\x64\nmake.exe" -f CMakeFiles\cmTC_cf498.dir\build.make /nologo -L                  CMakeFiles\cmTC_cf498.dir\build
    Building C object CMakeFiles/cmTC_cf498.dir/testCCompiler.c.obj
        C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1425~1.286\bin\Hostx64\x64\cl.exe @C:\Users\LAVAPO~1\AppData\Local\Temp\nm4C5D.tmp
    testCCompiler.c
    Linking C executable cmTC_cf498.exe
        D:\CMake\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_cf498.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests  -- D:\MinGW\bin\ld.exe /nologo @CMakeFiles\cmTC_cf498.dir\objects1.rsp @C:\Users\LAVAPO~1\AppData\Local\Temp\nm4D09.tmp
    Visual Studio Incremental Link with embedded manifests
    Create CMakeFiles\cmTC_cf498.dir/manifest.rc
    Create empty: CMakeFiles\cmTC_cf498.dir/embed.manifest
    RC Pass 1:
    C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe /fo CMakeFiles\cmTC_cf498.dir/manifest.res CMakeFiles\cmTC_cf498.dir/manifest.rc
    LINK Pass 1:
    D:\MinGW\bin\ld.exe /nologo @CMakeFiles\cmTC_cf498.dir\objects1.rsp /out:cmTC_cf498.exe /implib:cmTC_cf498.lib /pdb:D:\Programmation\Rust\lycos_novation\target\debug\build\qt_ui_tools-371e25d1510ccec1\out\c_lib_build\CMakeFiles\CMakeTmp\cmTC_cf498.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_cf498.dir/intermediate.manifest CMakeFiles\cmTC_cf498.dir/manifest.res
    LINK Pass 1: command "D:\MinGW\bin\ld.exe /nologo @CMakeFiles\cmTC_cf498.dir\objects1.rsp /out:cmTC_cf498.exe /implib:cmTC_cf498.lib /pdb:D:\Programmation\Rust\lycos_novation\target\debug\build\qt_ui_tools-371e25d1510ccec1\out\c_lib_build\CMakeFiles\CMakeTmp\cmTC_cf498.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_cf498.dir/intermediate.manifest CMakeFiles\cmTC_cf498.dir/manifest.res" failed (exit code 1) with the following output:
    D:\MinGW\bin\ld.exe: cannot find /nologo: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find /out:cmTC_cf498.exe: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find /implib:cmTC_cf498.lib: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find /pdb:D:\Programmation\Rust\lycos_novation\target\debug\build\qt_ui_tools-371e25d1510ccec1\out\c_lib_build\CMakeFiles\CMakeTmp\cmTC_cf498.pdb: Invalid argument
    D:\MinGW\bin\ld.exe: cannot find /version:0.0: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find /machine:x64: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find /debug: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find /INCREMENTAL: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find /subsystem:console: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find kernel32.lib: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find user32.lib: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find gdi32.lib: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find winspool.lib: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find shell32.lib: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find ole32.lib: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find oleaut32.lib: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find uuid.lib: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find comdlg32.lib: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find advapi32.lib: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find /MANIFEST: No such file or directory
    D:\MinGW\bin\ld.exe: cannot find /MANIFESTFILE:CMakeFiles\cmTC_cf498.dir/intermediate.manifest: Invalid argument
    CMakeFiles\cmTC_cf498.dir/manifest.res: file not recognized: File format not recognized
    NMAKE : fatal error U1077: 'D:\CMake\bin\cmake.exe'á: code retour '0xffffffff'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX64\x64\nmake.exe"'á: code retour '0x2'
    Stop.





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:5 (project)


[2020-04-10T13:07:23Z ERROR ritual_common::errors] Error:
[2020-04-10T13:07:23Z ERROR ritual_common::errors]    command failed with exit code: 1: "cmake" "-Wno-dev" "C:\\Users\\LavaPower\\.cargo\\registry\\src\\github.heygears.com-1ecc6299db9ec823\\qt_ui_tools-0.5.0\\c_lib" "-G" "NMake Makefiles" "-DRITUAL_LIBRARY_TYPE=STATIC" "-DRITUAL_CPP_LIB_VERSION=51300" "-DRITUAL_INCLUDE_PATH=D:/Qt/5.13.0/msvc2017_64/include;D:/Qt/5.13.0/msvc2017_64/include\\QtUiTools;D:/Qt/5.13.0/msvc2017_64/include\\QtCore;D:/Qt/5.13.0/msvc2017_64/include\\QtGui;D:/Qt/5.13.0/msvc2017_64/include\\QtWidgets" "-DRITUAL_LIBRARY_PATH=D:/Qt/5.13.0/msvc2017_64/lib" "-DRITUAL_FRAMEWORK_PATH=" "-DRITUAL_LINKED_LIBS=Qt5UiTools;Qt5Core;Qt5Gui;Qt5Widgets" "-DRITUAL_LINKED_FRAMEWORKS=" "-DRITUAL_COMPILER_FLAGS=" "-DRITUAL_QT=1" "-DRITUAL_QT=1" "-DRITUAL_QT=1" "-DRITUAL_QT=1" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=D:\\Programmation\\Rust\\lycos_novation\\target\\debug\\build\\qt_ui_tools-371e25d1510ccec1\\out\\c_lib_install"

@Riateche
Copy link
Member

Your first error says:

To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

Make sure you're running cargo from the Visual Studio Command Prompt.

In your second error, cmake is using the Visual Studio compiler and MinGW's linker. Those are not compatible. Your rust toolchain, C++ toolchain, and Qt version must use the same vendor (MSVC or MinGW). MSVC is recommended, as MinGW builds aren't tested.

Perhaps the Setting up page of the guide will be helpful.

@AlexisHuvier
Copy link
Author

I have an other error :

CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: D:/Programmation/Rust/lycos_novation/target/debug/build/qt_widgets-f90558b415a34f3b/out/c_lib_build/CMakeFiles/CMakeTmp

    Run Build Command(s):nmake /nologo cmTC_7b2de\fast &&       "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\nmake.exe"  -f CMakeFiles\cmTC_7b2de.dir\build.make /nologo -L                  CMakeFiles\cmTC_7b2de.dir\build
    Building C object CMakeFiles/cmTC_7b2de.dir/testCCompiler.c.obj
        C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1425~1.286\bin\Hostx64\x64\cl.exe @C:\Users\LAVAPO~1\AppData\Local\Temp\nm9A1E.tmp
    testCCompiler.c
    Linking C executable cmTC_7b2de.exe
        "C:\Program Files (x86)\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_7b2de.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests  -- D:\MinGW\bin\ld.exe /nologo @CMakeFiles\cmTC_7b2de.dir\objects1.rsp @C:\Users\LAVAPO~1\AppData\Local\Temp\nm9A7C.tmp
    LINK Pass 1: command "D:\MinGW\bin\ld.exe /nologo @CMakeFiles\cmTC_7b2de.dir\objects1.rsp /out:cmTC_7b2de.exe /implib:cmTC_7b2de.lib /pdb:D:\Programmation\Rust\lycos_novation\target\debug\build\qt_widgets-f90558b415a34f3b\out\c_lib_build\CMakeFiles\CMakeTmp\cmTC_7b2de.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_7b2de.dir/intermediate.manifest CMakeFiles\cmTC_7b2de.dir/manifest.res" failed (exit code 0) with the following output:
    Le fichier spécifié est introuvableNMAKE : fatal error U1077: '"C:\Program Files (x86)\CMake\bin\cmake.exe"'á: code retour '0xffffffff'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX64\x86\nmake.exe"'á: code retour '0x2'
    Stop.





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:5 (project)


[2020-04-20T21:21:04Z ERROR ritual_common::errors] Error:
[2020-04-20T21:21:04Z ERROR ritual_common::errors]    command failed with exit code: 1: "cmake" "-Wno-dev" "C:\\Users\\LavaPower\\.cargo\\registry\\src\\github.heygears.com-1ecc6299db9ec823\\qt_widgets-0.5.0\\c_lib" "-G" "NMake Makefiles" "-DRITUAL_LIBRARY_TYPE=STATIC" "-DRITUAL_CPP_LIB_VERSION=51300" "-DRITUAL_INCLUDE_PATH=D:/Qt/5.13.0/msvc2017_64/include;D:/Qt/5.13.0/msvc2017_64/include\\QtWidgets;D:/Qt/5.13.0/msvc2017_64/include\\QtCore;D:/Qt/5.13.0/msvc2017_64/include\\QtGui" "-DRITUAL_LIBRARY_PATH=D:/Qt/5.13.0/msvc2017_64/lib" "-DRITUAL_FRAMEWORK_PATH=" "-DRITUAL_LINKED_LIBS=Qt5Widgets;Qt5Core;Qt5Gui" "-DRITUAL_LINKED_FRAMEWORKS=" "-DRITUAL_COMPILER_FLAGS=" "-DRITUAL_QT=1" "-DRITUAL_QT=1" "-DRITUAL_QT=1" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=D:\\Programmation\\Rust\\lycos_novation\\target\\debug\\build\\qt_widgets-f90558b415a34f3b\\out\\c_lib_install"

I see Le fichier spécifié est introuvableNMAKE : fatal error U1077: '"C:\Program Files (x86)\CMake\bin\cmake.exe"'á: code retour '0xffffffff' but this file exist.

@Riateche
Copy link
Member

You should remove MinGW paths from environment variables in your prompt. MinGW cannot be used together with MSVC, and something in your environment causes cmake to use D:\MinGW\bin\ld.exe.

@AlexisHuvier
Copy link
Author

I remove MinGW paths but cmake use D:\MinGW\bin\ld.exe... How to remove that ?

@Riateche
Copy link
Member

I don't know. Maybe this issue is related. Do you have the latest cmake installed? The set command prints all environment variables, so you can run it and check for MinGW paths in them.

@AlexisHuvier
Copy link
Author

I remove MinGW Path from set command and i use the latest cmake, but same error...

@LordMZTE
Copy link

LordMZTE commented Oct 11, 2020

im having the same issue. cmake is also using mingw, however i removed it from my env variables already and when i simply run ld it is not finding anything.

@SinsofSloth
Copy link

SinsofSloth commented Jan 20, 2021

I remove MinGW Path from set command and i use the latest cmake, but same error...

@AlexisHuvier your CMake is still using VS 2019. Check your env variables for CMAKE_PREFIX_PATH and QT5_DIR and make sure it's configured for MSVC 2017. Clear your /target of your work directory--if you built previously-- so ritual can generate a new solution.

@qiuelng
Copy link

qiuelng commented Jun 7, 2024

I remove MinGW Path from set command and i use the latest cmake, but same error...

restart your computor ,and Re Extract the original code zip file to a new file and recompile the project...this way works on my computer

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

No branches or pull requests

5 participants