Help wanted to build on Windows

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

Help wanted to build on Windows

fa201
The documentation of LibreCAD is currently being refreshed and reshaped.

The section "Build from source" was copied from the current Wiki to the new site (readthedocs.io). We need some people to  run the building from source on Windows to check if everything is fine and up-to-date. The purpose is to follow the given directions and to report any issue, any missing step or any change in parameter.

Even if the build is OK, please report the status along with the Windows version used.
Thank you.

Fabrice.
Fabrice

French hobbyist interested in 2D design.
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

Gary S
This post was updated on .
As noted in this post: http://forum.librecad.org/Build-Instructions-for-Windows-macOS-td5717305.html ...

Built on Windows 7 with Qt Creator and boost 1.70.0, Qt 5.12.2 / MinGW 7.3.0 32-bit.  The source code was cloned today.  I'll also try with MinGW 4.9.1 32-bit and update later if I get anything different.

Error 1


C:\develop\LibreCAD\librecad\src\lib\math\rs_math.cpp:323: error: no matching function for call to 'mu::Parser::DefineConst(const char [3], double)'
         p.DefineConst("pi",M_PI);
                                ^

Error 2


C:\develop\LibreCAD\librecad\src\lib\math\rs_math.cpp:324: error: no matching function for call to 'mu::Parser::SetExpr(std::__cxx11::string)'
         p.SetExpr(expr_copy.toStdString());
                                          ^

Error 3


C:\develop\LibreCAD\librecad\src\lib\math\rs_math.cpp:330: error: no match for 'operator<<' (operand types are 'std::ostream {aka std::basic_ostream<char>}' and 'const string_type {aka const std::__cxx11::basic_string<wchar_t>}')
         std::cout << e.GetMsg() << std::endl;
         ~~~~~~~~~~^~~~~~~~~~~~~

Error 4


C:\Qt\Tools\mingw730_32\lib\gcc\i686-w64-mingw32\7.3.0\include\c++\ostream:682: error: no type named 'type' in 'struct std::enable_if<false, std::basic_ostream<char>&>'

Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

Shawn.Curry
Hi Gary,

I ran into the exact same issue.  It appears to be a bug in the UNICODE support.  The command lines that Qt is passing to the muParser build (plus everything else - new windows configuration?) include the defines -DUNICODE and -D_UNICODE.  This causes the muParser to be built for wchar instead of char.  

The errors then occur due to the fact that several of the string constants used in the math cpps are not wchar (ex: L"a widechar string").  They should instead use a _TEXT("sometext") style macro to in order to support both char and wchar.  Indeed, the muParserDef.h unit specifies just such a macro.

I did not see any reason that the muParser library should not be built for unicode.  It appears to be the only obstacle for 100% compilation with the UNICODE flags.

My "hackaround" was to add the following to muParserDef.h:

#ifdef UNICODE
#undef UNICODE
#endif
#ifdef _UNICODE
#undef _UNICODE
#endif

That will get it to build, but the correct solution seems to be fixing the math cpps.

i'm trying to get in touch with any of the other active developers.   Any ideas?
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

Shawn.Curry
In reply to this post by fa201
Hi Fabrice,

The documention for windows appears to be missing a mention of FreeType.  It wasn't included by default in the latest version of Qt and it appears to possibly require an additional entry in the custom.pro.

I might work on that tomorrow; I'll post here again to let you know what's needed.
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

LordOfBikes
Administrator
Shawn,

good point, many thanks for your efforts.

FreeType is an option only.
It is not needed for LibreCAD itself, but for the tool ttf2lff which can convert TTF fonts into LibreCAD's LFF font format.
When FreeType is not found by qmake, ttf2lff is not build, only LibreCAD.
This will leave a message in the terminal or output window, but not an error and should not stop the build.

FreeType has to be downloaded separate, it is not part of Qt.
Off the top of my head I can't say which FreeType version is correct.
I assume, this is the right place to find FreeType for windows:
http://gnuwin32.sourceforge.net/packages/freetype.htm

To build ttf2lff the developer files are needed!

Armin

Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

Gary S
In reply to this post by Shawn.Curry
Hello Shawn,

Thanks for that.  I also found this in LibeCAD's issue log: Issue #930.  Making the changes provided by qium06 allows LC to build on Windows, but breaks it for Linux.  My latest build instructions incorporate those changes for Windows, but it is a work around too (and just asking for problems for users building LC).

