This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

FreeBSD

This page is not completed! Many things still not work

This page will not be actively maintained! Most new things are moved to [[Projects/Jhbuild/FreeBSD]]

Projects/Jhbuild/FreeBSD

Many GNOME softwares can be built on FreeBSD. However, some libraries and softwares related to kernels and hardwares can only be built on Linux. In order to successfully build GNOME on FreeBSD, some modules and features have to be skipped or disabled. There is a table on GNOME wiki: PortabilityMatrix.

Xorg

Add WITH_NEW_XORG=yes to your /etc/make.conf, so you can get newer Xorg, libdrm, and Mesa from ports. It is required to build cogl. https://wiki.freebsd.org/Xorg

Compilers

FreeBSD ships GCC 4.2 in its base system, but it is too old to build some modules such as WebKitGtk, which requires C++11 features. For FreeBSD versions later then 9.2, Clang 3.3 is included in the base system, so you should use it instead of outdated GCC. You may want to add the following text in your ~/.config/jhbuildrc.

os.environ['CC'] = 'clang'
os.environ['CXX'] = 'clang++'
os.environ['CPP'] = 'clang-cpp'

If libc++ is not installed in your base system, use the following command to install it.

svn co https://svn0.us-east.freebsd.org/base/releng/<version> /usr/src
cd /usr/src/lib/libcxxrt && make && make install
cd /usr/src/lib/libc++ && make && make install

If you are using older versions of FreeBSD, you can build GCC 4.7 or later versions from the FreeBSD ports collection.

portmaster lang/gcc47

After installing new GCC, you should add the following text in your /etc/libmap.conf, so the dynamic linker will use the new libraries instead the old ones provided in the base system. Create the file if it does not exist.

libgcc_s.so.1  gcc47/libgcc_s.so.1
libgomp.so.1   gcc47/libgomp.so.1
libobjc.so.4   gcc47/libobjc.so.4
libssp.so.0    gcc47/libssp.so.0
libstdc++.so.6 gcc47/libstdc++.so.6

You can rebuild all softwares on the system using the new GCC now! Add the following text into /etc/make.conf.

CC=gcc47
CXX=g++47
CPP=cpp47
LDFLAGS=-L/usr/local/lib/gcc47

Rebuild all ports.

portmaster -af

Add the following text into your ~/.config/jhbuildrc.

os.environ['CC'] = 'gcc47'
os.environ['CXX'] = 'g++47'
os.environ['CPP'] = 'cpp47'

Install Dependencies

GNU software

portmaster devel/autoconf devel/automake devel/gettext devel/gmake devel/libtool ftp/wget lang/gawk shells/bash textproc/gsed textproc/flex

Languages

portmaster lang/perl5.16 lang/python27 lang/python33 lang/ruby19

CVS / Subversion / Git / Mercurial / Bazaar

portmaster devel/cvs devel/subversion devel/git devel/mercurial devel/bzr

Other

portmaster archivers/libarchive audio/alsa-lib audio/flac audio/libcanberra audio/libcanberra-gtk3 audio/libsndfile audio/speex audio/taglib audio/wavpack devel/dbus devel/dbus-glib devel/desktop-file-utils devel/icu devel/json-c devel/libical devel/nspr devel/ragel devel/xorg-macros graphics/cairomm graphics/exiv2 graphics/jpeg graphics/lcms2 graphics/libGL graphics/libexif graphics/libgphoto2 graphics/png graphics/py-cairo graphics/tiff graphics/webp lang/spidermonkey185 mail/gmime26 misc/e2fsprogs-libuuid misc/shared-mime-info multimedia/libdvdread multimedia/libv4l multimedia/libvpx net/avahi net/liboauth net/libproxy print/cups security/cracklib security/libtasn1 security/nettle security/nss textproc/enchant textproc/gnome-doc-utils textproc/intltool textproc/py-rdflib textproc/raptor2 www/neon29 x11-fonts/libXft x11-themes/icon-naming-utils x11-toolkits/libXt x11/kbproto x11/libSM x11/libX11 x11/libXcomposite x11/libXcursor x11/libXfixes x11/libXinerama x11/libXrandr x11/libXtst x11/libxcb x11/libxkbfile x11/libxklavier x11/pixman x11/startup-notification x11/xkeyboard-config x11/xproto

