4

I installed Python 3.6 on Ubuntu 16.04 on Docker using the ppa:jonathonf/python-3.6 repository. Now I'd like to install xapian so I can use it with Python. I have not found any ready-made packages, so I am trying to build it from sources. I set PYTHON3 and PYTHON3_LIB parameters to point to Python 3.6. During the build process I get the following error:

ImportError: libxapian.so.30: cannot open shared object file: No such file or directory

I tried xapian versions 1.3.7 and 1.4.5 without luck.

How can I install xapian?

Here's a Dockerfile to reproduce my error:

FROM ubuntu:16.04
RUN apt-get update \
  && apt-get install -y software-properties-common python-software-properties
RUN add-apt-repository ppa:jonathonf/python-3.6
RUN apt-get update \
  && apt-get install -y python3-pip docker.io python3.6 python3.6-dev software-properties-common \
      python-software-properties build-essential wget unzip cmake python3-sphinx \
  && cd /usr/local/bin \
  && ln -s /usr/bin/python3.6 python
RUN python -m pip install --upgrade pip

# install xapian 1.4.5
RUN apt-get update && apt-get install -y curl uuid-dev zlib1g-dev
WORKDIR /root
RUN curl --silent --show-error --fail --next -O https://oligarchy.co.uk/xapian/1.4.5/xapian-core-1.4.5.tar.xz
RUN curl --silent --show-error --fail --next -O https://oligarchy.co.uk/xapian/1.4.5/xapian-bindings-1.4.5.tar.xz
RUN tar xvf xapian-core-1.4.5.tar.xz
RUN tar xvf xapian-bindings-1.4.5.tar.xz
WORKDIR /root/xapian-core-1.4.5
RUN ./configure && make && make install
WORKDIR /root/xapian-bindings-1.4.5
RUN ./configure PYTHON3=/usr/bin/python3.6 PYTHON3_LIB=/usr/lib/python3.6 --with-python3 && make && make install
RUN python -c "import xapian"
4

1 回答 1

2

问题是 Xapianlibxapian.so.30/usr/local/lib(你可以通过添加来告诉它:

RUN ldconfig

在安装核心之后(所以在你改变WORKDIR构建绑定之前)。

在这个 Unix Stackexchange 问题ldconfig的答案中有一些关于 Ubuntu 和库搜索路径的有用信息。

于 2018-05-30T19:43:13.920 回答