Armin,

Just thinking out loud, er, in print , could this be related to this issue with negative values for coordinates?

Gary S
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

fa201
In reply to this post by LordOfBikes
Hi Shawn,

If using this optional feature leads to a working build then I guess we can still start from this point. Do not forget. Do not forget to mention which version of Windows you operate. Thanks for your efforts.

Fabrice.
Fabrice

French hobbyist interested in 2D design.
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

Shawn.Curry
Hi Fabrice,

Sorry for omitting the version info.  It's very similar to Gary's.

Windows 10
Qt 5.12.3 / MinGW 7.3.0 32-bit
boost 1.70.0

To be clear, I was able to build without FreeType, though I did get warnings about it.  When reviewing the wiki I noticed it was included in the package lists for Linux and Mac builds.

I didn't know the full implications to not having it on Windows.  Is it possible that a user/contributor would want to use it, even if it's optional?  There were no instructions how to do so provided on the page.
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

Shawn.Curry
In reply to this post by Gary S
Hi Gary,

The proposed changes you mentioned will lock muParser into using wchar; sort of the opposite of my workaround.  Plus it's a lot more code.    

Most Windows programs are UTF-16 (wchar) codepage by default, since the XP days.  Programs made for Unix-style environs are generally UTF-8 (char, MBCS encoding) cause that was Ken Thompson's design and it didn't break programs built for ANSI.

The correct solution is to rewrite the offending math cpps in a way that allows them compile for either.

Armin @LordOfBikes,

I can make the necessary changes if that's the way the project wants to go, and I can do it in a cross-platform way.  Say the word and I will make it so.
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

Shawn.Curry
This post was updated on .
In reply to this post by fa201
Hi Fabrice,

I've submitted 2 pull requests that deal with building the project on Windows.  The first one fixes the issues that Gary mentioned.  
The second fixes the Visual Studio build.  I think this one will deserve a mention in the documentation once my changes have been merged.

Building in Visual Studio:  

- Follow all of the instructions for building in Qt.
- Install the appropriate Qt Visual Studio Tools plugin for your version of Visual Studio.
- RTFM. Set it up.
- Qt VS Tools > Open Qt Project File > librecad.pro
- Build

If you are planning to contribute, please do not check the VS project files in.  They will contain the personalized settings from your custom.pro.
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

Gary S
Hi Shawn,

The developer's wiki on GitHub includes instructions for building LibreCAD with Visual Studio.  I only included the basic build instructions in the User Manual for users that might want to try the latest iteration of LibreCAD, but direct developers in the Users Manual's Appendix - Contributing to GitHub.  The GitHub wiki is developer oriented and has more information and details on using git, building, packaging, etc.


Gary S
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

Shawn.Curry
Wow.  Looks like the new method will be a huge improvement then.
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

Shawn.Curry
This post was updated on .
In reply to this post by Gary S
Hi Gary,

Have a look at the pull request that I referenced in my previous post.  It deletes all of the vcxproj files from the project and instead relies on the plugin to generate them.  

