Building Trinity Desktop Environment for FreeBSD 14.1-RELEASE

Hello folks,

[Edited 21-Jun-2024 again for a few corrections and additions]

Note: I'm French (despite what the screenshot at bottom suggests). Please bear with my somewhat broken English.

I just finished successfully building Trinity 14.1 on FreeBSD 14.1-RELEASE (amd64)
I've built different versions of Trinity on various o/s versions, from 12.4 (i386) to this one, and it's not been
smooth sailing.

I just wanted to share what I've done here, possibly to save others time and pain.

The "make install" took about 200 minutes altogether on my old HP Probook 6570b laptop, a core
i5-3230M @ 2.60 GHz based machine with 8 Gb of RAM and an ordinary 5400 RPM laptop disk.

The wiki instructions at https://wiki.trinitydesktop.org/FreeBSD_Trinity_Installation_Instruction
are a good start, but they don't quite apply to FreeBSD 14.1 and more is
to be done to avoid endless compilations of programs that are better installed from binary
packages IMHO.

Ports update

The wiki documentation rightly advises to update the /usr/ports tree.
Unfortunately the portsnap command has been phased out by FreeBSD in this version
Not a smart move in my opinion.

Here's what I have done to make sure that I had an up-to-date ports tree:

Code:
# cd /usr/ports
# rm -rf * .[a-z]*
# git clone --depth 1 https://git.FreeBSD.org/ports.git /usr/ports


I'm sure that many people will tell me that's not the proper way to do it.
I'm not a developer, I'm not familiar with git and I didn't want to learn it right now.

Note: if you have a separate /usr/ports filesystem with soft updates journaling, git will complain that the target direction is not empty because of the .sujournal file.
Addressing this issue is beyond the scope of this post. Many possible ways, including targeting a newly created subdirectory and moving things up afterward. I'll let it to you to find your way if you hit this error.
Don't do as I did first, don't delete .sujournal ! ?

Package repository update

The instructions of the wiki should be followed to switch from the quartely to the latest
package repository update.

Installation of packages before build

The wiki provides a list of packages to be installed.
In my experience:

- many more than those listed there should be installed to avoid hours of useless compilation
- the versions for some packages (samba, mysql-client, postgres-client among others) should not
be taken literally.

I installed packages in several different bundles

1- basic build tools

Code:
# pkg install git libtool gettext findutils gsed gtar bash automake \
 cmake gmake ninja rsync

At this point, the Trinity source tree should be pulled as per the instructions in the wiki.

2- some Python stuff


Code:
# pkg install py311-gdbm py311-sqlite3 py311-tkinter

Note that Python 3.11 will be used everywhere during the build.
If you haven't upgraded your ports tree as mentioned above, you will end up in a world of
trouble because the ports tree that comes with 14.1-RELEASE still has 3.9 as the default.
So at some point there will be unsolvable conflicts.

3- more Python stuff

Code:
# pkg install py311-packaging py311-setuptools py311-six py311-evdev \
 py311-pyudev py311-flit-core py311-installer py311-pyproject_hooks \
 py311-build py311-wheel py311-build py311-pyproject_hooks \
 py311-wheel py311-flit-core py311-installer py311-pycparser \
 py311-idna py311-cffi py311-hpack py311-pyasn1 py311-sniffio \
 py311-hyperframe py311-anyio py311-pyasn1-modules py311-attrs \
 py311-certifi py311-cryptography py311-h2 py311-h11 py311-httpcore \
 py311-sortedcontainers py311-outcome py311-service-identity \
 py311-async_generator py311-socksio py311-pylsqpack py311-openssl \
 py311-aioquic py311-trio py311-httpx py311-dnspython py311-markdown \
 py311-flit-core py311-installer py311-pyproject_hooks py311-build \
 py311-wheel py311-dbus py311-pathspec py311-typing-extensions \
 py311-setuptools-scm py311-pluggy py311-calver py311-trove-classifiers \
 py311-hatchling py311-pygments py311-libxml2 py311-cython py311-lxml \
 py311-docutils py311-markupsafe py311-Babel py311-Jinja2 py311-smartypants \
 py311-toml py311-typogrify py311-gi-docgen py311-numpy py311-boost-libs \
 scons-py311 py311-yaml py311-rdiff-backup

Don't ask me why I didn't install these two sets in one single bundle. I can't recall.
Installing all of them in a single bundle would probably work as well.