Prepare Environment

Some packages have hard-coded path to some executables. Some packages expect GNU tools instead of BSD versions provided in the base system. In order to successfully build these packages, you have to create some symbolic links and modify PATH.

# Make sure ~/.local/bin is the first directory in your PATH
export PATH=$HOME/.local/bin:$PATH
ln -s /usr/local/bin/bash /bin/bash
ln -s /usr/local/bin/python /usr/bin/python
ln -s /usr/local/bin/python-config /usr/bin/python-config
ln -s python-2.7.pc /usr/local/libdata/pkgconfig/python2.pc
ln -s python-3.3.pc /usr/local/libdata/pkgconfig/python3.pc
ln -s /usr/local/lib/libpython3.3m.so /usr/local/lib/python3.3/config-3.3m/libpython3.3m.so
# Many packages expect make is GNU make
ln -s /usr/local/bin/gmake ~/.local/bin/make
# Some packages expect sed is GNU sed
ln -s /usr/local/bin/gsed ~/.local/bin/sed
# flex in the base system is too old to build some packages
ln -s /usr/local/bin/flex ~/.local/bin/flex
ln -s /usr/local/bin/automake-1.14 ~/.local/bin/automake-1.13
ln -s /usr/local/bin/aclocal-1.14 ~/.local/bin/aclocal-1.13

System compilers does not search /usr/local/include for headers and system linkers does not search /usr/local/lib for libraries by default. You can create a wrapper to automatically add options to the compilers and linkers.

cat > ~/.local/bin/cc << "EOF"
#!/bin/sh
include_flags="-isystem /usr/local/include -isystem /usr/include/rpcsvc"
linker_flags="-Wl,-Y/usr/local/lib"
for i; do
    case "$i" in
        -c|-S|-E) unset linker_flags; break;;
    esac
done
exec /usr/bin/$(basename $0) ${include_flags} "$@" ${linker_flags}
EOF
chmod a+x ~/.local/bin/cc
ln -s ~/.local/bin/cc ~/.local/bin/c++
ln -s ~/.local/bin/cc ~/.local/bin/cpp
ln -s ~/.local/bin/cc ~/.local/bin/clang
ln -s ~/.local/bin/c++ ~/.local/bin/clang++
ln -s ~/.local/bin/cpp ~/.local/bin/clang-cpp

Install JHBuild

You can only configure JHBuild without autotools at the first time.

git clone git://git.gnome.org/jhbuild
cd jhbuild
./autogen.sh
make
make install

Build the modules required to configure JHBuild with autotools

jhbuild build gnome-common yelp-tools

Now, you can configure JHBuild with autotools inside the JHBuild shell

jhbuild shell
./autogen.sh
make
make install

