User:DeepSOIC: Difference between revisions

From FreeCAD Documentation
No edit summary
Line 15: Line 15:
Next was the trickiest part - to set up the compiler in Qt Creator.
Next was the trickiest part - to set up the compiler in Qt Creator.
===compiler in Qt Creator===
===compiler in Qt Creator===
====32 bits====
====32-bit====
Setting the compiler for 32 bit is quite straightforward.
Setting the compiler for 32 bit is quite straightforward.
1. Set up the compiler under Compilers tab in settings: Add a '''custom''' compiler:
1. Set up the compiler under Compilers tab in settings: Add a '''custom''' compiler:
Line 40: Line 40:


The environment part of the settings took me the most trouble to configure
The environment part of the settings took me the most trouble to configure

====64-bit====
This was quite a bit more tricky to figure out how to do. The main problem was that there is no nmake executable in C:\Qt\msvc12rip\VC\bin\''''x86_amd64'''', and nmake kept using the 32-bit compiler. To counter the problem, I created a special folder "C:\Qt\msvc12rip\VC\bin\''''x86_amd64_sa''''", where I just combined the contents of folders C:\Qt\msvc12rip\VC\bin and C:\Qt\msvc12rip\VC\bin\x86_amd64. So, the instruction looks like this:

1. in C:\Qt\msvc12rip\VC\bin, create a folder named ''''x86_amd64_sa'''' (sa stands for Stand-Alone, use whatever name you like).

2. copy contents of folder C:\Qt\msvc12rip\VC\bin into x86_amd64_sa folder (now you have a 32-bit compiler there)

3. copy contents of folder x86_amd64 into x86_amd64_sa, replacing some files in the process. Now you have a 64bit compiler with nmake there.

4. Set up the compiler under Compilers tab in settings: Add a '''custom''' compiler:
* name = msvcrip'''64''' (the name doesn't matter, it is up to you)
* Compiler path: C:\Qt\msvc12rip\VC\bin\x86_amd64_sa\cl.exe
* Make path: C:\Qt\msvc12rip\VC\bin\x86_amd64_sa\nmake.exe
* ABI: x86-windows-msvc2013-pe-'''64bit'''
* header paths - nothing
* error parser: MSVC

2. Under kits tab, I added a kit, and set it up like this:
* name: FreeCAD'''64''' (again, up to you)
* Device type: Desktop
* Device: Local PC
* Compiler: msvcrip'''64''' (or whatever you named it in step 1)
* Environment: (correct the paths to your setup; compared to 32-bit, amd64/x64 has appeared or has replaced x86 in several places)
{{code|code=
INCLUDE=C:\Program Files (x86)\Windows Kits\8.1\include\shared\;C:\Program Files (x86)\Windows Kits\8.1\include\um\;C:\Qt\msvc12rip\VC\include
LIB=C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64\;C:\Qt\msvc12rip\VC\lib\amd64\
LIBPATH=C:\Program Files (x86)\Windows Kits\8.1\References\CommonConfiguration\Neutral\
PATH=C:\Qt\msvc12rip\VC\bin\x86_amd64_sa\;C:\Program Files (x86)\Windows Kits\8.1\bin\x64\}}
* Debugger: (optional) set to '''64'''-bit (x64)
* Qt version: None

I have also set up another kit+compiler pair for using jom instead of nmake, to enable multicore build. The configuration was identical to 64-bit with nmake, except for that in path to Make in compiler tab, I set it to C:\Qt\Qt542\Tools\QtCreator\bin\jom.exe (you should be able to find jom under whre your Qt creator is installed).


===testing compiler and building FreeCAD===
All the rest is identical to the normal way one would compile FreeCAD:

Open FreeCAD (CMakeLists.txt) with Qt creator, and it will invite you to run cmake. Run it. CMake will build a test program, to see if the compiler works. If the compiler doesn't work, it will show an error telling exactly that, and listing the build output. This should help you identify, what's going wrong. Typical errors I got:
* Can't open Kernel32.dll = something's wrong with INCLUDE environment variable (note: it is set under kits tab in Qt, not in windows!)
* manifest-related error: PATH does not point to a location where a resource compiler (rc.exe) of right bit-ness is located.
* can't resolve external symbol - something's wring with LIB or LIBPATH (they probably point to .lib-s of wrong bit-ness)
* can't locate include - the include location list should contain path to standard headers (C:\Qt\msvc12rip\VC\include on my machine)

Revision as of 19:01, 19 June 2015

setting up MSVC2013 compiler without installing Visual Studio

This is a short story of how I managed to set up FreeCAD compilation on Windows8.1 with MSVC2013 compiler without actually installing the huge visual studio express.

First, I used another computer to install the full visual studio, in order to get the compiler files. I found the compiler under drive:\path\to\visual\studio\VC\bin

Copied the compiler binaries and standard libraries to another computer. I copied the following folders to C:\Qt\msvc12rip

  • drive:\path\to\visual\studio\VC\bin
  • drive:\path\to\visual\studio\VC\lib
  • drive:\path\to\visual\studio\VC\include

Then I installed Windows SDK (google for it). For those who don't know, it is a set of headers, libs and tools to compile Windows programs. By default, it installed itself to

Then I installed CMake and Qt creator (just the creator, i.e. the environment, not the actual Qt, to save space).

Next was the trickiest part - to set up the compiler in Qt Creator.

compiler in Qt Creator

32-bit

Setting the compiler for 32 bit is quite straightforward. 1. Set up the compiler under Compilers tab in settings: Add a custom compiler:

  • name = msvcrip (the name doesn't matter, it is up to you)
  • Compiler path: C:\Qt\msvc12rip\VC\bin\cl.exe
  • Make path: C:\Qt\msvc12rip\VC\bin\nmake.exe
  • ABI: x86-windows-msvc2013-pe-32bit
  • header paths - nothing
  • error parser: MSVC

2. Under kits tab, I added a kit, and set it up like this:

  • name: FreeCAD32 (again, up to you)
  • Device type: Desktop
  • Device: Local PC
  • Compiler: msvcrip (or whatever you named it in step 1)
  • Environment: (correct the paths to your setup)
INCLUDE=C:\Program Files (x86)\Windows Kits\8.1\Include\um\;C:\Qt\msvc12rip\VC\include\
LIB=C:\Qt\msvc12rip\VC\lib\;C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86\
LIBPATH=C:\Qt\msvc12rip\VC\lib\;C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86\
PATH=C:\Qt\msvc12rip\VC\bin\;C:\Program Files (x86)\Windows Kits\8.1\bin\x86\
  • Debugger: (optional) set to 32-bit (x86)
  • Qt version: None

The environment part of the settings took me the most trouble to configure

64-bit

This was quite a bit more tricky to figure out how to do. The main problem was that there is no nmake executable in C:\Qt\msvc12rip\VC\bin\'x86_amd64', and nmake kept using the 32-bit compiler. To counter the problem, I created a special folder "C:\Qt\msvc12rip\VC\bin\'x86_amd64_sa'", where I just combined the contents of folders C:\Qt\msvc12rip\VC\bin and C:\Qt\msvc12rip\VC\bin\x86_amd64. So, the instruction looks like this:

1. in C:\Qt\msvc12rip\VC\bin, create a folder named 'x86_amd64_sa' (sa stands for Stand-Alone, use whatever name you like).

2. copy contents of folder C:\Qt\msvc12rip\VC\bin into x86_amd64_sa folder (now you have a 32-bit compiler there)

3. copy contents of folder x86_amd64 into x86_amd64_sa, replacing some files in the process. Now you have a 64bit compiler with nmake there.

4. Set up the compiler under Compilers tab in settings: Add a custom compiler:

  • name = msvcrip64 (the name doesn't matter, it is up to you)
  • Compiler path: C:\Qt\msvc12rip\VC\bin\x86_amd64_sa\cl.exe
  • Make path: C:\Qt\msvc12rip\VC\bin\x86_amd64_sa\nmake.exe
  • ABI: x86-windows-msvc2013-pe-64bit
  • header paths - nothing
  • error parser: MSVC

2. Under kits tab, I added a kit, and set it up like this:

  • name: FreeCAD64 (again, up to you)
  • Device type: Desktop
  • Device: Local PC
  • Compiler: msvcrip64 (or whatever you named it in step 1)
  • Environment: (correct the paths to your setup; compared to 32-bit, amd64/x64 has appeared or has replaced x86 in several places)
INCLUDE=C:\Program Files (x86)\Windows Kits\8.1\include\shared\;C:\Program Files (x86)\Windows Kits\8.1\include\um\;C:\Qt\msvc12rip\VC\include
LIB=C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64\;C:\Qt\msvc12rip\VC\lib\amd64\
LIBPATH=C:\Program Files (x86)\Windows Kits\8.1\References\CommonConfiguration\Neutral\
PATH=C:\Qt\msvc12rip\VC\bin\x86_amd64_sa\;C:\Program Files (x86)\Windows Kits\8.1\bin\x64\
  • Debugger: (optional) set to 64-bit (x64)
  • Qt version: None

I have also set up another kit+compiler pair for using jom instead of nmake, to enable multicore build. The configuration was identical to 64-bit with nmake, except for that in path to Make in compiler tab, I set it to C:\Qt\Qt542\Tools\QtCreator\bin\jom.exe (you should be able to find jom under whre your Qt creator is installed).


testing compiler and building FreeCAD

All the rest is identical to the normal way one would compile FreeCAD:

Open FreeCAD (CMakeLists.txt) with Qt creator, and it will invite you to run cmake. Run it. CMake will build a test program, to see if the compiler works. If the compiler doesn't work, it will show an error telling exactly that, and listing the build output. This should help you identify, what's going wrong. Typical errors I got:

  • Can't open Kernel32.dll = something's wrong with INCLUDE environment variable (note: it is set under kits tab in Qt, not in windows!)
  • manifest-related error: PATH does not point to a location where a resource compiler (rc.exe) of right bit-ness is located.
  • can't resolve external symbol - something's wring with LIB or LIBPATH (they probably point to .lib-s of wrong bit-ness)
  • can't locate include - the include location list should contain path to standard headers (C:\Qt\msvc12rip\VC\include on my machine)