First build on Ubuntu - getting dependencies

Having trouble installing or compiling FreeCAD? Get help here.
User avatar
NewJoker
Veteran
Posts: 2331
Joined: Sun Oct 11, 2020 7:49 pm

First build on Ubuntu - getting dependencies

Post by NewJoker »

Hi,

after failing to compile FreeCAD from source on Windows (viewtopic.php?t=73143) I'm trying to do it using a virtual Ubuntu machine since the procedure seems to be easier there.

First, I followed this instruction: Installing on Linux and used the command below to install FreeCAD:

Code: Select all

sudo apt-get install freecad
Unfortunately, it installed the 0.19 version. So I downloaded AppImage from weekly builds and used this instruction: https://wiki.freecad.org/AppImage#Unpacking_AppImages

Those commands allowed me to unpack the AppImage and start FreeCAD 0.22:

Code: Select all

./FreeCAD_weekly-builds-34291-2023-09-14-conda-Linux-x86_64-py310.AppImage --appimage-extract
cd squashfs-root/
./AppRun
Then I went one step further and tried following the guide for compilation on Linux. According to it, a single command should be sufficient to install the dependencies on Ubuntu (https://wiki.freecad.org/Compile_on_Lin ... pendencies):

Code: Select all

sudo apt build-dep freecad
But when I use it, I get this:

Code: Select all

Reading package lists... Done
E: You must put some 'deb-src' URIs in your sources.list
What am I supposed to do now ? The guide doesn't explain this (at least not directly).
User avatar
grandcross
Posts: 264
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Re: First build on Ubuntu - getting dependencies

Post by grandcross »

NewJoker wrote: Fri Sep 15, 2023 7:58 pm

Code: Select all

Reading package lists... Done
E: You must put some 'deb-src' URIs in your sources.list
What am I supposed to do now ? The guide doesn't explain this (at least not directly).
By default, Ubuntu doesn't load software sources. Most people don't need it.

To load them you'll need to edit the packages available to your system. This is in the file `/etc/apt/sources.list'. I use vim, but you can use whatever editor you choose. You'll have to edit as root (`$ sudo vim /etc/apt/sources.list`)

For every standard repository, there is a corresponding source repository. For example,

Code: Select all

deb http://ca.archive.ubuntu.com/ubuntu jammy main restricted
# deb-src http://ca.archive.ubuntu.com/ubuntu jammy main restricted
Remove the comment '#' from in front of the deb-src to enable. After saving the file, you'll have to update the package lists

Code: Select all

$ sudo apt update
You should be then able to proceed with your install.
User avatar
NewJoker
Veteran
Posts: 2331
Joined: Sun Oct 11, 2020 7:49 pm

Re: First build on Ubuntu - getting dependencies

Post by NewJoker »

@grandcross Thank you for the explanation. I removed '#' from before deb-src http://pl.archive.ubuntu.com/ubuntu jammy main restricted and used sudo apt update but when I type sudo apt build-dep freecad, I still get:

Code: Select all

Reading package lists... Done
E: You must put some 'deb-src' URIs in your sources.list
Am I missing something here ? Should I remove '#' also from before jammy-updates main restricted, jammy universe and jammy-updates universe ?
User avatar
grandcross
Posts: 264
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Re: First build on Ubuntu - getting dependencies

Post by grandcross »

I would. Do the same for all the repositories in the file. Basically if you're using the 'deb', include the 'deb-src'.
User avatar
NewJoker
Veteran
Posts: 2331
Joined: Sun Oct 11, 2020 7:49 pm

Re: First build on Ubuntu - getting dependencies

Post by NewJoker »

@grandcross I uncommented all the "deb-src" lines, updated and the sudo apt build-dep freecad command finally worked.

However, when I downloaded the source code for compilation and, following the instructions for the out-of-source build (https://wiki.freecad.org/Compile_on_Lin ... le_FreeCAD), typed:

Code: Select all

cmake ../freecad-source
I got this error:

Code: Select all

CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package):

  Could not find a package configuration file provided by

  "Qt5WebEngineWidgets" with any of the following names:



    Qt5WebEngineWidgetsConfig.cmake

    qt5webenginewidgets-config.cmake



  Add the installation prefix of "Qt5WebEngineWidgets" to CMAKE_PREFIX_PATH

  or set "Qt5WebEngineWidgets_DIR" to a directory containing one of the above

  files.  If "Qt5WebEngineWidgets" provides a separate development package or

  SDK, be sure it has been installed.

Call Stack (most recent call first):

  cMake/FreeCAD_Helpers/SetupQt.cmake:31 (find_package)

  CMakeLists.txt:79 (include)

Exactly what should I do now ? On Windows, I was using CMake GUI and setting the directories for such variables as CMAKE_INSTALL_PREFIX there.
User avatar
grandcross
Posts: 264
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Re: First build on Ubuntu - getting dependencies

Post by grandcross »

My advice is to install the dependencies manually, which is what I normally do.

Directions are at https://wiki.freecad.org/Compile_on_Linux

Scroll down a little and expand the section on "Debian and Ubuntu". There are two methods described there with the first being what you've tried, i.e. getting the dependencies from the sources. The second is to install them manually. If you scroll down a little more you'll find this one liner:

Code: Select all

sudo apt install cmake cmake-gui libboost-date-time-dev libboost-dev libboost-filesystem-dev libboost-graph-dev libboost-iostreams-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-serialization-dev libboost-thread-dev libcoin-dev libeigen3-dev libgts-bin libgts-dev libkdtree++-dev libmedc-dev libocct-data-exchange-dev libocct-ocaf-dev libocct-visualization-dev libopencv-dev libproj-dev libpyside2-dev libqt5opengl5-dev libqt5svg5-dev qtwebengine5-dev libqt5x11extras5-dev libqt5xmlpatterns5-dev libshiboken2-dev libspnav-dev libvtk7-dev libx11-dev libxerces-c-dev libzipios++-dev occt-draw pyside2-tools python3-dev python3-matplotlib python3-packaging python3-pivy python3-ply python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtsvg python3-pyside2.qtwidgets python3-pyside2.qtnetwork python3-pyside2.qtwebengine python3-pyside2.qtwebenginecore python3-pyside2.qtwebenginewidgets python3-pyside2.qtwebchannel python3-markdown python3-git python3-pyside2uic qtbase5-dev qttools5-dev swig
There is a high probability this will complain about `python3-pyside2uic` in which case remove it. You'll also need to install the following two packages:

Code: Select all

sudo apt install pyqt5-dev-tools libyaml-cpp-dev
The first is mentioned in the documentation while the second is a new dependency added for the materials code.
User avatar
NewJoker
Veteran
Posts: 2331
Joined: Sun Oct 11, 2020 7:49 pm

Re: First build on Ubuntu - getting dependencies

Post by NewJoker »

grandcross wrote: Tue Sep 19, 2023 6:46 pm If you scroll down a little more you'll find this one liner:
Wow, quite a lot of dependencies. I used those two commands, the first one complained about this:

Code: Select all

The following packages have unmet dependencies:

 python3-vtk9 : Breaks: python3-vtk7 but 7.1.1+dfsg2-10.1build1 is to be installed

E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
I checked and CMake is still throwing this error regarding Qt5WebEngineWidgets.
User avatar
grandcross
Posts: 264
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Re: First build on Ubuntu - getting dependencies

Post by grandcross »

Unfortunately installing dependencies from sources seems to have created some conflicts with older versions. I'd try removing the problem child.

Code: Select all

sudo apt remove python3-vtk7
Unfortunately this may create some other errors for other dependencies. If it does, try removing them too.

Your cmake won't work until the conflicting dependencies are removed and the new ones installed, so don't worry about that. It helps to do the cmake in an empty folder so no old conflicts remain, so delete anything in your build folder first.
User avatar
NewJoker
Veteran
Posts: 2331
Joined: Sun Oct 11, 2020 7:49 pm

Re: First build on Ubuntu - getting dependencies

Post by NewJoker »

grandcross wrote: Tue Sep 19, 2023 7:03 pm I'd try removing the problem child.

Code: Select all

sudo apt remove python3-vtk7
Strange, this resulted in:

Code: Select all

Package 'python3-vtk7' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 35 not upgraded.
So I've got no idea what to do about this. Should I remove python-vtk9 as well ?
User avatar
grandcross
Posts: 264
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Re: First build on Ubuntu - getting dependencies

Post by grandcross »

Looking back at the messages, the conflict looks the other way around. Try replacing the 7 with a 9? The 7 version is called for in the dependencies, but the conflict seems with the newer version. You're starting to venture into the trial and error phase :D
Post Reply