Build Slicer on Windows 10 Failed

Since it appears you are building Slicer Nightly/Preview, it is probably best to build with Qt5 support even though Qt4 is still technically supported. Build instructions for the Slicer nightly on Windows can be found here.

Also, your QT_QMAKE_EXECUTABLE entry was set to “C:/Qt/Qtcreator-2.5.2/bin/qtcreator.exe”. It should be something like “…QT_DIR/bin/qmake.exe”

Hi James and others,
I followed all the documentation and I am still getting the error.
I dont know why it is search for old version of qt when we have specified the qt 5.10. Any idea?
I didnt know this step where we have to QT5_DIR variable before pressing configure in cmake.
How can I set it. I added new entry with path option. I believe this is the variable.
Thanks.

You also need to set the Qt version to 5.10.

image

I haven’t tried lately on windows, but maybe you can just change that through the cmake gui and reconfigure.

Usually I avoid the guis and write a little command line so I can blow away the build directory and get back to a known state if needed.

e.g. here’s a script for building against a homebrow installation of qt on mac.

cmake \
  -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
  -DSlicer_VTK_RENDERING_BACKEND:STRING=OpenGL2 \
  -DSlicer_REQUIRED_QT_VERSION=5 \
  -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/local/opt/qt5/bin/qmake \
  -DQt5_DIR:FILEPATH=/usr/local/opt/qt5/lib/cmake/Qt5 \
  -DQt5Core_DIR:FILEPATH=/usr/local/opt/qt5/lib/cmake/Qt5Core \
  -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9 \
  -DSlicer_USE_PYTHONQT_WITH_TCL:BOOL=OFF \
  -DSlicer_USE_SimpleITK:BOOL=OFF \
  -DSlicer_USE_QtTesting:BOOL=ON \
  ~/slicer4/latest/Slicer

Yes @Mian_Asbat_Ahmad, the QT_QMAKE_EXECUTABLE entry is for building Slicer with Qt4, so you don’t need anything in that entry if you are going to build with Qt5. If you update the Slicer_REQUIRED_QT_VERSION to 5.10.0, then press Configure, a new entry will appear called Qt5_Dir and you will specify “C:/Qt/5.10.0/msvc2015_64/lib/cmake/Qt5”. The latest version for full functionality in a Windows build of Slicer is Qt 5.10 series in which case there is actually a Qt 5.10.1 release you can use. That’s what I’ve been using lately.

This is different advice from this build instructions section. There it mentions “Do not configure yet”, to manually add the Qt5_Dir entry, and then configure. Not entirely sure why it is specified in bold to do things in this order, but I find it easiest to do what I suggested above.

If a build tree is configured with a Qt version then you must build with that version, because any attempt to change to a different one will fail (it will be only partially successful; probably this is a bug in Qt CMake scripts). That is why it is very important to set Qt5_DIR before you configure the project.

If you have only one Qt version or CMake cannot find an incorrect Qt version then you may specify Qt5_DIR later, but in general you need to strictly follow the prescribed order.

Dear team,
Thank you for your response.
To clarify I didnt change Slicer_REQUIRED_QT_VERSION to 4.7.4. It was automatically picked following the guide.

Okay I am a bit hasty so I tried James suggestions in two steps. I will try CLI after I fixed the cmake-gui.

First I changed the Slicer_REQUIRED_QT_VERSION to 5.10.0 and run the configure and I got the following error.

I read more and found the second step so I set QT5_DIR to C:/Qt/5.10.0/msvc2015_64/lib/cmake/Qt5 and run configure again. This time the red colour disappeared but I still have a bug. Here is the screenshot.

Any idea for the new error. Do I have to install curl?

The error is about not finding External_curl.cmake file. It is located in slicer source tree in SuperBuild folder. If it is not there then the cloning of the repository was incomplete. Pull from the Slicer repository again and if you still don’t get the file then clone the repository again.

@lassoan many thanks, after downloading the project again the error disappeared. It is generated successfully.
Feedback: It would be very nice to have a separate guide for each major platform stable version windows, mac and linux because for new users like me it was difficult to follow and without your help it wouldn’t be possible.

Hello james.
I wnat to build Slicer ( 4.11 20200930) on Windows10 but build failed repeatedly.
My env is
Visual Studio 2017
Qt 5.10.1(include WebEngine,Script)
CMake 3.15.0-rc1.

There is no problem with Configuration in CMake(option Visual Studio 2017,x64) and generate too.
but when I build the ALL_BUILD in Slicer.sln , I see the Message of Build Fail 48 out of 54 …

And I can’t find Slicer.exe at Slicer_build\build\ or Slicer_build.
Did I do anything wrong?

image
image
image

S4R is Slicer-4.11.20200930 source code.
All_Build is failed so I can’t find Slicer.exe.
I tried to build this link.