How I Built an Old Version of LibreCAD From Tarball

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

How I Built an Old Version of LibreCAD From Tarball

micheletrecaffe
How I Built an Old Version of LibreCAD From Tarball

The first question is: why? I know a lot of folks here will ask that, some with whimsical rolls of the eyes, some with frank curiosity, others with outraged anger (that's dangerous!!!).

To be honest, I did it because I like my current version of LibreCAD. And I have to say: I learned a lot in the process of working this thing out. I am not saying that anyone else needs to do this. Having done the work, however, I would like to post my results - if nothing else, so that I can easily find the procedure the next time I lose a hard drive and have to re-install from scratch.

Now on to the build. I wanted to install LibreCAD 2.0.2 on my laptop, a converted chromebook running Linux Mint 20 xfce. To do this, I needed two things: a LibreCAD tarball, and the correct version of Qt, which is required for building LibreCAD.

1. LibreCAD Download.

   a. For the tarball, I went to: https://launchpad.net/ubuntu/+source/librecad/+publishinghistory which lists all the versions of
       LibreCAD from 1.0.0 forward. 2.0.2 is towards the bottom of the page. Clicking the version number opens the package
       page for that version, and towards the bottom of this page is a link to the tarball, which I downloaded.

   b. Next, following instructions from https://wiki.librecad.org/index.php?title=LibreCAD_Installation_from_Source#Building_LibreCAD_2.0_on_Linux 

       I created the directory:

           ~/develop

       and unpacked the LibreCAD package there.

   c. I then renamed the package to 'LibreCAD,' obtaining the following folder structure:

           ~/develop/LibreCAD

2. Now for Qt.

   a. There is a README (README.md) under /LibreCAD, which specifies that this version of LibreCAD was 're-
       structured and ported to Qt version 4'. Not surprisingly, further down, in the section dedicated to building on
       Ubuntu/Debian, the developers specify: "[m]ake sure you have the Qt version 4 development packages installed..."

   b. README.md next gives a terminal command for installing Qt 4, a copy-paste into the terminal window. Unfortunately,
       this command no longer executes, as Qt 4 has been removed from the repositories.

   c. The solution was to install qt4-default via ppa:

           sudo add-apt-repository ppa:rock-core/qt4
           sudo apt update
           sudo apt install qt4-default

       Note: installing qt4 does not deprioritize qt5. qt4 installs alongside qt5, not in place of it.

   d. For those of you interested in such things, on one of my run-throughs installing qt4, I not only installed the basic
       qt4-default - which is all one needs to install LibreCAD 2.0.2 - but I also installed everything else apt suggested:
       packages like libqt4-declarative-folderlistmodel, etc. These additional files depend on libqtcore4. However,
       installing libqtcore4 caused me to hit the following compile-time error:

            "dpkg: error elaborating archive ...attempted overwrite of /etc/xdg/Trolltech.conf"
 
       This was a noted bug - https://bugs.launchpad.net/ubuntu/+source/qt4-x11/+bug/1193243 - in which the install
       tried to overwrite an existing file (Trolltech.conf) with an identical copy of itself - but the system would not allow the
       overwrite. The solution suggested then still works now: to rename Trolltech.conf to Trolltech_old.conf and re-run
       the libqtcore4 install (comparing the two Trolltech.conf files afterward, one sees that the original Trolltech.conf
       and the new Trolltech.conf are indeed identical).
 
3. With qt4-default installed, it was time to install LibreCAD.
 
   a. In the terminal, I cd'd into the LibreCAD folder:
 
           cd ~/develop/LibreCAD
 
   b. Then, to pick qt4 over qt5:
 
           qtchooser -qt=qt4 -run-tool=qmake
 
   c. Next:
 
           qmake -r
 
       and when that finished (it was quick):
 
           make -j4
 
      This last step took a long time, but at the end of the process the LibreCAD folder contained a bunch of new
      elements, including a /generated folder and a /unix folder.

   d. Inside the /unix folder is a file named 'librecad'. Within the terminal, after:
 
           cd /unix
 
       and executing the following command:
 
           ./librecad
 
       LibreCAD launched sweet as pie.
 
4. Three additional steps:
 
   a. Clean-up. The fresh LibreCAD install is nearly one gigabyte in weight, six times bigger than it needs to be.
       Fortunately, it is possible to slim things down, in two steps.

       i.  Following instructions from LordofBikes (thank you, sir!) I executed the following from within the /unix folder:
 
                  strip librecad
 
          This removes a bunch of debugging code useful if the installed instance of LibreCAD crashes, which mine
          did not. Removing these files lightens LibreCAD by 168 MiB.
 
       ii. Next, I moved the /unix folder out of the /LibreCAD folder, pasting it onto my destop. Then, back in the
           LibreCAD folder (one level up from /unix), I ran a script there labeled CLEAN.SH:
 
                  cd ..                 // to move up one level
                 ./CLEAN.SH     // cleans out the residual files from the install

           I then copied the /unix folder back into the /LibreCAD folder, and checked: LibreCAD now weighed in at only
           159.6 MiB, roughly 760 MiB less than before.

   b. Remove qt4, which was only needed to build LibreCAD. I know there is a huge literature about what the best
       and safest methods are to batch-remove files from the various flavors and versions of Linux-GNU, and I only
       provide the following command for completeness, as it is what worked on my machine:
 
                 sudo apt remove --purge qt4 libqt4
 
   c. Finally, I created a menu icon to run LibreCAD from the menu:
 
       i.   Under "Menu" I went to "Settings" then "Menu Editor"
       ii.  Clicked "+" to add a new element
       iii. Under the drop-down menu, picked "New Launcher"
 
       I placed the new launcher under 'Graphics.' The launcher command I entered was just the path to unix/librecad:
 
                 /~/develop/LibreCAD/unix/librecad
 
       I found the LibreCAD icons within the icons folder that can be accessed from within the editor, and of course
       there is the name of the new launcher: 'LibreCAD'.
 
 Done
Reply | Threaded
Open this post in threaded view
|

Re: How I Built an Old Version of LibreCAD From Tarball

dxli
Could you share what stops you from switching to later versions?

If there are some specific bugs, it's helpful to fix them.
micheletrecaffe wrote
How I Built an Old Version of LibreCAD From Tarball

The first question is: why? I know a lot of folks here will ask that, some with whimsical rolls of the eyes, some with frank curiosity, others with outraged anger (that's dangerous!!!).

To be honest, I did it because I like my current version of LibreCAD. And I have to say: I learned a lot in the process of working this thing out. I am not saying that anyone else needs to do this. Having done the work, however, I would like to post my results - if nothing else, so that I can easily find the procedure the next time I lose a hard drive and have to re-install from scratch.

Now on to the build. I wanted to install LibreCAD 2.0.2 on my laptop, a converted chromebook running Linux Mint 20 xfce. To do this, I needed two things: a LibreCAD tarball, and the correct version of Qt, which is required for building LibreCAD.

1. LibreCAD Download.

   a. For the tarball, I went to: https://launchpad.net/ubuntu/+source/librecad/+publishinghistory which lists all the versions of
       LibreCAD from 1.0.0 forward. 2.0.2 is towards the bottom of the page. Clicking the version number opens the package
       page for that version, and towards the bottom of this page is a link to the tarball, which I downloaded.

   b. Next, following instructions from https://wiki.librecad.org/index.php?title=LibreCAD_Installation_from_Source#Building_LibreCAD_2.0_on_Linux 

       I created the directory:

           ~/develop

       and unpacked the LibreCAD package there.

   c. I then renamed the package to 'LibreCAD,' obtaining the following folder structure:

           ~/develop/LibreCAD

2. Now for Qt.

   a. There is a README (README.md) under /LibreCAD, which specifies that this version of LibreCAD was 're-
       structured and ported to Qt version 4'. Not surprisingly, further down, in the section dedicated to building on
       Ubuntu/Debian, the developers specify: "[m]ake sure you have the Qt version 4 development packages installed..."

   b. README.md next gives a terminal command for installing Qt 4, a copy-paste into the terminal window. Unfortunately,
       this command no longer executes, as Qt 4 has been removed from the repositories.

   c. The solution was to install qt4-default via ppa:

           sudo add-apt-repository ppa:rock-core/qt4
           sudo apt update
           sudo apt install qt4-default

       Note: installing qt4 does not deprioritize qt5. qt4 installs alongside qt5, not in place of it.

   d. For those of you interested in such things, on one of my run-throughs installing qt4, I not only installed the basic
       qt4-default - which is all one needs to install LibreCAD 2.0.2 - but I also installed everything else apt suggested:
       packages like libqt4-declarative-folderlistmodel, etc. These additional files depend on libqtcore4. However,
       installing libqtcore4 caused me to hit the following compile-time error:

            "dpkg: error elaborating archive ...attempted overwrite of /etc/xdg/Trolltech.conf"
 
       This was a noted bug - https://bugs.launchpad.net/ubuntu/+source/qt4-x11/+bug/1193243 - in which the install
       tried to overwrite an existing file (Trolltech.conf) with an identical copy of itself - but the system would not allow the
       overwrite. The solution suggested then still works now: to rename Trolltech.conf to Trolltech_old.conf and re-run
       the libqtcore4 install (comparing the two Trolltech.conf files afterward, one sees that the original Trolltech.conf
       and the new Trolltech.conf are indeed identical).
 
3. With qt4-default installed, it was time to install LibreCAD.
 
   a. In the terminal, I cd'd into the LibreCAD folder:
 
           cd ~/develop/LibreCAD
 
   b. Then, to pick qt4 over qt5:
 
           qtchooser -qt=qt4 -run-tool=qmake
 
   c. Next:
 
           qmake -r
 
       and when that finished (it was quick):
 
           make -j4
 
      This last step took a long time, but at the end of the process the LibreCAD folder contained a bunch of new
      elements, including a /generated folder and a /unix folder.

   d. Inside the /unix folder is a file named 'librecad'. Within the terminal, after:
 
           cd /unix
 
       and executing the following command:
 
           ./librecad
 
       LibreCAD launched sweet as pie.
 
4. Three additional steps:
 
   a. Clean-up. The fresh LibreCAD install is nearly one gigabyte in weight, six times bigger than it needs to be.
       Fortunately, it is possible to slim things down, in two steps.

       i.  Following instructions from LordofBikes (thank you, sir!) I executed the following from within the /unix folder:
 
                  strip librecad
 
          This removes a bunch of debugging code useful if the installed instance of LibreCAD crashes, which mine
          did not. Removing these files lightens LibreCAD by 168 MiB.
 
       ii. Next, I moved the /unix folder out of the /LibreCAD folder, pasting it onto my destop. Then, back in the
           LibreCAD folder (one level up from /unix), I ran a script there labeled CLEAN.SH:
 
                  cd ..                 // to move up one level
                 ./CLEAN.SH     // cleans out the residual files from the install

           I then copied the /unix folder back into the /LibreCAD folder, and checked: LibreCAD now weighed in at only
           159.6 MiB, roughly 760 MiB less than before.

   b. Remove qt4, which was only needed to build LibreCAD. I know there is a huge literature about what the best
       and safest methods are to batch-remove files from the various flavors and versions of Linux-GNU, and I only
       provide the following command for completeness, as it is what worked on my machine:
 
                 sudo apt remove --purge qt4 libqt4
 
   c. Finally, I created a menu icon to run LibreCAD from the menu:
 
       i.   Under "Menu" I went to "Settings" then "Menu Editor"
       ii.  Clicked "+" to add a new element
       iii. Under the drop-down menu, picked "New Launcher"
 
       I placed the new launcher under 'Graphics.' The launcher command I entered was just the path to unix/librecad:
 
                 /~/develop/LibreCAD/unix/librecad
 
       I found the LibreCAD icons within the icons folder that can be accessed from within the editor, and of course
       there is the name of the new launcher: 'LibreCAD'.
 
 Done
Reply | Threaded
Open this post in threaded view
|

Re: How I Built an Old Version of LibreCAD From Tarball

micheletrecaffe
I did have a post about that somewhere, I'll look and see if I can find it.

I've seen this thing with a lot of different programs people use, however: you get used to a given version, you know where everything is, you've gone through the 'learning curve' - and then you update and find yourself facing a whole new curve.

Partly, though, I was motivated by a 'I wonder if...' curiosity. Like the kind that kills cats... \_(**)_/