How to compile without Mod/ being split, and other fun late-night questions

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
ifohancroft
Posts: 205
Joined: Fri May 31, 2019 11:25 pm
Location: Sofia, Bulgaria
Contact:

How to compile without Mod/ being split, and other fun late-night questions

Post by ifohancroft »

I'm compiling with the following cmake parameters:

Code: Select all

cmake ../freecad-source -DINSTALL_TO_SITEPACKAGES=ON -DBUILD_RAYTRACING=OFF -DBUILD_REVERSEENGINEERING=OFF -DBUILD_START=OFF -DBUILD_WEB=OFF -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_BINDIR=/usr/bin -DCMAKE_INSTALL_DATADIR=/usr/share/freecad -DCMAKE_INSTALL_DOCDIR=/usr/share/doc/freecad -DCMAKE_INSTALL_LIBDIR=/usr/lib/freecad -DCMAKE_INSTALL_DATAROOTDIR=/usr/share
The Mod folder from the source ends up in both /usr/Mod/ and in /usr/share/freecad/Mod/. Some files (mostly the resources for the workbenches) are in /usr/share/freecad/Mod/ while pretty much everything else is in /usr/Mod/. Mind you, FreeCAD doesn't seem to have a problem with that.

0. How do I got the Mod folder to compile/install in just /usr/share/freecad/Mod?

Also:

1. The Ext/ folder ends up directly in /usr/ - how do I get it to be in /usr/share/freecad/Ext?
2. How do I get /usr/include/E57Format/ to go in /usr/include/freecad/E57Format/ instead?

I don't mind editing the CMakeLists files if I have to in-order to achieve those above, however I tried it on my own earlier and couldn't achieve neither of the 3.

4. When I build with -DBUILD_RAYTRACING=OFF I get that the Designer plugin isn't being build - what is that? Do I need it?
5. When I build with -DBUILD_ROBOT=OFF the Path workbench isn't being build. It says it required BUILD_ROBOT to be ON. Why? Is this known?
I like making, breaking and modding stuff, using a soldering iron, code or both. https://ifohancroft.com
User avatar
waebbl
Posts: 200
Joined: Thu Aug 16, 2018 3:12 pm

Re: How to compile without Mod/ being split, and other fun late-night questions

Post by waebbl »

ifohancroft wrote: Sat Aug 13, 2022 1:43 am I'm compiling with the following cmake parameters:

Code: Select all

cmake ../freecad-source -DINSTALL_TO_SITEPACKAGES=ON -DBUILD_RAYTRACING=OFF -DBUILD_REVERSEENGINEERING=OFF -DBUILD_START=OFF -DBUILD_WEB=OFF -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_BINDIR=/usr/bin -DCMAKE_INSTALL_DATADIR=/usr/share/freecad -DCMAKE_INSTALL_DOCDIR=/usr/share/doc/freecad -DCMAKE_INSTALL_LIBDIR=/usr/lib/freecad -DCMAKE_INSTALL_DATAROOTDIR=/usr/share
The Mod folder from the source ends up in both /usr/Mod/ and in /usr/share/freecad/Mod/. Some files (mostly the resources for the workbenches) are in /usr/share/freecad/Mod/ while pretty much everything else is in /usr/Mod/. Mind you, FreeCAD doesn't seem to have a problem with that.

0. How do I got the Mod folder to compile/install in just /usr/share/freecad/Mod?

Also:

1. The Ext/ folder ends up directly in /usr/ - how do I get it to be in /usr/share/freecad/Ext?
AFAIK you currently can't easily. I doesn't only involve changes in the CMakefiles, but also in the code. Additionally the files in /usr/Mod contain libraries which must not, according to FHS, installed into DATAROOTDIR. On Gentoo Linux, we use a prefix of /usr/lib64/freecad, which puts the files from /usr/Mod and /usr/Ext into /usr/lib64/freecad/{Ext,Mod} respectively, but still there's the two installation locations for libraries and data files, which is needed. There have been discussions on this topic before, see for example https://forum.freecadweb.org/viewtopic.php?f=4&t=30596.
2. How do I get /usr/include/E57Format/ to go in /usr/include/freecad/E57Format/ instead?
E57Format is a third party library and not part of FreeCAD, so the installation into /usr/include seems ok for me. Look at the CMakefile of the library to change this.
4. When I build with -DBUILD_RAYTRACING=OFF I get that the Designer plugin isn't being build - what is that? Do I need it?
5. When I build with -DBUILD_ROBOT=OFF the Path workbench isn't being build. It says it required BUILD_ROBOT to be ON. Why? Is this known?
The designer plugin is a plugin for the Qt designer, which provides some of the GUI elements used in FreeCAD, for example to reuse them in new workbenches. AFAICS it should not depend on BUILD_RAYTRACING.
The dependency for the robot and path workbenches are probably correct. There's a list of all interdependencies in FreeCAD in the cMake/FreeCAD_Helpers/CheckInterModuleDependencies.cmake file.
User avatar
ifohancroft
Posts: 205
Joined: Fri May 31, 2019 11:25 pm
Location: Sofia, Bulgaria
Contact:

