Roland's homepage

My random knot in the Web

TeXLive 2018 update

date: 2018-06-24
reading time: 6 min.
category: howto
tags: TeXLive

Today I updated my TeXLive install to 2018. Although the install went fine, there was a problem with the binaries.

Both asymptote and xetex were linked to different versions of some libraries than those that are supplied by ports. So I had to rebuild them.

Reason

Some might wonder why I install TeXLive myself instead of using the one from ports. The reasons for doing that are nicely summed up at anthesphoria.net.

Personally I think that it is a bit of a waste of time to re-package TeXLive for ports, since TeXLive basically lives in its own tree and is built to use as little system libraries as possible.

There is only one port that I use which is influenced by my using TeXLive: gnuplot. Therefore I always build a private version of that port.

Preparations

I changed the ownership of /usr/local/texlive to myself, so I could install and upgrade as a normal user. Next I made a backup of my current installation, just to be sure.

# chown -R rsmith:rsmith /usr/local/texlive
> cd /usr/local/texlive
> tar cvf ~/backup-texlive-2017.tar 2017/

Installation

After downloading the network installer from here, I unpacked it and ran it as rsmith, after setting the umask. (my default umask shuts out other users.) It found my previous install in /usr/local/texlive/2017 and offered to use the settings I had employed then.

> cd ~/tmp/src
> tar xf ../install-tl-unx.tar.gz
> cd install-tl-20180623/
> umask 022
> ./install-tl
Loading http://ftp.snt.utwente.nl/pub/software/tex/systems/texlive/tlnet/tlpkg/texlive.tlpdb
Installing TeX Live 2018 from:
http://ftp.snt.utwente.nl/pub/software/tex/systems/texlive/tlnet (not verified)
Platform: amd64-freebsd => 'FreeBSD on x86_64'
Distribution: net  (downloading)
Using URL: http://ftp.snt.utwente.nl/pub/software/tex/systems/texlive/tlnet
Directory for temporary files: /tmp/r2Qzk3VICx

An old installation of TeX Live has been found in /usr/local/texlive/2017