Some dependencies cannot be satified. Type `jhbuild build --nodeps' to build,

Required packages:
  System installed packages which are too old:
    libcanberra (libcanberra.pc, required=0.30, installed=0.28)
    libxklavier (libxklavier.pc, required=5.2.1, installed=5.0)
  No matching system package installed:
    xorg-wacom (xorg-wacom.pc)
    gudev (gudev-1.0.pc, required=173)
    smbclient (smbclient.pc)
    py3cairo (py3cairo.pc, required=1.10.0)
    libudev (libudev.pc, required=143)
    libusb1 (libusb-1.0.pc)
jhbuild build: Required system dependencies not installed. Install using the command 'jhbuild sysdeps --install' or to ignore system dependencies use command-line option --nodeps

Configure JHBuild

Add the following text into your ~/.config/jhbuildrc. Omit gcc47 arguments if you are not using gcc built from ports.

skip = [ 'wayland', 'NetworkManager', 'ModemManager', 'udisks', 'libgusb',
         'gnome-bluetooth', 'bluez', 'sbc', 'libwacom', 'libmbim', 'libqmi',
         'network-manager-applet', 'gnome-disk-utility', 'libevdev',
          'gnome-logs', 'dleyna-renderer' ]

os.environ['VALAC'] = 'valac --vapidir=/usr/local/share/vala/vapi'
os.environ['CFLAGS'] = '-Wall -g -O2 '
os.environ['CPPFLAGS'] = '-D__FreeBSD_kernel_version=__FreeBSD_version ' + \
                         '-DENODATA=61 -DSIGCLD=SIGCHLD -DSIGPOLL=SIGIO ' + \
                         '-Dfdatasync=fsync -D__LONG_LONG_SUPPORTED ' + \
                         '-Dcpuset_t=cpu_set_t '
os.environ['CXXFLAGS'] = os.environ['CFLAGS']
os.environ['ZLIB_CFLAGS'] = '-I/usr/include'
os.environ['ZLIB_LIBS'] = '-L/usr/lib -lz'

# not needed if using the ~/.local/bin/cc compiler wrapper
#os.environ['CPATH'] = '/usr/local/include:/usr/include/rpcsvc'
#os.environ['LIBRARY_PATH'] = os.path.expanduser(prefix) + '/lib:' + \
#                             '/usr/local/lib'
#os.environ['LDFLAGS'] = '-L/usr/local/lib -L/usr/local/lib/gcc47 '

module_autogenargs['clutter']='--disable-wayland-backend --disable-wayland-compositor'
module_autogenargs['cogl']='--disable-wayland-egl-platform --disable-wayland-egl-server --disable-kms-egl-platform'
module_autogenargs['colord']='--disable-gusb --disable-udev --disable-systemd-login'
module_autogenargs['glib']='--disable-dtrace --with-libiconv=gnu'
module_autogenargs['glib-networking']='--with-ca-certificates=/usr/local/share/certs/ca-root-nss.crt'
module_autogenargs['gnome-settings-daemon']='--disable-gudev --disable-rfkill'
module_autogenargs['gstreamer']='--disable-docbook --disable-gtk-doc'
module_autogenargs['gtk+']='--disable-wayland-backend'
module_autogenargs['gtk-doc']='--with-xml-catalog=/usr/local/share/xml/catalog.ports'
module_autogenargs['gvfs']='--disable-bluray --enable-hal'
module_autogenargs['librest']='--with-ca-certificates=/usr/local/share/certs/ca-root-nss.crt'
module_autogenargs['p11-kit']='--with-trust-paths=/usr/local/share/certs/ca-root-nss.crt'
module_autogenargs['PackageKit']='--disable-systemd --disable-systemd-updates --enable-ports'
module_autogenargs['pulseaudio']='--disable-bluez4 --disable-bluez5 --enable-oss-output --enable-oss-wrapper --without-caps'
module_autogenargs['pygobject']='--disable-cairo'
module_autogenargs['vte']='--disable-gnome-pty-helper'
module_autogenargs['WebKit']='--disable-geolocation '
module_extra_env['WebKit'] = {
    'CPPFLAGS': os.environ['CPPFLAGS'] + '-I/usr/local/include/c++/v1 ' + \
                '-DGTEST_USE_OWN_TR1_TUPLE ',
    'CXXFLAGS': os.environ['CXXFLAGS'] + '-stdlib=libc++ '
}
module_extra_env['js17'] = { 'CXX': 'g++' }

# this should be removed ...
#autogenargs='--disable-wayland-backend --disable-gusb --disable-gudev ' + \
#            '--disable-wayland-egl-platform --disable-wayland-egl-server ' + \
#            '--disable-systemd --disable-systemd-login --disable-dtrace ' + \
#            '--disable-bluez --disable-rfkill --without-caps ' + \
#            '--with-xml-catalog=/usr/local/share/xml/catalog.ports ' + \
#            '--with-ca-certificates=/usr/local/share/certs/ca-root-nss.crt ' + \
#            '--with-trust-paths=/usr/local/share/certs/ca-root-nss.crt ' + \
#            '--disable-gnome-pty-helper --enable-ports '

Libtool Issue

The library naming can be very annoying on FreeBSD because the soname in the library includes the minor version number, so the soname of the library may be changed every time you update it. For example, you have libgobject-2.0.so.3792 installed yesterday, so the valac you built depends on libgobject-2.0.so.3792 to work. You update glib today and to soname is changed to libgobject-2.0.so.3793, and your valac does not work. Rebuild everything because of a minor update not only takes a lot of time but also causes a lot of problem in building.
There is a workaround in FreeBSD ports tree. It modifies ltmain.sh and libtool distributed in the tarball. However, most modules are checked out from git, and ltmain.sh and libtool are generated. Therefore, we should modify the libtool itself instead. In order to prevent changing behavior of libtool installed on the system, we can let JHBuild build libtool and use the modified libtool only in JHBuild environment.

jhbuild bootstrap libtool

Find the file called libtool.m4 (normally share/aclocal/libtool.m4) and apply this patch file libtool.patch. This file is based on the file /usr/ports/Mk/bsd.gnome.org in FreeBSD ports. You may want to run jhbuild build -a so it will run autogen.sh even if it is built from a tarball.
Reference 1: https://blog.flameeyes.eu/2010/10/linkers-and-names
Reference 2: http://freebsd.unixtech.be/gnome/docs/gnome_porting.html
Reference 3: http://svn0.us-east.freebsd.org/ports/head/Mk/bsd.gnome.mk

Gettext Issue

Autopoint may say it cannot find AM_GNU_GETTEXT_VERSION. You may want to let JHBuild build a usable version of gettext for you.

jhbuild bootstrap gettext

Common Compilation Error

Format string error

This error occurs in glib, libsoup, gjs, glade, gedit, gnutls, clutter, cheese, vino, libgxps, evince, anjuta, brasero, nautilus-sendto, ghex, vinagre and maybe other modules. Use the following command to suppress the error if you are using clang.

find . -name Makefile -exec sed -i.bak 's/-Werror=format[^ ]*//g' '{}' ';'

Other Notes

accountsservice (Does not work ...)

Apply this patch file accountsservice.patch. This file is based on patch files checked out from svn://creme-brulee.marcuscom.com/ports/trunk/sysutils/accountsservice/files.

anjuta

Remove --no-warn option by using the following command.

find . -name Makefile -exec sed -i.bak 's/--no-warn//g' '{}' ';'

Some modules may assume the inline keyword works like GCC extension inline, which may cause undefined reference when compiling with clang (C99 inline). Prepend extern to declaration of those functions which cause undefined reference.

colord

You should remove libudev from lib/colord/colord.pc.in

sed -i.bak 's|, libudev$||g' lib/colord/colord.pc.in

dconf

FreeBSD does not have libdl. Functions such as dlopen are located in libc. Remove the -ldl from the Makefile by this command.

sed -i.bak 's/-ldl//g' tests/Makefile

dleyna-connector-dbus

This module assumes /bin/sh is bash.

sed -i.bak '1c #! /usr/local/bin/bash' configure
find . -name Makefile -exec sed -i.bak 's|/bin/sh|/usr/local/bin/bash|g' '{}' ';'

dleyna-core

This module assumes /bin/sh is bash.

sed -i.bak '1c #! /usr/local/bin/bash' configure
sed -i.bak '1c #! /usr/local/bin/bash' libtool
find . -name Makefile -exec sed -i.bak 's|/bin/sh|/usr/local/bin/bash|g' '{}' ';'

evolution-data-server

Berkeley DB cannot be found via configure. You can change the following lines in configure.ac from

DB_CFLAGS="-I$libdb_prefix/include"
DB_LIBS="-L$libdb_prefix/lib -ldb"

to

DB_CFLAGS="-I/usr/local/include/db42"
DB_LIBS="-L/usr/local/lib/db42 -ldb"

Using malloc.h in FreeBSD is not allowed. Use this command to remove the line

sed -i.bak 's/#include <malloc.h>//' calendar/libedata-cal/e-cal-backend-intervaltree.c

gdm

Apply this patch file. gdm.patch

gnome-shell

Use the following command to disable NetworkManager.

sed -i.bak '/libnm/d' configure.ac
sed -i.bak '/shell-network-agent/d' src/Makefile.am
sed -i.bak 's/NetworkManager-1\.0//' src/Makefile.am
sed -i.bak 's/NMClient-1\.0//' src/Makefile.am

gst-plugins-bad

The Makefiles assume the C++ library is named after libstdc++. However, libstdc++ is removed in FreeBSD 10, and libc++ should be used instead. Use the following command to change it.

find . -name Makefile -exec sed -i.bak 's/-lstdc\+\+/-lc\+\+/g' '{}' ';'

gnome-terminal

No patch required now!

gtk+

libintl is located in /usr/local/lib. You should manually add -L/usr/loca/lib to command line.

js17

After running configure, use the following command to disable dtrace. Currently js17 does not build with clang, so you may want to set CXX to g++.

sed -i.bak 's/#define INCLUDE_MOZILLA_DTRACE.*//' js/src/js-confdefs.h
sed -i.bak 's/-DINCLUDE_MOZILLA_DTRACE=1//' js/src/config/autoconf.mk
sed -i.bak 's/HAVE_DTRACE.*//' js/src/config/autoconf.mk

Note: js24 can be built using clang without patch!

libgsf

Use the following command to suppress error in format string if you are using clang.

find . -name Makefile -exec sed -i.bak 's/-Werror=format[^ ]*//g' '{}' ';'

librsvg

Apply this patch file librsvg.patch to change the non-portable canonicalize_file_name to POSIX.1-2008 realpath function.

polkit

Apply this patch file polkit.patch to fix incorrect function usage and suppress the building of mocklibc. It is required because some functions are declared differently or not available on FreeBSD.

pulseaudio

Apply this patch file pulseaudio.patch and create config.cache file with following text because configure script mistakenly set HAVE_PTHREAD_SETAFFINITY_NP to 1.

ac_cv_search_pthread_setaffinity_np=no

Add --cache-file=config.cache to ./configure command line.

seed

Remove non-existent locale variables.

sed -i.bak '/LC_PAPER/d' modules/gettext/seed-gettext.c
sed -i.bak '/LC_NAME/d' modules/gettext/seed-gettext.c
sed -i.bak '/LC_ADDRESS/d' modules/gettext/seed-gettext.c
sed -i.bak '/LC_TELEPHONE/d' modules/gettext/seed-gettext.c
sed -i.bak '/LC_MEASUREMENT/d' modules/gettext/seed-gettext.c
sed -i.bak '/LC_IDENTIFICATION/d' modules/gettext/seed-gettext.c

WebKit (Does not work ...)

Use the following command to remove -stdlib=libstdc++ if you are using libc++.

sed -i.bak 's/-stdlib=[^ ]*//g' configure

Some required headers are not #included in WebKitGtk source files. There are patch files to fix the problem.

Apply this file if you are using version 2.1.3 or later: webkitgtk-2.1.3.patch
Apply this file if you are using version 2.2.1 or later: webkitgtk-2.2.1.patch

You should apply two patch files if you are using version 2.2.1 or later. However, this patch does not fix all build problem. Modification to LDFLAGS is required to successfully build WebKit. You can grep your lib directory to find missing libraries and add it to command line. You may try to run the following command several times:

make LDFLAGS="$LDFLAGS *.la"
make LDFLAGS="$LDFLAGS libWebCore*.la"
make LDFLAGS="$LDFLAGS libWebCore*.la *.la"
make LDFLAGS="$LDFLAGS libWebCore*.la *.la -L/usr/local/lib/gcc47 -lstdc++"
make LDFLAGS="$LDFLAGS libWebCore*.la *.la -lgdk-x11-2.0"
make LDFLAGS="$LDFLAGS libWebCore*.la *.la -lgdk-3"

If these commands do not fix your problem, you should directly run /bin/sh ./libtool --tag=CXX [arguments] and add additional arguments instead of modifying LDFLAGS.

zeitgeist

Apply this patch file. zeitgeist.patch

Projects/Jhbuild/Dependencies Projects/Jhbuild/FreeBSD


2024-10-23 11:48