Compiling on Windows: No Freecad.sln file

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
azerupi
Posts: 6
Joined: Sun Jan 03, 2021 11:45 am

Compiling on Windows: No Freecad.sln file

Post by azerupi »

Hi,

I have successfully compiled FreeCAD on Linux, but now I am trying to compile it on Windows because that is where I use FreeCAD the most at the moment. However, I am having some difficulties.

I am following along with the instructions on the Wiki: https://wiki.freecadweb.org/Compile_on_Windows
Cmake seems to successfully generate something but there are no *.sln files to be found anywhere. The CMake-GUI also keeps the "Open Project" button disabled. There must be something wrong with my configuration / environment but I can't figure out what.

Here is the summary from CMake:

Code: Select all

==============
Summary report
==============

Compiler:            C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe (19.28.29336.0)
Flags:               /DWIN32 /D_WINDOWS /W3 /GR /EHsc
Standard:            Requires C++11
Python:              [L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/bin/python.exe] [.cp38-win_amd64]
PCL:                 1.9.1
pybind11:            not enabled
Boost:               106700
XercesC:             [debug;L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/lib/xerces-c_3D.lib;optimized;L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/lib/xerces-c_3.lib] [L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/include]
ZLIB:                1.2.11
PyCXX:               [L:/Documents/Projects/FreeCAD/FreeCAD/src]
OCC:                 7.5.0 [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBool;TKBO;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEPBase;TKSTEPAttr;TKSTEP209;TKSTEP;TKHLR;TKFeat] [L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/lib] [L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/inc]
SMESH:               build internal
 MEDFile:            [L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/lib/medC.lib] [L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/include]
 HDF5:               
 VTK:                8.2.0
NETGEN:              6.2.2006 (6.2.2006-19-gb37a3e6c) [-DNO_PARALLEL_THREADS;-DOCCGEOMETRY;-DNETGEN_VERSION=395734] [] [L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/include/include;L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/include] [nglib] [L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/include/include;L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/include]
SWIG:                4.0.2
Eigen3               3.3.90
Qt5Core:             5.15.1
Qt5Network:          5.15.1
Qt5Xml:              5.15.1
Qt5XmlPatterns:      5.15.1
Qt5Widgets:          5.15.1
Qt5PrintSupport:     5.15.1
Qt5OpenGL:           5.15.1
Qt5Svg:              5.15.1
Qt5UiTools:          5.15.1
Qt5Concurrent:       5.15.1
Qt5WebEngineWidgets: 5.15.1
Qt5WinExtras:        5.15.1
Shiboken2:           5.15.0 [L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/lib/cmake/Shiboken2-5.15.0] [L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/include/shiboken2;L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/bin/include]
PySide2:             5.15.0 [L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/include/PySide2]
PySide2Tools:        [L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/bin/uic.exe] [L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/bin/rcc.exe]
Freetype:            2.10.1
OpenGLU:             glu32 [glu32][]
Coin3D:              [optimized;L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/lib/Coin4.lib;debug;L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/lib/Coin4d.lib] [L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17/include]
Matplotlib:          3.3.3
Rift:                not enabled (BUILD_VR)
Doxygen:             not found
=======================================
Created install commands for INSTALL target.

=================================================
Now run 'cmake --build L:/Documents/Projects/FreeCAD/cmake-build-freecad' to build FreeCAD
=================================================

Configuring done
When I search for *.sln files I see nothing in the build directory:

Code: Select all

PS L:\Documents\Projects\FreeCAD> ls


    Directory: L:\Documents\Projects\FreeCAD


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         1/20/2021   4:43 PM                cmake-build-freecad
d-----         1/20/2021   4:45 PM                FreeCAD
d-----          1/3/2021   5:52 PM                FreeCADLibs_12.4.2_x64_VC17
d-----          1/3/2021   5:37 PM                FreeCAD_0.19.23546_Win-LPv12.1.6_vc14.x-x86-64

PS L:\Documents\Projects\FreeCAD> fd .sln
FreeCADLibs_12.4.2_x64_VC17\bin\swig\Examples\csharp\class\example.sln
FreeCADLibs_12.4.2_x64_VC17\bin\swig\Examples\csharp\callback\example.sln
FreeCADLibs_12.4.2_x64_VC17\bin\swig\Examples\csharp\variables\example.sln
FreeCADLibs_12.4.2_x64_VC17\bin\swig\Examples\csharp\arrays\example.sln
FreeCADLibs_12.4.2_x64_VC17\bin\swig\Examples\csharp\template\example.sln
FreeCADLibs_12.4.2_x64_VC17\bin\swig\Examples\csharp\simple\example.sln
FreeCADLibs_12.4.2_x64_VC17\bin\swig\Examples\csharp\nested\example.sln
FreeCADLibs_12.4.2_x64_VC17\bin\swig\Examples\csharp\funcptr\example.sln
FreeCADLibs_12.4.2_x64_VC17\bin\swig\Examples\csharp\reference\example.sln
FreeCADLibs_12.4.2_x64_VC17\bin\swig\Examples\csharp\extend\example.sln
FreeCADLibs_12.4.2_x64_VC17\bin\swig\Examples\csharp\enum\example.sln
FreeCAD\src\Mod\Cam\Cam.sln
FreeCAD\src\Tools\thumbs\FCThumbs.sln
FreeCAD\src\Tools\embedded\Win32\FreeCAD_widget.sln
FreeCAD\src\Tools\plugins\widget\FreeCAD_widgets.sln
FreeCAD\src\3rdParty\CxImage\CxImgLib.sln
Does anyone have an idea of what I am doing wrong?