Re: How to compile without Mod/ being split, and other fun late-night questions

Post by ifohancroft »

waebbl wrote: Sat Aug 13, 2022 8:45 am
ifohancroft wrote: Sat Aug 13, 2022 1:43 am I'm compiling with the following cmake parameters:

Code: Select all

cmake ../freecad-source -DINSTALL_TO_SITEPACKAGES=ON -DBUILD_RAYTRACING=OFF -DBUILD_REVERSEENGINEERING=OFF -DBUILD_START=OFF -DBUILD_WEB=OFF -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_BINDIR=/usr/bin -DCMAKE_INSTALL_DATADIR=/usr/share/freecad -DCMAKE_INSTALL_DOCDIR=/usr/share/doc/freecad -DCMAKE_INSTALL_LIBDIR=/usr/lib/freecad -DCMAKE_INSTALL_DATAROOTDIR=/usr/share
The Mod folder from the source ends up in both /usr/Mod/ and in /usr/share/freecad/Mod/. Some files (mostly the resources for the workbenches) are in /usr/share/freecad/Mod/ while pretty much everything else is in /usr/Mod/. Mind you, FreeCAD doesn't seem to have a problem with that.

0. How do I got the Mod folder to compile/install in just /usr/share/freecad/Mod?

Also:

1. The Ext/ folder ends up directly in /usr/ - how do I get it to be in /usr/share/freecad/Ext?
AFAIK you currently can't easily. I doesn't only involve changes in the CMakefiles, but also in the code. Additionally the files in /usr/Mod contain libraries which must not, according to FHS, installed into DATAROOTDIR. On Gentoo Linux, we use a prefix of /usr/lib64/freecad, which puts the files from /usr/Mod and /usr/Ext into /usr/lib64/freecad/{Ext,Mod} respectively, but still there's the two installation locations for libraries and data files, which is needed. There have been discussions on this topic before, see for example https://forum.freecadweb.org/viewtopic.php?f=4&t=30596.
2. How do I get /usr/include/E57Format/ to go in /usr/include/freecad/E57Format/ instead?
E57Format is a third party library and not part of FreeCAD, so the installation into /usr/include seems ok for me. Look at the CMakefile of the library to change this.
4. When I build with -DBUILD_RAYTRACING=OFF I get that the Designer plugin isn't being build - what is that? Do I need it?
5. When I build with -DBUILD_ROBOT=OFF the Path workbench isn't being build. It says it required BUILD_ROBOT to be ON. Why? Is this known?
The designer plugin is a plugin for the Qt designer, which provides some of the GUI elements used in FreeCAD, for example to reuse them in new workbenches. AFAICS it should not depend on BUILD_RAYTRACING.
The dependency for the robot and path workbenches are probably correct. There's a list of all interdependencies in FreeCAD in the cMake/FreeCAD_Helpers/CheckInterModuleDependencies.cmake file.
Thank you!

Apparently I was wrong about the Designer Plugin. It's not the Raytracing workbench that disables it - it's not enabled by default. I decided to just leave it off and not build it.

I decided I don't need the Path workbench so I opted for not building it, which let me also disable the Robot workbench, however, FreeCAD complains about the Path workbench not being present. Not during the cmake execution, but in terminal/stdout while starting, so I decided to just build it along with the robot workbench and just disable them from inside of FreeCAD.

As for the FHS install, apparently this is the closest you can get:

Code: Select all

cmake -DCMAKE_BUILD_TYPE=Release -DINSTALL_TO_SITEPACKAGES=ON -DCMAKE_INSTALL_PREFIX=/usr/lib/freecad -DCMAKE_INSTALL_BINDIR=/usr/lib/freecad/bin -DCMAKE_INSTALL_DATADIR=/usr/share/freecad -DCMAKE_INSTALL_DOCDIR=/usr/share/doc/freecad -DCMAKE_INSTALL_LIBDIR=/usr/lib/freecad -DCMAKE_INSTALL_DATAROOTDIR=/usr/share ../freecad-source
This puts FreeCAD here:

