GCodeProjects / GCodeWorkShop

GCodeWorkShop is text editor for CNC programmers.
GNU Lesser General Public License v3.0
20 stars 7 forks source link

Compiling #14

Closed ihateu3 closed 5 months ago

ihateu3 commented 3 years ago

I really hate to be that guy, but no matter what I try, I am unable to get this to compile and work for Windows. Is there an easier compiler, or easier way to compile this?

Thanks

u-235 commented 3 years ago

Hi. My main OS is Linux and so I can't give detailed advice on building EdytorNC for Windows. When I was doing test builds for Windows, I settled on MSYS2.

ihateu3 commented 1 year ago

I see that you have updated the compile instructions. I guess I am really stupid, because as simple as they are, I still am unable to compile this.

There were many errors in QT5 when I went to run it, and so I resorted to Ubuntu, where after getting to the last step and typing "make" I got "no targets specified and no makefile found"

I really want to try this, and wouldn't even mind helping add some tooltips for Delta controllers. Is there a way you can include a precompiled version for windows here?

Thanks again, one day I will get it to work.

u-235 commented 1 year ago

Hi. This line is most likely the cause of many errors

qmake -r [CONFIG+=debug] [PREFIX=/usr/ | PREFIX=~/.local/bin/]

The options inside the square brackets are optional and can be omitted. That is, you just have to type

qmake -r

If this doesn't help, please copy the console output with errors into your message.

ihateu3 commented 1 year ago

Ok, I will be pretty detailed to help others that have issues compiling on their journey.

The latest versions of Ubuntu do not support something (I think it was QT5?), so I had to install ubuntu-20.04.5 that does support it. I then had to install G++ Then I was getting a serialport error when compiling so I had to install the packages.

sudo apt-get install libqt5serialport5
sudo apt-get install libqt5serialport5-dev

after going through the steps, I now can get through to make but the error is now

could not exec '/usr/lib/qt5/bin/lrelease': No such file or directory
make: *** [Makefile:287: FORCE] Error 1

I navigated there and the directory are in place, and there is files in there but there is no lrelease

But really, I need this for compiled for windows so I can use it on windows.

u-235 commented 1 year ago

Hi. The lrelease utility is part of the qttools5-dev-tools package and you need to install it. This utility is used to compile translation files.

sudo apt-get install qttools5-dev-tools

And I need to update the instructions to build the application. Thanks for the feedback, this will help improve the instructions for building the application.

u-235 commented 1 year ago

I built the application for Windows 32 bit. With all the libraries it was about 80 MB. GitHub has a limit on the size of attached files of 25 MB and only accepts zip archives. I tried to compress files directly to zip, but the archive was 30 MB. Then I compressed files to 7z and then put archive to zip.

edytornc-x86.zip

ihateu3 commented 1 year ago

Thanks. The Linux solution that you gave worked to compile it in Linux.

As for compiling in Windows, I am probably missing libraries, so if there are libraries that are needed could you add them to the windows instructions? Thanks!

Anyways, again thanks for compiling the Windows version for me. I see that an issue in the old versions is still present in this new build. The "show diff" buttons are reversed. When you click on the "open current file in the left diff window" it opens in the right window, and when you click on the "open current file in the right diff window" it opens in the left window. Show diff

u-235 commented 1 year ago

I have written instructions on how to build an application using MSYS2. Could you please try to build the application and give feedback?


Building EdytorNC using MSYS2

MSYS2 provides a set of tools and libraries for developing Windows applications. New releases of MSYS2 will no longer support Windows 7 and 8.1 from 2023, so MSYS2 should be installed from the archive for these operating systems.

Note that the following instructions show the build of the 64-bit version. If you need to build the 32-bit version, replace x86_64 with i686, for example, type mingw-w64-x86_64-gcc instead of mingw-w64-i686-gcc. Read more about naming packages.

One more important note: if an error occurs at some point (just an error, not a warning), further steps make sense only after the error is fixed.

Preparing the desktop environment

I assume that MSYS2 is successfully installed, and its console is available to you. Next, to prepare the desktop environment you should make some simple steps, entering commands into the MSYS2 console.

Synchronize the package manager