If you want the selection of schemes/collections and various options being
taken over press `y', otherwise anything else.

Import settings from previous TeX Live installation: (y/n): y


======================> TeX Live installation procedure <=====================

======>   Letters/digits in <angle brackets> indicate   <=======
======>   menu items for actions or customizations      <=======

Detected platform: FreeBSD on x86_64

<B> set binary platforms: 1 out of 17

<S> set installation scheme: scheme-custom

<C> set installation collections:
    37 collections out of 41, disk space required: 4535 MB

<D> set directories:
TEXDIR (the main TeX directory):
    /usr/local/texlive/2018
TEXMFLOCAL (directory for site-wide local files):
    /usr/local/texlive/texmf-local
TEXMFSYSVAR (directory for variable and automatically generated data):
    /usr/local/texlive/2018/texmf-var
TEXMFSYSCONFIG (directory for local config):
    /usr/local/texlive/2018/texmf-config
TEXMFVAR (personal directory for variable and automatically generated data):
    ~/.texlive2018/texmf-var
TEXMFCONFIG (personal directory for local config):
    ~/.texlive2018/texmf-config
TEXMFHOME (directory for user-specific files):
    ~/texmf

<O> options:
[ ] use letter size instead of A4 by default
[X] allow execution of restricted list of programs via \write18
[X] create all format files
[X] install macro/font doc tree
[ ] install macro/font source tree
[ ] create symlinks to standard directories

<V> set up for portable installation

Actions:
<I> start installation to hard disk
<P> save installation profile to 'texlive.profile' and exit
<H> help
<Q> quit

Enter command: i

This installed 3541 packages. After the installation, I removed the 2017 tree.

> cd /usr/local/texlive
> rm -rf 2017/

Adjusting the configuration

The path to several parts of the TeXLive distribution are found in several places in my configuration files:

  • csh.cshrc
  • config.asy
  • cshrc.root
  • login.conf
  • profile
  • texlive.conf

Fortunately, I keep all these files in a separate directory tree (which is also a git repository), so updating all these path was relatively simple using find with sed.

cd setup/
find . -type f -not -path './.git/*' -not -name './*.jpg' \
-exec sed -i '' -e 's|texlive/2017|texlive/2018|g' {} \;

After checking in these changes, I used my deploy script to roll them out.

Since the PATH environment variable is set in login.conf, I needed to log out and back in to effect the changes.

Fonts

All the opentype fonts in my TeXLive installation are linked to one of my global font directories, so other programs can find them. This is accomplished by the shell-script tex-fonts.

This needs to be run after every TeXLive install and removal of the old texlive version.

> cd ~/src/scripts/public
# sh texfonts.sh

Rebuilding programs with incorrect libraries

Looking at the output of ldd /usr/local/texlive/2018/bin/amd64-freebsd/*, it seems that some libraries are not correct:

  • asy is missing libOSMesa.so.9 (FreeBSD ports provide libOSMesa.so.8), libglut.so.12 (FreeBSD ports provide libglut.so.3) and libreadline.so.8 (FreeBSD ports provide libreadline.so.7).
  • xetex is missing libfreetype.so.9 (FreeBSD ports provides libfreetype.so.6, which xetex is also linked to).

I’m not sure where these mismatches come from.

Rebuilding asymptote

According to /usr/local/texlive/2018/texmf-dist/asymptote/version.asy, texlive needs asymptote 2.44. I’ve downloaded asymptote-2.44.src.tgz and asymptote.pdf from sourceforge, unpacked the tarball and built it.

Building asymptote with OpenGL and off-screen rendering support was done as follows. Note that the configure.ac file needs a small patch, because libOSMesa requires libunwind.

--- configure.ac.orig       2018-06-24 13:38:23.330943000 +0200
+++ configure.ac    2018-06-24 13:41:14.403961000 +0200
@@ -359,8 +359,8 @@
            AC_MSG_NOTICE([*** Could not find libglut: will compile without GLUT support ***]))
esac
    if test "x$enable_offscreen" != "xno"; then
-           AC_CHECK_LIB([OSMesa],OSMesaCreateContext,,
-                   AC_MSG_NOTICE([*** Could not find libOSMesa: will compile without offscreen rendering support ***]))
+           AC_CHECK_LIB([OSMesa],OSMesaCreateContext,LIBS=$LIBS"-lOSMesa -lunwind ",
+                   AC_MSG_NOTICE([*** Could not find libOSMesa: will compile without offscreen rendering support ***]), -lunwind)
    fi
fi
> cd ~/tmp/src
> tar xf ../asymptote-2.44.src.tgz
# Apply the patch to configure.ac
> autoheader
> autoconf
> env LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include CC=clang \
CXX=clang++ ./configure --prefix=/tmp/asyinst --enable-texlive-build \
--disable-gc --disable-fftw --disable-readline --enable-gsl --enable-gl \
--enable-offscreen
> gmake -j4
> mv /usr/local/texlive/2018/bin/amd64-freebsd/asy \
/usr/local/texlive/2018/bin/amd64-freebsd/asy.orig
> chmod a-x /usr/local/texlive/2018/bin/amd64-freebsd/asy.orig
> install -s asy /usr/local/texlive/2018/bin/amd64-freebsd/

This yields a working asymptote.

Rebuilding XeTeX

To rebuild this, I downloaded texlive-20180414-source.tar.xz from ftp://tug.org/texlive/historic/2018/

> cd ~/tmp/src/
> mkdir xetex-build
> tar xf ../texlive-20180414-source.tar.xz
> cd xetex-build/
> env MAKE=gmake ../texlive-20180414-source/configure --disable-all-pkgs \
--enable-xetex --disable-debug --with-system-libpng -C \
--with-system-poppler --with-system-freetype2
> gmake
> cd texk/kpathsea/
> gmake
> cd ../web2c
> gmake xetex
> mv /usr/local/texlive/2018/bin/amd64-freebsd/xetex \
/usr/local/texlive/2018/bin/amd64-freebsd/xetex.orig
> chmod a-x /usr/local/texlive/2018/bin/amd64-freebsd/xetex.orig
> install -s xetex /usr/local/texlive/2018/bin/amd64-freebsd/
> cd ..
> rm -rf xetex-build/
> rm -rf texlive-20180414-source/

This yields a working xetex. It does use a lot more system libraries than the original one but I can live with that. So I have not expended any effort to minimize the amount of libraries used.


For comments, please send me an e-mail.


Related articles


←  Video manipulation with ffmpeg Drawing with PostScript  →