Trying with CLion
I also tried to compile FreeCAD using JetBrain's CLion IDE (still on Windows). CLion does not use Visual Studio generator but NMake, if I am not mistaken. I use the following options for CMake:

Code: Select all

-DFREECAD_LIBPACK_DIR=L:/Documents/Projects/FreeCAD/FreeCADLibs_12.4.2_x64_VC17
-DBUILD_QT5=ON
-DFREECAD_COPY_DEPEND_DIRS_TO_BUILD=ON
-DFREECAD_COPY_LIBPACK_BIN_TO_BUILD=ON
-DFREECAD_COPY_PLUGINS_BIN_TO_BUILD=ON
The generation works without any problems and in this case I can actually compile successfully. However when I run the created FreeCAD executable I get the following error in the Python runtime:
freecad-clion-gilstate-exception.png
freecad-clion-gilstate-exception.png (15.57 KiB) Viewed 1423 times
Here again, my Google searches have not been very fruitful. At some point I thought that the python version used was not the correct one, so I explicitly set the paths to the python executable and libs in libpack, but that did not resolve the issue. I know this compilation method is not "officially" supported. But maybe someone had a similar issue in the past and has some ideas what might be causing this?

I hope we can find a solution for one or both problems above :)
kisolre
Veteran
Posts: 4166
Joined: Wed Nov 21, 2018 1:13 pm

Re: Compiling on Windows: No Freecad.sln file

Post by kisolre »

azerupi wrote: Wed Jan 20, 2021 7:09 pm Here is the summary from CMake:
Here we see just the Configuration part. You need to Generate the solution after that.
azerupi
Posts: 6
Joined: Sun Jan 03, 2021 11:45 am

Re: Compiling on Windows: No Freecad.sln file

Post by azerupi »

Well that is embarrassing. I somehow missed that line in the procedure from the wiki and got me stuck for a couple of days. Since CMake had generated a bunch of files I didn't think it was a two-step process.

It's building right now, thanks a lot for the help!

Edit: The compilation took way longer on Windows than on Linux, but in the end it works!
georgeATX
Posts: 21
Joined: Thu Jan 07, 2021 11:22 pm

Re: Compiling on Windows: No Freecad.sln file

Post by georgeATX »

I'm also seeing the error about gilstate->autoInterpreterState with CMake in the MSVS IDE. Did you figure out the fix for this?

Image
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Compiling on Windows: No Freecad.sln file

Post by GeneFC »

georgeATX wrote: Tue Feb 23, 2021 2:33 pm Did you figure out the fix for this?
Did you read the two posts right above yours?

Gene
georgeATX
Posts: 21
Joined: Thu Jan 07, 2021 11:22 pm

Re: Compiling on Windows: No Freecad.sln file

Post by georgeATX »

GeneFC wrote: Tue Feb 23, 2021 3:28 pm
georgeATX wrote: Tue Feb 23, 2021 2:33 pm Did you figure out the fix for this?
Did you read the two posts right above yours?
Yes. In my case I see,

Code: Select all

1> [CMake] 
1> [CMake] -- Configuring done
1> [CMake] -- Generating done
I'm going to try installing again. There's a chance I didn't save the relevant options before generating the solution.
georgeATX
Posts: 21
Joined: Thu Jan 07, 2021 11:22 pm

Re: Compiling on Windows: No Freecad.sln file

Post by georgeATX »

The problem was that I was trying to use CMake from within the IDE. Coming from Linux the IDE is disorienting at first. With standalone CMake I was able to get a successful build. I'm now running into an issue with shiboken and missing DLLs. Going through this thread to try to resolve. Wondering if the libpack has everything needed for the assembly3 branch I'm building.
Last edited by georgeATX on Wed Feb 24, 2021 8:15 pm, edited 1 time in total.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Compiling on Windows: No Freecad.sln file

Post by sgrogan »

georgeATX wrote: Wed Feb 24, 2021 4:22 pm Wondering if the libpack has everything needed for the assembly3 branch I'm building.
No, assembly3 relies on a custom build of solvespace
"fight the good fight"
georgeATX
Posts: 21
Joined: Thu Jan 07, 2021 11:22 pm