A whole bunch of non-Python dependencies will be installed too. On my machine, 86 packages
altogether.

4- a bunch of required packages

This comes from the list in the wiki. However some packages that need special attention are
dealt with separately (see below).
Also, the Python stuff has been installed separately above, with the proper version.

Code:
# pkg install aspell bison btparse chmlib clamav cups djvulibre \
 doxygen exempi exif exiv2 facile ffmpeg file firebird30-client \
 gamin gpgme gstreamer1-plugins gtk3 htdig html2ps iceauth \
 imlib2 intltool iw-hspell jasper jpeg-turbo lcms2 libgphoto2 \
 libgpod libmng libmtp libofx libotr libqalculate libssh libvisual04 \
 libwmf libxine libxslt meanwhile

5- more packages that need attention to the version to install

The wiki lists mysql56-client, postgresql11-client, samba413...

This won't work for FreeBSD 14.1-RELEASE with an updated ports tree because these are not
the default versions for ports.

So any package to be built that requires either of these will bring up the default version
instead and will want to build it from source.
It would take forever and probably end up with conflicts as well.

So I have determined the default versions for this ports tree as follows:

Code:
# grep MYSQL_DEFAULT /usr/ports/Mk/bsd.default-versions.mk
MYSQL_DEFAULT?=         8.0
# grep PGSQL_DEFAULT /usr/ports/Mk/bsd.default-versions.mk
PGSQL_DEFAULT?=         15
# grep RUBY_DEFAULT  /usr/ports/Mk/bsd.default-versions.mk
RUBY_DEFAULT?=          3.2
# grep OPENLDAP_DEFAULT  /usr/ports/Mk/bsd.default-versions.mk
OPENLDAP_DEFAULT?=      26

And I've installed these versions instead:

Code:
# pkg install mysql80-client postgresql15-client samba416 ruby openldap26-client

Notes:

- the default version for Ruby actually was OK.

- OpenLDAP client is a dependency of the MySQL client, and the right version would
probably have been installed anyway.


6- more packages

Yes, most if not all of these were in the list of packages to install from the wiki.
They end up in this separate bundle for some reason. Don't ask.

I'm just telling what worked for me. Feel free to re-bundle the packages.

Code:
# pkg install nas ocaml-num openexr pl-libgadu png poppler pulseaudio \
 sane-backends sqlite \
 xf86-video-vesa xmedcon xmodmap xorg-fonts xorg-server xprop xrandr \
 xscreensaver xset xsetroot yaz

Again, a lot of dependencies will be installed.

7- packages that I don't want to build from source

From carefully watching my previous attempts to build Trinity, I've listed many non-Trinity
programs that were built from source.
Of course, it'll work OK if you have a lot of time for this and/or a more powerful machine than
mine to run the build on.

If you want to save time like I did, you'll want to install these from binary packages:

Code:
# pkg install cmake-core nasm meson libcjson \
 py311-certifi py311-cryptography lmdb unixODBC sqlite3 \
 tex-kpathsea nss mpfi p5-File-Which tex-ptexenc zziplib \
 p5-File-HomeDir libpotrace xpdfopen teckit harfbuzz-icu \
 texlive-tlmgr p5-YAML-Tiny t1lib tex-web2c texlive-base \
 p5-Unicode-EastAsianWidth tex-basic-engines p5-Text-Unidecode \
 texlive-texmf p5-Locale-libintl texi2html texinfo tex-formats \
 tex-dvipsk alsa-lib wget tex-libtexlua tex-libtexluajit adobe-cmaps \
 tex-luatex open-motif tex-xmltex tex-dvipdfmx texlive-docs ja-tex-ptex \
 tex-synctex tex-xetex tex-jadetex tex-xdvik texlive-full db5 lcms

Notes:
- yes, the TeX packages are *huge* and they will take forever to load and install. However I've
found out that they're needed for a smooth build. If they're not present, there will be some
missing PNG or JPG files in a documentation tree and the build will fail.
You can always uninstall them later.

