我一直在尝试使用 Debian:Jessie docker 文件安装 pygit2 和 libgit2。我可以用 ubuntu 编译几乎相同的包,但不能用 debian。
下面是我使用的 Dockerfile 和输出错误示例
FROM debian:jessie
# Install packages
RUN DEBIAN_FRONTEND=noninteractive apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -yqq \
libssl-dev \
libssh2-1-dev \
libffi-dev \
zlib1g-dev \
python-cffi \
python-dev \
python-pip \
build-essential \
cmake \
gcc \
pkg-config \
git \
libhttp-parser-dev \
python-setuptools
RUN cd /tmp && \
wget https://github.com/openssl/openssl/archive/OpenSSL_1_0_1r.tar.gz && \
tar xzf OpenSSL_1_0_1r.tar.gz && \
cd openssl-OpenSSL_1_0_1r && \
./config -fPIC --prefix=/usr/local/ -ldl && \
make && \
make install
RUN cd /tmp && \
wget https://github.com/libgit2/libgit2/archive/v0.20.0.tar.gz && \
tar xzf v0.20.0.tar.gz && \
cd libgit2-0.20.0/
RUN cd /tmp/libgit2-0.20.0 && \
cmake . && \
cmake --build . && \
ldconfig && \
pip install -I pygit2==0.20.3 && \
pip install -I pyOpenSSL==0.15.1
RUN pip install pip==8.1.2 && \
pip install cherrypy==3.2.2 \
tornado==4.3 \
docker-py==1.8.1 \
halite==0.1.17 \
GitPython==0.3.2.RC1 \
# pygit2==0.20.3 \
pyOpenSSL==0.15.1
但是在编译 libgit2 库时,出现以下错误
[ 99%] Building C object CMakeFiles/libgit2_clar.dir/tests/blame/harder.c.o
/tmp/libgit2-0.20.0/tests/blame/harder.c: In function 'test_blame_harder__m':
/tmp/libgit2-0.20.0/tests/blame/harder.c:37:20: warning: variable 'opts' set but not used [-Wunused-but-set-variable]
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
^
/tmp/libgit2-0.20.0/tests/blame/harder.c: In function 'test_blame_harder__c':
/tmp/libgit2-0.20.0/tests/blame/harder.c:45:20: warning: variable 'opts' set but not used [-Wunused-but-set-variable]
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
^
/tmp/libgit2-0.20.0/tests/blame/harder.c: In function 'test_blame_harder__cc':
/tmp/libgit2-0.20.0/tests/blame/harder.c:55:20: warning: variable 'opts' set but not used [-Wunused-but-set-variable]
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
^
/tmp/libgit2-0.20.0/tests/blame/harder.c: In function 'test_blame_harder__ccc':
/tmp/libgit2-0.20.0/tests/blame/harder.c:65:20: warning: variable 'opts' set but not used [-Wunused-but-set-variable]
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
^
[ 99%] Building C object CMakeFiles/libgit2_clar.dir/tests/blame/blame_helpers.c.o
[100%] Building C object CMakeFiles/libgit2_clar.dir/tests/blame/getters.c.o
Linking C executable libgit2_clar
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
dso_dlfcn.c:(.text+0x11): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x24): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x2f): undefined reference to `dlclose'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
dso_dlfcn.c:(.text+0x354): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x412): undefined reference to `dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
dso_dlfcn.c:(.text+0x484): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x542): undefined reference to `dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
dso_dlfcn.c:(.text+0x5a9): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x60d): undefined reference to `dlclose'
dso_dlfcn.c:(.text+0x645): undefined reference to `dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr':
dso_dlfcn.c:(.text+0x6d1): undefined reference to `dladdr'
dso_dlfcn.c:(.text+0x731): undefined reference to `dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
dso_dlfcn.c:(.text+0x792): undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
CMakeFiles/libgit2_clar.dir/build.make:9030: recipe for target 'libgit2_clar' failed
make[2]: *** [libgit2_clar] Error 1
make[1]: *** [CMakeFiles/libgit2_clar.dir/all] Error 2
CMakeFiles/Makefile2:95: recipe for target 'CMakeFiles/libgit2_clar.dir/all' failed
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
如果我错过了依赖项,有人可以告诉我吗?
谢谢
更新
我尝试将 libgit2 更新到版本 0.24.1 但仍然收到以下错误
[100%] Building C object CMakeFiles/libgit2_clar.dir/tests/blame/getters.c.o
Linking C executable libgit2_clar
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
dso_dlfcn.c:(.text+0x11): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x24): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x2f): undefined reference to `dlclose'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
dso_dlfcn.c:(.text+0x354): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x412): undefined reference to `dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
dso_dlfcn.c:(.text+0x484): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x542): undefined reference to `dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
dso_dlfcn.c:(.text+0x5a9): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x60d): undefined reference to `dlclose'
dso_dlfcn.c:(.text+0x645): undefined reference to `dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr':
dso_dlfcn.c:(.text+0x6d1): undefined reference to `dladdr'
dso_dlfcn.c:(.text+0x731): undefined reference to `dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
dso_dlfcn.c:(.text+0x792): undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
CMakeFiles/libgit2_clar.dir/build.make:11874: recipe for target 'libgit2_clar' failed
make[2]: *** [libgit2_clar] Error 1
CMakeFiles/Makefile2:95: recipe for target 'CMakeFiles/libgit2_clar.dir/all' failed
Makefile:127: recipe for target 'all' failed
make[1]: *** [CMakeFiles/libgit2_clar.dir/all] Error 2
make: *** [all] Error 2