A good rule of thumb is to synchronize your package manager with the repositories prior to installing packages.

pacman -Syuu

Installing Qt

We install the base package Qt5 and its translations, Qt tools, and network and serial port libraries.

pacman -S mingw-w64-x86_64-qt5-base mingw-w64-x86_64-qt5-serialport mingw-w64-x86_64-qt5-tools mingw-w64-x86_64-qt5-translations

Installing GCC

To build an application we need a C++ compiler and a pair of utilities.

pacman -S mingw-w64-x86_64-gcc make unzip

You are now ready to build the application.

Building the application

We download the archive with the current version of the master branch into our home directory, unzip it, and jump to the resulting project directory. Then we run qmake and make to build the application.

cd ~
wget https://github.com/u-235/edytornc/archive/refs/heads/master.zip
unzip master.zip
cd edytornc-master
qmake -r
make -j4

After completing the build, a new bin directory with the application will appear in the project directory.

Running the application

So, you are in the ~/edytornc-master directory and it's time to test run the application. After running the command

bin/release/edytornc.exe

the application window should appear and you can be congratulated on successfully building the application. However, if you try to start the application from an explorer, you will get a warning that some dlls required for the application are missing. To fix this problem, we are going to copy the application and all necessary files into C:/EdytorNC. To do so we launch the script

install/MSYS2-deploy.sh -i

The application is now available at C:/EdytorNC/bin/edytornc.exe and a link can be created on the desktop for easy launch.

ihateu3 commented 1 year ago

I followed all the steps in order, but got an error when I went to run make -r

image
u-235 commented 1 year ago

I forgot that MSYS2 can be run in different configurations. You run it in UCRT64 mode, but you need MINGW64 mode.

ihateu3 commented 1 year ago

Can you update the instructions on how to do that? I am a complete noob when it comes to compiling.

u-235 commented 1 year ago

There are several shortcuts in the Start menu for MSYS2. It is necessary to click MinGW 64 bit.

start_mingw_64

ihateu3 commented 1 year ago

Ok, so now I get a few files it cannot find after running the "qmake -r". I did go ahead and try to run "make -j4" which had a bunch of warnings and one error.

I then tried to "bin/release/edytornc.exe" and it said there was no such file.

image

image
u-235 commented 1 year ago

Please, run make again and show an error.

ihateu3 commented 1 year ago

I ran qmake -r again and get the same error as in the pictures I attached.

$ qmake -r
Reading C:/msys64/home/ihate/edytornc-master/3rdparty/3rdparty.pro
 Reading C:/msys64/home/ihate/edytornc-master/3rdparty/kdiff3/kdiff3.pro
 Reading C:/msys64/home/ihate/edytornc-master/3rdparty/qtsingleapplication/qtsingleapplication.pro
Reading C:/msys64/home/ihate/edytornc-master/src-common/src-common.pro
Reading C:/msys64/home/ihate/edytornc-master/src/src.pro
WARNING: Failure to find: edytornc_res.o
Reading C:/msys64/home/ihate/edytornc-master/sfs/sfs.pro
WARNING: Failure to find: sfs_res.o

I also ran make -j4 and got the following.

