[DONE] OpenBSD Port


UPDATE: I’m happy to announce that FreeCAD has been imported to the OpenBSD ports tree, and will be available for OpenBSD-stable users with the upcoming 7.8 release. There are a couple of bugs that I haven’t had the time to debug, but overall, the port is usable. Now the fun of maintaining the port begins. For this too, any help and/or testing is welcome and appreciated. Special thanks to wmayer for all the help :slight_smile:

Hi everyone,

I’ve decided to take on the challenge of porting FreeCAD to OpenBSD. Some efforts have been made in the past already, but there’s little documentation about it and it’s scattered all over the place in abandoned repos and mailing lists. In order to avoid the same result, I decided to start this thread. I’d like this to be a place to centralize all efforts to port FreeCAD to OpenBSD, track progress and discuss issues that may arise.

Although I maintain a number of ports in OpenBSD, none of them are on the scale of FreeCAD. I’m also fairly new to the world of compiling software, so I hope to get some questions answered here. For anyone interested, the work in progress of the port and its dependencies can be found on my personal repo.

All help is welcome :slight_smile:

Dependencies:*
X: Already ported/Imported
W: Work in progress
?: Unknown

Python
Boost
OpenCASCADE (Submission; Imported!)
Qt
Shiboken6 (Submission; Imported!)
PySide6 (Submission; Imported!)
PySide6-tools (Submission; Imported!)
Coin3D (Submission; Imported!)
Pivy (Submission; Imported!)
PyBind11
PyCXX
FreeType
[?] KDL (Using the KDL sources included with FreeCAD due to this)
Point Cloud Library (Submission; Imported!)
FLANN (Submission; Imported!)
[?] Salome SMESH (Using the SMESH sources included with FreeCAD)
VTK** (Submission; Imported!)
Ply
Xerces-C++
Eigen3
Zipios++
libfmt
libmed (Submission; Imported!)
doxygen
[?] libspnav (I’m considering leaving this out as I don’t have a 6DOF input device to test the driver on OpenBSD)
Netgen (Submission; Imported!)
[W] Calculix

*Most from here.
**See here.

Links to previous efforts:
https://github.com/cmburn/openbsd-ports-wip
https://marc.info/?l=openbsd-ports&m=159132995830532&w=2
https://marc.info/?l=openbsd-ports&m=159139097619117&w=2

Let’s kick off this thread with my first question.

When I run CMake, the OpenGL header library GL/gl.h is not found. I believe this is because on OpenBSD these header files are installed in the non-standard path /usr/X11R6/include.

I’ve had this problem with other ports, and the solution was to add something along the following lines to CMakeLists.txt

if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
    find_package(X11 REQUIRED)
    include_directories(${X11_INCLUDE_DIR})
endif()

However, as I’m fairly new to CMake and the FreeCAD codebase, I’m not sure where this should be placed. src/Gui/CMakeLists.txt seems like the appropriate place. Is this assumption correct? I think this could be added upstream and I will make a pull request once this is resolved.

UPDATE: The snippet suggested above doesn’t seem to be necessary as the OpenGL library libGL.so.18.0 is actually found. I just hadn’t gotten that far into the configuration because opencascade was missing and was aborting the configuration early. However I’m still getting:

Looking for GL/gl.h - not found

Can this be ignored? Or am I just completely wrong and this is not related to OpenGL?

Good news, the opencascade port is now more or less complete. Soon I’ll submit it for inclusion in the official repositories.

I’m thinking to go for VTK or Pyside and Shiboken next. Regarding the latter, can FreeCAD already be compiled with QT6? If yes, I think I would just skip Pyside2 completely and go for Pyside6. Is this already supported? I read a little about some partially successful attempts here but the last post is in November of 2022 so I’m not sure if how the situation developed. Any feedback on this would be appreciated.

I’ve decided to take on the challenge of porting FreeCAD to OpenBSD.

