How to compile LibreCAD in Visual Studio 2015?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to compile LibreCAD in Visual Studio 2015?

FirstStep
Hello everyone,

It is been a while struggling with building LibreCAD in Visual Studio Community 2015. So I will list my steps and reproduce the problem and hope that someone could help me solve it. Following the Build from Source guide, here is how I did it:

Get source code from Github:
I created a folder on my Desktop called "LibreCAD", then I open a Command Prompt and cd to my folder. Then, as stated, I type "git clone https://github.com/LibreCAD/LibreCAD.git" and successfully clone the Source Code.

Result:
I try and open "librecad.sln" in VS 2015 but it opens with a prompt message:
First Error on Project Open

If I press Cancel and try to Build my Solution(dxfrw is the starting project by default), it pops a compiling error saying: "Error MSB8020 The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, please install Visual Studio 2010 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".

Now If I upgrade and try to compile, it pops three errors:
- Error C1083 Cannot open source file: 'src\drw_textcodec.cpp': No such file or directory
- Error C1083 Cannot open source file: 'src\dxfreader.cpp': No such file or directory
- Error C1083 Cannot open source file: 'src\dxfwriter.cpp': No such file or directory

I tried to build with QT and followed the same guide link. It turned to be a headache for me but tried the whole process two times but could not get it to work in any way. I would like to build it with VS though, could anyone guide me through the solution? Please and Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: How to compile LibreCAD in Visual Studio 2015?

ravas
https://github.com/LibreCAD/LibreCAD/issues/696

You will have to be your own hero if you want to build with MSVC.

With the MinGW version of Qt it's pretty simple.

On Windows you will need to add the boost path to librecad/src/custom.pro (or .pri):

BOOST_DIR = C:/boost/boost_1_60_0/
BOOST_LIBDIR = C:/boost/boost_1_60_0/

https://github.com/LibreCAD/LibreCAD/wiki/Becoming-a-developer

That's it really... the rest of that other guide has to do with making installers,
which you don't need to do for running from Qt Creator.
Reply | Threaded
Open this post in threaded view
|

Re: How to compile LibreCAD in Visual Studio 2015?

FirstStep
Hi ravas and thank you for helping. I would still want to try on VS. However, I tried with QT and these are the steps that I did following the Becoming-a-developer link:

- Download/Unzip Boost boost_1_61_0 and copy paste in D:\
- Download QT Creator
- From QT, Open project LibreCAD\LibreCAD\librecad.pro
- Configure project as Desktop QT 5.7.0 MSVC2015 64 bits
- Add boost info in custom.pro as

          BOOST_DIR = D:/boost/boost_1_61_0/
          BOOST_LIBDIR = D:/boost/boost_1_61_0/


- Build all

Result: Huge list of errors



Reply | Threaded
Open this post in threaded view
|

Re: How to compile LibreCAD in Visual Studio 2015?

ravas
This post was updated on .
You're still trying to compile with MSVC...
you need Qt 5.7.0 for Windows 32-bit (MinGW 5.3.0, 1.1 GB)


You will need to eliminate those errors if you want to use MSVC,
with Visual studio or Qt Creator.

Is there any reason to prefer MSVC / Visual Studio?
Reply | Threaded
Open this post in threaded view
|

Re: How to compile LibreCAD in Visual Studio 2015?

FirstStep
This post was updated on .
I did not realize that I am still on MSVC.. Sorry about that. I followed the Becoming a Developer guide but I guess I got confused.

Do you think it is worth the time to try and eliminate the errors, On VS, one by one?

I tried with QT Migwin but it takes a lot of time to build (It does not build when I add -j to the qmake arguments). When it finishes building however, I get this error:

Makefile.Release:1898: recipe for target '..\..\windows\LibreCAD.exe' failed
mingw32-make[3]: Leaving directory 'C:/Users/Khalil/Desktop/LibreCAD/LibreCAD/librecad/src'
mingw32-make[3]: *** [..\..\windows\LibreCAD.exe] Error 1
Makefile:34: recipe for target 'release' failed
mingw32-make[2]: Leaving directory 'C:/Users/Khalil/Desktop/LibreCAD/LibreCAD/librecad/src'
Makefile:38: recipe for target 'sub-src-make_first' failed
mingw32-make[1]: Leaving directory 'C:/Users/Khalil/Desktop/LibreCAD/LibreCAD/librecad'
Makefile:84: recipe for target 'sub-librecad-make_first-ordered' failed
mingw32-make[2]: *** [release] Error 2
mingw32-make[1]: *** [sub-src-make_first] Error 2
mingw32-make: *** [sub-librecad-make_first-ordered] Error 2
09:19:24: The process "D:\Qt\Qt5.7.0\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project librecad (kit: Desktop Qt 5.7.0 MinGW 32bit)
When executing step "Make"
09:19:24: Elapsed time: 15:23.


I am on 64 bit Windows. Do you think this is the issue?

I wanted to try with VS because I am familiar with it and I will need time to adapt this QT. And it is easier to debug and build I assume.
Reply | Threaded
Open this post in threaded view
|

Re: How to compile LibreCAD in Visual Studio 2015?

R. van Twisk
Administrator
FirstStep wrote
I tried with QT Migwin but it takes a lot of time to build (It does not build when I add -j to the qmake arguments).
You need to add the -j to the make tool, the qmake is more of a pre-processor that generates a makefile analogus to cmake. Make is the tool that does the actual build.

If you are familiar with VC and planning to keep contributing will will accept your build files for VC like we did in the past and you can work with your tool of choice. However a few, all??? developer's at LC don't work with VC and as such we don't maintain them and overtime they get outdated.

If this is just a one off build, perhaps it's even easer to use qmake and make, and don't even use Qt Creator.

If you get build errors in VC, it's most lickly because VC doesn't use the correct compiler ( needs to be c++11) or that VC doesn't included all third part tools.

Reply | Threaded
Open this post in threaded view
|

Re: How to compile LibreCAD in Visual Studio 2015?

FirstStep
I added -j to the make arguments and it worked! Thanks.

I kept working on it and I succeeded in building a Release .exe with no errors. However, when I doube click the .exe file, and after added the missing dlls into the same directory as the .exe, I get these three errors:







And this is how my directory looks like:




So what I am trying to do is, edit the code then building a release to test it and so on. Am I on the right track?

I am not sure what do you mean by "VC", I will assume you mean Visual Studio Compiler. So, if I succeed in just compiling the application with VS (Visual Studio) then I think I will be fine on my own to edit the code there and develop on the go. At the mean time I will try and install the c++11 package to my VS2015. I would be on the right track too correct?

I feel like I am almost there so thank you for helping Ravas. truly.
Reply | Threaded
Open this post in threaded view
|

Re: How to compile LibreCAD in Visual Studio 2015?

ravas
Try build/run from Qt Creator. The missing DLL problem doesn't exist when you run from Creator.
You might need to run CLEAN.SH to remove old build files from your attempts with MSVC,
and then 'rebuild all' from Creator.

If you really want to launch from an .exe then follow the guide for making installers.

There is also a Qt command line utility (windeployqt) that can make 'portable' versions
(it adds / links DLLs like you were trying to do);
however, I never used it with LibreCAD so I can't promise that will work properly.
http://doc.qt.io/qt-5/windows-deployment.html

I switched to openSUSE so I can only help from memory.

I would recommend just building/running from Qt Creator;
then if you submit a pull request and it is accepted,
an installer will be made within 24 hours.
https://sourceforge.net/projects/librecad/files/Windows/NightlyBuilds/master/