Re: Compiling on Windows: No Freecad.sln file

Post by georgeATX »

Got it to work after fixing a typo I had in PYTHON_LIBRARY_DEBUG.
fredcoach
Posts: 6
Joined: Thu Feb 04, 2021 2:17 pm
Location: France

Re: Compiling on Windows: No Freecad.sln file

Post by fredcoach »

Hello,
I got the same problem, no sln file.
After I found this thread, I am trying to use cmake to generate the sln file.
But the explanation is extremely terse, things which are obvious for you are not for somebody who is not used to cmake.

cmake gives this error message:
"CMake Error: The source "D:/git/freecad/freecad/src/CMakeLists.txt" does not match the source "D:/git/freecad/freecad/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory."

I looked at these 2 files and they are completely different:
D:/git/freecad/freecad/src/CMakeLists.txt contains

add_subdirectory(Build)
add_subdirectory(3rdParty)
add_subdirectory(Base)
add_subdirectory(App)
add_subdirectory(Main)
add_subdirectory(Mod)
add_subdirectory(Ext)
add_subdirectory(Doc)

if(BUILD_GUI)
add_subdirectory(Gui)
if(UNIX AND NOT APPLE)
add_subdirectory(XDGData)
endif()
endif(BUILD_GUI)

if(BUILD_TEMPLATE)
add_subdirectory(Tools/_TEMPLATE_)
endif(BUILD_TEMPLATE)


if(FREECAD_CREATE_MAC_APP)
add_subdirectory(MacAppBundle)
endif(FREECAD_CREATE_MAC_APP)


and D:/git/freecad/freecad/CMakeLists.txt contains

# april 2020, the oldest we have to support : Ununtu 16.04 LTS (Xenial)
cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR)

# policy CMP0072 was introduced with CMake 3.11
# relates to FindOpenGL module
# and cache variables OPENGL_gl_LIBRARY, OPENGL_glu_LIBRARY
if (POLICY CMP0072)
cmake_policy(SET CMP0072 OLD)
endif(POLICY CMP0072)

find_program(CCACHE_PROGRAM ccache) #This check should occur before project()
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()

project(FreeCAD)

set(PACKAGE_VERSION_NAME "Vulcan")
set(PACKAGE_VERSION_MAJOR "0")
set(PACKAGE_VERSION_MINOR "19")
set(PACKAGE_VERSION_PATCH "16100")
set(PACKAGE_VERSION_SUFFIX "dev") # either "dev" for development snapshot or "" (empty string)
set(FREECAD_VERSION_PATCH "0") # number of patch release (e.g. "4" for the 0.18.4 release)

set(FREECAD_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
set(PACKAGE_STRING "${PROJECT_NAME} ${PACKAGE_VERSION}")

# include local modules
include(CheckCXXCompilerFlag)
include(AddFileDependencies)
include(cMake/FreeCadMacros.cmake)
# include helper functions/macros
add_subdirectory(cMake/FreeCAD_Helpers)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cMake")

CompilerChecksAndSetups()
ConfigureCMakeVariables()
InitializeFreeCADBuildOptions()
CheckInterModuleDependencies()
FreeCADLibpackChecks()
SetupDoxygen()
if(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
SetupPython()
SetupPCL()
SetupPybind11()
SetupBoost()
SetupXercesC()
find_package(ZLIB REQUIRED)
find_package(PyCXX REQUIRED)
SetupOpenCasCade()
if(BUILD_GUI)
# Do this before the check for SMESH because it depends on vtk
# that may have its own OpenGL check but possibly fails and leaves
# OPENGL_gl_LIBRARY empty that results into linker errors
SetupOpenGL()
endif(BUILD_GUI)
SetupSalomeSMESH()
if (BUILD_FEM_NETGEN)
find_package(NETGEN)
endif(BUILD_FEM_NETGEN)
# not needed at the moment
#find_package(OpenCV REQUIRED)
SetupSwig()
SetupEigen()
# This file is included directly due to some cMake macros that are defined within.
# If these macro definitions are embedded within another macro, it causes problems.
include(cMake/FreeCAD_Helpers/SetupQt.cmake)
SetupFreetype()

if(BUILD_GUI)
SetupCoin3D()
SetupSpaceball()
SetupShibokenAndPyside()
SetupMatplotlib()
endif(BUILD_GUI)
endif(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)

if(BUILD_VR)
find_package(Rift)
endif(BUILD_VR)

SetLibraryVersions()
SetGlobalCompilerAndLinkerSettings()

add_subdirectory(src)
add_subdirectory(data)

CreatePackagingTargets()

PrintFinalReport()


Thus I do not understand what is going on.
Would you please give me more detailed explanation about the process?
Thanks
Post Reply