Roland's homepage

My random knot in the Web

Compiling asymptote for TeXLive on FreeBSD

When I try to use the version of asymptote that comes with TeXLive, it fails with an error:

Shared object “libreadline.so.7” not found, required by “asy”

So I decided to recompile asymptote. Here’s how to do that.

On my FreeBSD 9.2 system, the original asymptote program made use of the following packages (ports):

  • libsigsegv-2.10 (devel/libsigsegv)
  • ncurses-5.9.20131221 (devel/ncurses)
  • gsl-1.16 (math/gsl)

The version of asymptote that comes with TeXLive 2013 is 2.23. So download asymptote-2.23.src.tgz, then build it as shown below:

cd ~/tmp/src
tar xf ../asymptote-2.23.src.tgz
cd asymptote-2.23/
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  --disable-gl
gmake -j4
strip asy

Alternatively, you can compile it with OpenGL and off-screen rendering support. This is what I did. In this case, the file configure.ac needs the following patch;

335c335
<                          AC_CHECK_LIB([glapi],_glapi_get_context,
---
>                          AC_CHECK_LIB([GL],_glapi_get_context,
338c338
<                        LIBS=$LIBS"-lOSMesa -lglapi"],
---
>                        LIBS=$LIBS"-lOSMesa"],

And the sequence of commands for compilation is a little different;

cd ~/tmp/src
tar xf ../asymptote-2.23.src.tgz
cd asymptote-2.23/
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
strip asy

The executable will now also depend on the GLUT, osmesa, GL and X11 libraries.

Copy the executable file asy to /usr/local/texlive/2013/bin/amd64-freebsd/asy.

Settings

Additionally, I have the following set in ~/.asy/config.asy, this is geared toward the binary with off-screen rendering support.

import settings;
dir="/usr/local/texlive/2013/texmf-dist/asymptote";
outformat="pdf";
pdfviewer="mupdf";
prc=false;
offscreen=true;

←  Using Matroška containers for videos Setting the terminal title with urxvt and tcsh  →