Great to see. In the past FreeCAD was also ported to FreeBSD but I don’t know in what state this port currently is.

I’ve had this problem with other ports, and the solution was to add something along the following lines to CMakeLists.txt

If still needed then the most appropriate place to put this is FreeCAD/cmake/FreeCAD_Helpers/SetupOpenGL.cmake

Can this be ignored? Or am I just completely wrong and this is not related to OpenGL?

Hard to say. If you don’t run into build failures (most likely in FreeCADGui) then the message can be ignored.

Regarding the latter, can FreeCAD already be compiled with QT6?

For Linux (tested with Debian and Xubuntu) FreeCAD is fully ported to Qt6.

Thanks for your reply. I believe the FreeBSD port is working just fine and is up-to-date.

Got it, thank you.

Awesome! I’ll focus on Qt6 then. Just to verify, those versions are using pyside6 correct?

Just to verify, those versions are using pyside6 correct?

Yes. From Qt you can download a tarball that includes the source code for PySide6 and shiboken6.

Awesome, thank you!

wmayer. is SoQt still necessary to compile Pivy even though it’s been replaced by Quarter in FreeCAD? Based on the CMakeLists.txt from pivy, SoQt seems to be optional, but I’m not sure if compiling pivy without it will break the Draft/Arch/BIM Workbenches.

If you can build pivy without SoQt then just do it.

but I’m not sure if compiling pivy without it will break the Draft/Arch/BIM Workbenches.

I didn’t expect that SoQt is still used in Arch but to me it looks the corresponding function isn’t used any more.

yorik
Should this code be removed?

Just did and it seems to have compiled fine. Thanks.

Another question wmayer: Based on this, FreeCAD’s source includes the source code of libarea, zipios++, zlib and quarter. An external Zipios++ provided by the OS can be used with FREECAD_USE_EXTERNAL_ZIPIOS=ON. Can this be done for the other included libraries as well? Usually OpenBSD ports try to use shared libraries as much as possible, but I’m not sure if this is a good idea with the included libraries in FreeCAD. Have they been specifically modified for FreeCAD?

zlib code is not part of the FreeCAD code base. A CMake switch only exists for zipios++ but neither for Quarter and libarea. Furthermore, the Quarter code has changes compared to the original code to better fulfil our needs.

I see, so the wiki is outdated.

Does this mean that an external libarea can be used?

I see, so the wiki is outdated.

No, it’s correct. It’s relevant if you build a LibPack on Windows but for all UNIX systems you usually can use a system package.

Does this mean that an external libarea can be used?

No idea. Maybe ask a maintainer of the Path module.

sliptonic
mlampert

Got it, sorry for the assumption.

sliptonic, mlampert: Would it be an issue to use an external libarea instead of the one included in the FreeCAD sources? The FreeBSD port appears to be doing so, but with the Heeksa/libarea and not with danielfalck/libarea which is referenced here.

Sorry for the delay… Yes, I don’t think SoQt is used in any workbench anymore.

SoQt is still used in Arch and the question is whether OfflineRenderingUtils.viewer() can be removed.

Oh your’re right… :blush:

Well this module is not used in FreeCAD itself, it’s made to be used by other modules, addons, platforms… That viewer was actually just an example, I think it should be reformed to use a quarter widget anyway… So yes, I think we can safely remove it

Only for information on Arch Linux soqt is requested as dependency by python-pivy.

I’ve found it when I’ve updated my Artix Linux distribution deleting all the dependencies on Arch Linux packages, so I’ve had to install all the packages that Artix Linux has not repackaged (Artix Linux is an Arch derivative without SystemD), in the process I’ve found that on Arch Linux these packages are needed to run FreeCAD but are not (yet, hopefully) packaged for Artix Linux:

  • opencascade > freeimage > jxrlib
  • med-openmpi (community) > hdf5-openmpi
  • python-pivy > soqt > coin
  • libspnav

Kind Regards

Carlo D.