$ make -j4
lrelease C:/msys64/home/ihate/edytornc-master/lang/*.ts
Updating 'C:/msys64/home/ihate/edytornc-master/lang/edytornc_ca.qm'...
    Generated 598 translation(s) (484 finished and 114 unfinished)
    Ignored 350 untranslated source text(s)
Updating 'C:/msys64/home/ihate/edytornc-master/lang/edytornc_cs_CZ.qm'...
    Generated 937 translation(s) (930 finished and 7 unfinished)
    Ignored 11 untranslated source text(s)
Updating 'C:/msys64/home/ihate/edytornc-master/lang/edytornc_de.qm'...
    Generated 930 translation(s) (923 finished and 7 unfinished)
    Ignored 18 untranslated source text(s)
Updating 'C:/msys64/home/ihate/edytornc-master/lang/edytornc_es.qm'...
    Generated 933 translation(s) (930 finished and 3 unfinished)
    Ignored 15 untranslated source text(s)
Updating 'C:/msys64/home/ihate/edytornc-master/lang/edytornc_fi.qm'...
    Generated 561 translation(s) (469 finished and 92 unfinished)
    Ignored 387 untranslated source text(s)
Updating 'C:/msys64/home/ihate/edytornc-master/lang/edytornc_nl.qm'...
    Generated 568 translation(s) (538 finished and 30 unfinished)
    Ignored 380 untranslated source text(s)
Updating 'C:/msys64/home/ihate/edytornc-master/lang/edytornc_pl.qm'...
    Generated 795 translation(s) (738 finished and 57 unfinished)
    Ignored 153 untranslated source text(s)
Updating 'C:/msys64/home/ihate/edytornc-master/lang/edytornc_ru.qm'...
    Generated 907 translation(s) (907 finished and 0 unfinished)
    Ignored 41 untranslated source text(s)
Updating 'C:/msys64/home/ihate/edytornc-master/lang/kdiff3_ca.qm'...
    Generated 34 translation(s) (33 finished and 1 unfinished)
    Ignored 2 untranslated source text(s)
Updating 'C:/msys64/home/ihate/edytornc-master/lang/kdiff3_cs.qm'...
    Generated 35 translation(s) (35 finished and 0 unfinished)
    Ignored 1 untranslated source text(s)
Updating 'C:/msys64/home/ihate/edytornc-master/lang/kdiff3_de.qm'...
    Generated 35 translation(s) (35 finished and 0 unfinished)
    Ignored 1 untranslated source text(s)
Updating 'C:/msys64/home/ihate/edytornc-master/lang/kdiff3_es.qm'...
    Generated 36 translation(s) (36 finished and 0 unfinished)
Updating 'C:/msys64/home/ihate/edytornc-master/lang/kdiff3_fi.qm'...
    Generated 33 translation(s) (33 finished and 0 unfinished)
    Ignored 3 untranslated source text(s)
Updating 'C:/msys64/home/ihate/edytornc-master/lang/kdiff3_nl.qm'...
    Generated 31 translation(s) (31 finished and 0 unfinished)
    Ignored 5 untranslated source text(s)
Updating 'C:/msys64/home/ihate/edytornc-master/lang/kdiff3_pl.qm'...
    Generated 12 translation(s) (10 finished and 2 unfinished)
    Ignored 24 untranslated source text(s)
Updating 'C:/msys64/home/ihate/edytornc-master/lang/kdiff3_ru.qm'...
    Generated 36 translation(s) (36 finished and 0 unfinished)
cd 3rdparty/ && ( test -e Makefile || C:/msys64/mingw64/bin/qmake.exe -o Makefile C:/msys64/home/ihate/edytornc-master/3rdparty/3rdparty.pro ) && make -f Makefile
make[1]: Entering directory '/home/ihate/edytornc-master/3rdparty'
cd qtsingleapplication/ && ( test -e Makefile || C:/msys64/mingw64/bin/qmake.exe -o Makefile C:/msys64/home/ihate/edytornc-master/3rdparty/qtsingleapplication/qtsingleapplication.pro ) && make -f Makefile
cd kdiff3/ && ( test -e Makefile || C:/msys64/mingw64/bin/qmake.exe -o Makefile C:/msys64/home/ihate/edytornc-master/3rdparty/kdiff3/kdiff3.pro ) && make -f Makefile
make[2]: Entering directory '/home/ihate/edytornc-master/3rdparty/qtsingleapplication'
make[2]: Nothing to be done for 'first'.
make[2]: Leaving directory '/home/ihate/edytornc-master/3rdparty/qtsingleapplication'
make[2]: Entering directory '/home/ihate/edytornc-master/3rdparty/kdiff3'
g++ -c -fno-keep-inline-dllexport -march=nocona -msahf -mtune=generic -Wa,-mbig-obj -O2 -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -IC:/msys64/home/ihate/edytornc-master/include -I../../3rdparty -I../include -IC:/msys64/mingw64/include/QtWidgets -IC:/msys64/mingw64/include/QtGui -IC:/msys64/mingw64/include/QtCore -I. -I/include -IC:/msys64/mingw64/share/qt5/mkspecs/win32-g++  -o gnudiff_xmalloc.o gnudiff_xmalloc.cpp
g++ -c -fno-keep-inline-dllexport -march=nocona -msahf -mtune=generic -Wa,-mbig-obj -O2 -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -IC:/msys64/home/ihate/edytornc-master/include -I../../3rdparty -I../include -IC:/msys64/mingw64/include/QtWidgets -IC:/msys64/mingw64/include/QtGui -IC:/msys64/mingw64/include/QtCore -I. -I/include -IC:/msys64/mingw64/share/qt5/mkspecs/win32-g++  -o gnudiff_io.o gnudiff_io.cpp
g++ -c -fno-keep-inline-dllexport -march=nocona -msahf -mtune=generic -Wa,-mbig-obj -O2 -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -IC:/msys64/home/ihate/edytornc-master/include -I../../3rdparty -I../include -IC:/msys64/mingw64/include/QtWidgets -IC:/msys64/mingw64/include/QtGui -IC:/msys64/mingw64/include/QtCore -I. -I/include -IC:/msys64/mingw64/share/qt5/mkspecs/win32-g++  -o gnudiff_analyze.o gnudiff_analyze.cpp
g++ -c -fno-keep-inline-dllexport -march=nocona -msahf -mtune=generic -Wa,-mbig-obj -O2 -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -IC:/msys64/home/ihate/edytornc-master/include -I../../3rdparty -I../include -IC:/msys64/mingw64/include/QtWidgets -IC:/msys64/mingw64/include/QtGui -IC:/msys64/mingw64/include/QtCore -I. -I/include -IC:/msys64/mingw64/share/qt5/mkspecs/win32-g++  -o pdiff.o pdiff.cpp
In file included from In file included from In file included from                  gnudiff_diff.h:2
gnudiff_diff.h:27,
                 from ,
                 from ,
                 from gnudiff_analyze.cpp:41gnudiff_io.cpp:26gnudiff_xmalloc.cpp:32:
:
:
                                              gnudiff_system.h:35:74:          error:        narrowing conversion of 'narrowing conversion of 'narrowing conversion of '  -1  ' from '' from '        int   int      ' to '                                                  long long unsigned int   ' [
-Wnarrowing                      ]
   35 | #define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]
   35 | #define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]
   35 | #define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]]]; }
      |                                                                          ; }
      |                                                                          ; }
      |                                                                           ^

                                              gnudiff_system.h:117:1:               note: in expansion of macro 'in expansion of macro '                                   verify'
  117 | '
  117 | '
  117 |       verify      (lin_is_printable_as_long, sizeof(lin) <= sizeof(long));
      | (lin_is_printable_as_long, sizeof(lin) <= sizeof(long));
      | (lin_is_printable_as_long, sizeof(lin) <= sizeof(long));
      |       ^~~~~~

gnudiff_system.h:35:66:                                                 error:               size 'size '      -1    ' of array '            ' of array 'a  ' is negative
   35 | #define verify(name, assertion) struct name { char a[' is negative
   35 | #define verify(name, assertion) struct name { char a[' is negative
   35 | #define verify(name, assertion) struct name { char a[                    (assertion) ? 1 : -1                    ]; }
      |                                                      ]; }
      |                                                      ]; }
      |                                                      ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~^~~~~~~~

gnudiff_system.h:117:1:                                                 note:             in expansion of macro 'in expansion of macro '                       verifyverifyverify'
  117 | '
  117 | '
  117 | verify      verify(lin_is_printable_as_long, sizeof(lin) <= sizeof(long));
      | (lin_is_printable_as_long, sizeof(lin) <= sizeof(long));
      | (lin_is_printable_as_long, sizeof(lin) <= sizeof(long));
      |             ^~~~~~

make[2]: *** [Makefile:450: gnudiff_io.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [Makefile:446: gnudiff_xmalloc.o] Error 1
make[2]: *** [Makefile:454: gnudiff_analyze.o] Error 1
In file included from gnudiff_diff.h:27,
                 from pdiff.cpp:46:
gnudiff_system.h:35:74: error: narrowing conversion of '-1' from 'int' to 'long long unsigned int'
-Wnarrowing]
   35 | #define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
      |                                                                          ^
gnudiff_system.h:117:1: note: in expansion of macro 'verify'
  117 | verify(lin_is_printable_as_long, sizeof(lin) <= sizeof(long));
      | ^~~~~~
gnudiff_system.h:35:66: error: size '-1' of array 'a' is negative
   35 | #define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
      |                                                      ~~~~~~~~~~~~^~~~~~~~
gnudiff_system.h:117:1: note: in expansion of macro 'verify'
  117 | verify(lin_is_printable_as_long, sizeof(lin) <= sizeof(long));
      | ^~~~~~
pdiff.cpp: In member function 'virtual bool KDiff3App::eventFilter(QObject*, QEvent*)':
pdiff.cpp:788:25: warning: 'int QWheelEvent::delta() const' is deprecated: Use angleDelta() [-Wdeprecated-declarations]
  788 |         int d = w->delta();
      |                 ~~~~~~~~^~
In file included from C:/msys64/mingw64/include/QtGui/QDropEvent:1,
                 from pdiff.cpp:31:
C:/msys64/mingw64/include/QtGui/qevent.h:219:16: note: declared here
  219 |     inline int delta() const  { return qt4D; }
      |                ^~~~~
pdiff.cpp: In member function 'void KDiff3App::slotNoRelevantChangesDetected()':
pdiff.cpp:1530:26: warning: 'void QProcess::start(const QString&, QIODevice::OpenMode)' is deprecated: Use QProcess::start(const QString &program, const QStringList &arguments,OpenMode mode = ReadWrite) instead [-Wdeprecated-declarations]
 1530 |             process.start(cmd);
      |             ~~~~~~~~~~~~~^~~~~
In file included from C:/msys64/mingw64/include/QtCore/QProcess:1,
                 from pdiff.cpp:33:
C:/msys64/mingw64/include/QtCore/qprocess.h:168:10: note: declared here
  168 |     void start(const QString &command, OpenMode mode = ReadWrite);
      |          ^~~~~
make[2]: *** [Makefile:465: pdiff.o] Error 1
make[2]: Leaving directory '/home/ihate/edytornc-master/3rdparty/kdiff3'
make[1]: *** [Makefile:51: sub-kdiff3-make_first] Error 2
make[1]: Leaving directory '/home/ihate/edytornc-master/3rdparty'
make: *** [Makefile:53: sub-3rdparty-make_first-ordered] Error 2
u-235 commented 1 year ago

This is an error due to a peculiarity of the GCC compiler. It is strange that I have not had such an error. But in any case it should be fixed.

u-235 commented 1 year ago

I've fixed some bugs and updated the master branch, so you can try to build the application. You need to remove the old files, to do this run the following commands in MSYS2.

cd ~
rm master.zip
rm -r -f edytornc-master

Then repeat the build from the "Building the application" phase.

ihateu3 commented 1 year ago

Perfect, it works!!!!

The about section doesn't show the version though that I can see? Might be a separate issue, I just noticed that. Regardless, I can now compile it! And also the buttons are now correct!

u-235 commented 1 year ago

Congratulations on your new skill! Apart from clarifying about choosing the correct MSYS2 startup mode, is there anything I need to add or change in the build instructions? I plan to make instructions with general guidelines for all platforms and separately for MSYS2.

The application version is usually changed at release, which implies significant changes to the software. In my opinion, there are no such changes yet.

ihateu3 commented 1 year ago

I do believe that these instructions are good. I had no issues once the correct MSYS2 was selected, and the code updated to fix the errors I was having.

u-235 commented 1 year ago

In that case, I will close this issue when I add the documentation. Thank you for the detailed feedback.

WD50 commented 1 year ago

finally compiled, and don't forget to open MINGW64 with admin rights

u-235 commented 1 year ago

Why open MINGW64 with admin rights?

WD50 commented 1 year ago

The new Windows 10/11 are very rigorous where all programs can write something, especially if it writes directly to C: So a right click and run as administrator on MINGW64 is simply to ensure that there will be no problems with that.

u-235 commented 5 months ago

The installer for Windows is now available.

https://github.com/GCodeProjects/GCodeWorkShop/releases/tag/2024-05