- yes, I installed db5 which is *not* the default version (it's db18). It's also an old and
unmaintained port. However if I didn't, the configure script of some bit of Trinity tdesdk-trinity
failed because it wasn't able to find the DB headers beyond version 5.

Here's a second bundle of such packages to avoid lengthy compiles.
Again, why splitting in two bundles? Please don't ask.

Code:
# pkg install libsamplerate jackit xmlcatmgr xmlcharent docbook-xml \
 iso8879 docbook-sgml sdocbook-xml docbook docbook-xsl itstool yelp-xsl \
 yelp-tools gtk-doc frei0r ffnvcodec-headers evdev-proto v4l_compat \
 vulkan-headers xxd asciidoc p5-Locale-gettext help2man glslang \
 spirv-tools opencl libaudiofile libart_lgpl \
 xorg-macros bdftopcf wayland-protocols docbook-xsl-ns vala coreutils \
 rust libconfig boost-jam libical cdparanoia lzo2 openslp gperf \
 net-snmp aalib sdl gnulibiberty utf8proc serf subversion tidy-html5 \
 tradcpp gccmakedep makedepend xorg-cf-files imake transfig nmap \
 libtre cdk streamripper torsocks clucene cppunit sword mp4v2 ladspa \
 libdssialsacompat liblo dssi yajl raptor2 liblrdf ruby32-gems \
 rubygem-asciidoctor

Notes:
- I realize that there are some duplicates in these bundles. Not a big deal and I can't
be bothered to sort them out now.

- no, I'm not sure that all of these actually are required. I've done my best to track down what
packages had been built from source and installed over my previous attempts, but I might
have included packages here that weren't from there.

Actual build and install

As per the wiki : plug the the Trinity source tree into the ports

Code:
# ./tde-packaging/freebsd/tde-ports-map

Then run the build

Code:
# cd /usr/ports/x11/tde-meta
# make install NO_DIALOG=yes

Note: NO_DIALOG=yes for an unattended build.

There still was *one* issue that needed to be manually taken care of.
The install of the imlib package failed because of a missing man page. Actually a man page
that's not found at the expected location.
It could certainly be corrected in a better way, but I chose the quick and easy way:

Code:
# mkdir -p /usr/ports/graphics/imlib/work/stage/usr/local/man/man1
# cp /usr/ports/graphics/imlib/work/stage/usr/local/share/man/man1/imlib-config.1.gz \
 /usr/ports/graphics/imlib/work/stage/usr/local/man/man1

Then restart the build (just recall the make install command above)

After a bit over three hours, I had a successful install of Trinity.

A last small fix

You'll notice that you get the TDE licence popup every time you start the desktop environment.
This is due to the /opt/trinity/bin/tde_show_license using sed in a way that doesn't work on FreeBSD

I apply this little one-line patch to the said file to correct this:

Code:
*** tde_show_license_info.org   Thu Apr 18 22:32:18 2024
--- tde_show_license_info       Thu Jun  6 11:10:03 2024
***************
*** 7,17 ****
  # As this script is run as a global TDE autostart app, all
  # environment variables should already be set.


  if [ "$TDEDIR" = "" ] || [ "$TDEHOME" = "" ]; then
    exit 1
  fi


! RELEASE_MINOR_VERSION="$( ${TDEDIR}/bin/tde-config --version | sed -n  's|^TDE: \(R[0-9]\+\.[0-9]\+\)\.[0-9]\+[^0-9]*|\1|p' )"
  LICENSE_INFO="$( ${TDEDIR}/bin/kreadconfig --file ${TDEHOME}/share/config/kdeglobals --group "License Info" --key "${RELEASE_MINOR_VERSION}" )"


  if [ "$LICENSE_INFO" = "" ] || [ "$LICENSE_INFO" != "true" ]; then
--- 7,21 ----
  # As this script is run as a global TDE autostart app, all
  # environment variables should already be set.


+ # With patches for FreeBSD awk:
+ # - added -E option for extended REs
+ # - no \ in front of ( ) +
+
  if [ "$TDEDIR" = "" ] || [ "$TDEHOME" = "" ]; then
    exit 1
  fi


! RELEASE_MINOR_VERSION="$( ${TDEDIR}/bin/tde-config --version | sed -En  's|^TDE: (R[0-9]+\.[0-9]+)\.[0-9]+[^0-9]*|\1|p' )"
  LICENSE_INFO="$( ${TDEDIR}/bin/kreadconfig --file ${TDEHOME}/share/config/kdeglobals --group "License Info" --key "${RELEASE_MINOR_VERSION}" )"


  if [ "$LICENSE_INFO" = "" ] || [ "$LICENSE_INFO" != "true" ]; then

I prefer not starting a GUI when I boot my machine, so I login in text mode and run X afterwards with the 'startx' command.

To make it run Trinity instead of the default X environment, I apply the following patch to /usr/local/etc/X11/etc/xinit/xinitrc

Code:
** xinitrc.org Thu Jun  6 10:00:53 2024
--- xinitrc     Thu Jun  6 10:01:03 2024
***************
*** 48,56 ****
        unset f
  fi


! twm &
! xclock -geometry 50x50-1+1 &
! xterm -geometry 80x50+494+51 &
! xterm -geometry 80x20+494-0 &
! exec xterm -geometry 80x66+0+0 -name login


--- 48,63 ----
        unset f
  fi


! # Start TDE if present, else basic twm session
! if [ -d /opt/trinity/bin -a -d /opt/trinity/lib ]; then
!         PATH=$PATH:/opt/trinity/bin
!         exec /opt/trinity/bin/starttde
! else
!       twm &
!       xclock -geometry 50x50-1+1 &
!       xterm -geometry 80x50+494+51 &
!       xterm -geometry 80x20+494-0 &
!       exec xterm -geometry 80x66+0+0 -name login
! fi
!

Just to end up with a picture, here's a screenshot of my somewhat customized Trinity Desktop running on this machine
1718804232589.png

That's it, folks. Hope this helps.
Of course, comments, corrections and constructive criticism quite welcome.
 
Last edited:
Nice. Thanks for the breakdown of steps. Considerable amount of work to document this.

Currently a bit overworked but look forward to grab some time to give it a shot!
 
Hello again, replying to my own thread here...
I tried to follow my own procedure written above to build Trinity 4.1.2 on my old beloved HP/Compaq nc8430 laptop.
It's a Centrino Duo 1st generation machine, hence 32 bits CPU.

So, I installed FreeBSD 4.1-RELEASE i386 on it.

Making X run was kind of a nightmare to start with, the radeonkms kernel module freezing the machine when it loads the corresponding GPU firmware and the libglamoregl.so X.org extension module going south and killing the X server (I had to rename it so that it's not loaded). As the i386 version of FreeBSD is going kind of unmaintained these days, not much hope for a fix, but this is another story.

All went well (but slow) until the build of caffeine, which failed with a bunch of errors like this:

Code:
ld: error: cannot preempt symbol: xine_config_save
>>> defined in /usr/local/lib/libxine.so
>>> referenced by xineConfig.cpp
>>>               src/app/CMakeFiles/codeine.dir/xineConfig.cpp.o:(XineConfigDialog::saveSettings())

Same with a few xine_* symbols.
I've spent quite some time trying to figure out why this, but couldn't.
The xine_config_save function shows up as an unresolved external symbol in the .o file, so for the sake of me I can't see how there could be a redefinition here. But my C++ skills are basic at best.

A Google search hit a reported bug about something similar, that gave me this hint: define a LDFLAGS=-fuse-ld=bfd environment variable for this build.
So I did:

Code:
cd /usr/ports/multimedia/codeine-trinity
make distclean
export LDFLAGS=-fuse-ld=bfd
make INSTALL NO_DIALOG=yes

Then resume the global build:
Code:
cd /usr/ports/x11/tde-meta
unset LDFLAGS
make install NO_DIALOG=yes

Why does the i386 environment needs this trick while the amd64 environment doesn't?
Beats me, but here it is.
If I hit more snags, I'll followup here.
Even if I might be the only one in the world trying to build Trinity on FreeBSD i386 ?
 
If these steps get converted from a forum post to a ports tree entry, more users may try building it...though i386 users are still harder to come by. Having a port means people could have a package, and hopefully results in a install+uninstall being looked over for cleanliness.
 
Hello, all:
I kept running into find.h "'_string/constexpr_c_functions.h' file not found" fatal error in
kernel/qtaddons_x11.cpp
kernel/qt_x11_p.h
kernel/ntqwindowdefs.h
../include/ntqstring.h
/usr/include/c++/v1/string
/usr/include/c++/v1/__algorithm/remove.h, on FreeBSD 13.3 for i386 (llvm15).
This is only an issue with TDE for me. Anything else in ports, and most other sources I have compiled isn't an issue; freebsd updates without issue, etc. So I doubt it's a botched install since the issue seems only to be with TDE 'ports'.
I doubt since 13.3 EOL soon, and most people aren't interested in TDE as much, that this will have a resolution here. I'm just placing this here in the event someone else has the same issue. I'll be asking over at TDE also.
I wish everyone well!
 
Back
Top