/usr/lib/freecad/
/usr/lib/python3.10/site-packages/freecad/
/usr/lib/qt/plugins/designer/libFreeCAD_widgets.so (only if the designer plugin is built)
/usr/share/applications/org.freecadweb.FreeCAD.desktop
/usr/share/doc/freecad/
/usr/share/freecad/
/usr/share/icons/hicolor/16x16/apps/freecad.png
/usr/share/icons/hicolor/32x32/apps/freecad.png
/usr/share/icons/hicolor/48x48/apps/freecad.png
/usr/share/icons/hicolor/64x64/apps/freecad.png
/usr/share/icons/hicolor/scalable/apps/freecad.svg
/usr/share/icons/hicolor/scalable/apps/org.freecadweb.FreeCAD.svg
/usr/share/icons/hicolor/scalable/mimetypes/application-x-extension-fcstd.svg
/usr/share/metainfo/org.freecadweb.FreeCAD.appdata.xml
/usr/share/mime/packages/org.freecadweb.FreeCAD.xml
/usr/share/pixmaps/freecad.xpm
/usr/share/thumbnailers/FreeCAD.thumbnailer

The libraries are are in /usr/lib/freecad and the Mod and Ext folders are in there as well.

There are still a couple of things that are not ideal in terms of installing/compiling FreeCAD in the correct locations. In no particular order:


1. The binaries are in /usr/lib/freecad/bin (so you have to symlink them to /usr/bin/). In theory, this should be easy enough to fix. Just change the code so the binaries don't look in

Code: Select all

../
for Mod/ and Ext/ but in

Code: Select all

../lib/
. I don't know much C++, but mostly I don't know where to look in the code to make the change. If someone wants to point me in the right direction, I'd love to take a look.

2. The E57Format folder is in /usr/lib/freecad/include. /usr/lib/freecad shouldn't have an include folder inside it. The E57Folder should be inside /usr/include/freecad/ (or at least under /usr/include/). My train of thought about it being inside of a FreeCAD folder is because the code for E57Format comes with FreeCAD's code and is compiled and installed on the system along with FreeCAD as part of its compilation and installation. This one may need just a CMakeLists change

3. There is a License.txt in /usr/share/freecad/. It should go in /usr/share/doc/freecad/ where the other FreeCAD license files are.

4. freecad-thumbnailer isn't copied in /usr/bin during compilation. Why? The thumbnailer xml file is being copied in /usr/share/thumbnailers/FreeCAD.thumbnailer. I think freecad-thumbnailer should be copied as well, but if it's not copied on purpose, in my opinion it doesn't make sense to copy the thumbnailer xml file either.

P.S. In-case anyone cares, my build currently looks like this:

Code: Select all

sudo pacman -Syu boost curl desktop-file-utils glew hicolor-icon-theme jsoncpp libspnav opencascade shiboken2 xerces-c pyside2 python-matplotlib python-netcdf4 qt5-svg qt5-webkit qt5-webengine cmake eigen git gcc-fortran pyside2-tools swig qt5-tools shared-mime-info coin python-pivy med

git clone https://github.com/FreeCAD/FreeCAD.git freecad-source

mkdir freecad-build

cd freecad-build

cmake -DCMAKE_BUILD_TYPE=Release -DINSTALL_TO_SITEPACKAGES=ON -DBUILD_OPENSCAD=OFF -DBUILD_PLOT=OFF -DBUILD_RAYTRACING=OFF -DBUILD_REVERSEENGINEERING=OFF -DBUILD_START=OFF -DBUILD_TEST=OFF -DBUILD_WEB=OFF -DCMAKE_INSTALL_PREFIX=/usr/lib/freecad -DCMAKE_INSTALL_BINDIR=/usr/lib/freecad/bin -DCMAKE_INSTALL_DATADIR=/usr/share/freecad -DCMAKE_INSTALL_DOCDIR=/usr/share/doc/freecad -DCMAKE_INSTALL_LIBDIR=/usr/lib/freecad -DCMAKE_INSTALL_DATAROOTDIR=/usr/share ../freecad-source

make -j$(nproc --ignore=2)

sudo make install

sudo cp ../freecad-source/src/Tools/freecad-thumbnailer /usr/bin/

sudo chmod +x /usr/bin/freecad-thumbnailer

sudo desktop-file-install /usr/share/applications/org.freecadweb.FreeCAD.desktop

sudo update-mime-database /usr/share/mime

sudo gtk-update-icon-cache /usr/share/icons/hicolor
I like making, breaking and modding stuff, using a soldering iron, code or both. https://ifohancroft.com
Post Reply