Perhaps I have incorrectly judged whether these were still in use by anybody.  They were not loading correctly, because they were referencing things in the project that no longer appear to exist.  Nor would the project even build at all due to major problems with the jwwlib (Issue #696).  I have fixed everything and preserved the jww support.

If we need to keep those old vcxproj around, it would not have any negative effect on the new build method.  I just didn't think they even worked.
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

Shawn.Curry
In reply to this post by Gary S
Hi Gary,

I started testing out the directions you mentioned, but it appears the very first link it references is broken.  The rest looks like a royal pain.

I think the new instructions will be much more approachable for the sorts of end users who can make it that far.  It basically boils down to 3 steps:  install the toolkit, configure it, open the project.
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

Gary S
Shawn.Curry wrote
I started testing out the directions you mentioned, but it appears the very first link it references is broken.  The rest looks like a royal pain.

I think the new instructions will be much more approachable for the sorts of end users who can make it that far.  It basically boils down to 3 steps:  install the toolkit, configure it, open the project.
What link is broken?  In the User Manual??  Details man, I need details!!  ( Stated purely in jest.)

That is the gist of it.  I reduced and simplified the instruction as much as reasonable.  Even at that I still worry it is going to create problems, but I'll wait and see..
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

Shawn.Curry
Hi Gary,

I was referring to the compile howto.  It doesn't look like Nokia is hosting the files anymore.  I found the historical versions on the Qt Archive Download page.

After further review of these instructions, it doesn't look like the old vs new methods will be incompatible at all.  The old method does not appear depend on the dead vcxproj files.  It generates it's own using qmake with the following command:

qmake -recursive -tp vc LibreCAD.pro

In the new method, the Qt VS Tools are taking care of this, and all the other "black magic" needed for the old method.  The new method will be available for any version of Visual Studio (2013 and later) where the Qt VS Tools are available.

-Shawn

Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

Gary S
Hi Shawn,

I think that compile howto is terribly out of date ( which is in part why I avoided the VS build instructions).  LibreCAD's home page notes that as of LibreCAD 2.2.0 series, Qt5 is mandatory.  Aside from the work on the User Manual, there is a separate effort to fix up wikis that is just starting.  As I've been writing the manual, I bounced around the wikis, forum, poked through the source code and looked anywhere else I can find useful information, and I find alot that is out of date.

Gary S
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

Shawn.Curry
Hi Gary,

Ok, I understand now.

It looks like my changes have just been merged into the master branch.  Do you want to give it a try?  If you're already set up with Qt, and you have VS 2013 or later, I think you will find the new process very simple and easy enough to earn an inclusion in the User Manual.

Thanks,
Shawn.
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on Windows

xanderdin
In reply to this post by fa201
I built successfully on Windows Server 2019. It was a virtual machine running in the cloud. The full list of preinstalled tools on that virtual machine is available here.

The build process was scripted. No access to GUI. No manual interaction. Because of this I didn't find a way to create NSIS setup after successful LibreCAD build. Just a 7z archive that can be extracted and run LibreCAD afterwards.

Qt = 5.13.1, MinGW = 7.3.0 64-bit, Boost = 1.60.0

My steps to run in bash (inside cloned LibreCAD directory):

# Variables (versions, urls, etc.)
QT_VERSION="5.13.1"
BOOST_VERSION="1.60.0"
BOOST_ZIP="boost_$(echo $BOOST_VERSION | sed 's|\.|_|g').7z"
BOOST_DIR="/boost/boost_$(echo $BOOST_VERSION | sed 's|\.|_|g')"
BOOST_URL="https://sourceforge.net/projects/boost/files/boost"
BOOST_URL="$BOOST_URL/$BOOST_VERSION/$BOOST_ZIP/download"

# Prepare custom-windows.bat as described in LibreCAD wiki
echo "set Qt_DIR=C:\Qt\Qt$QT_VERSION\\$QT_VERSION" > ./scripts/custom-windows.bat
echo 'set NSIS_DIR=C:\Program Files (x86)\NSIS'   >> ./scripts/custom-windows.bat
echo 'set MINGW_VER=mingw73_64'                   >> ./scripts/custom-windows.bat

# Prepare custom.pro as described in LibreCAD wiki
echo "BOOST_DIR = C:$BOOST_DIR/"    >> ./librecad/src/custom.pro
echo "BOOST_LIBDIR = C:$BOOST_DIR/" >> ./librecad/src/custom.pro

# Erase contents of build-win-setup.bat to prevent attempts to build NSIS setup
echo '' > ./scripts/build-win-setup.bat

# Install Qt non-interactively and Boost
mkdir /c/Qt /c/boost
pip install 'aqtinstall==0.4.1'
python -m aqt install -O /c/Qt $QT_VERSION windows desktop win64_mingw73
cd /c/boost
curl -L -o ./$BOOST_ZIP "$BOOST_URL"
7z x ./$BOOST_ZIP

Then in PowerShell (inside cloned LibreCAD directory):

cd .\scripts
build-windows.bat

And this builds OK. Brave people are needed to test my cloud-built binaries on Windows (I don't have Windows on my PC) . The archive is available here: https://dev.azure.com/xanderdin/PlayWithAzure/_build/results?buildId=118&view=artifacts (Artifacts button -> WindowsPackage).

If you are interested in all my LibreCAD build experiments, how they progressed from the beginning so far (for Windows, MacOS and Linux) please see git history of my commits here: https://github.com/xanderdin/LibreCAD/commits/play_with_azure And resulting cloud builds with logs are available here: https://dev.azure.com/xanderdin/PlayWithAzure/_build?definitionId=1&_a=summary Please note, the build history and logs are available for no more than 30 days and then will be automatically deleted by cloud provider.

Hope this piece of info is helpful in one way or another.