系统相关
首页 > 系统相关> > libgit2高山linux docker错误

libgit2高山linux docker错误

作者:互联网

好的,这超出了我的理解.我真的不知道这里到底有什么问题,但有什么问题.我快要撞墙了,快要摔死了,但什么都没发生.有什么好心的人可以帮我吗.

这是我的Dockerfile-

FROM golang:1.7-alpine
RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
RUN apk update && apk upgrade && apk add --no-cache bash git openssh alpine-sdk libgit2

RUN pkg-config --print-errors --exists libgit2

我已经在这里提出了建议-How do I install libgit2 on Alipne linux

这是最终结果-

Sending build context to Docker daemon   513 kB
Step 1 : FROM golang:1.7-alpine
 ---> 161e259af05d
Step 2 : RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
 ---> Running in 428c62a1fc94
 ---> 80a4e0dca9d7
Removing intermediate container 428c62a1fc94
Step 3 : RUN apk update && apk upgrade && apk add --no-cache bash git openssh alpine-sdk libgit2
 ---> Running in 7876608fa4e7
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
fetch http://dl-4.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
v3.4.4-9-g07aa589 [http://dl-cdn.alpinelinux.org/alpine/v3.4/main]
v3.4.4-1-g77d84e1 [http://dl-cdn.alpinelinux.org/alpine/v3.4/community]
v3.4.0-4072-g7fdcbdd [http://dl-4.alpinelinux.org/alpine/edge/testing]
OK: 7381 distinct packages available
(1/2) Upgrading libcrypto1.0 (1.0.2i-r0 -> 1.0.2j-r0)
(2/2) Upgrading libssl1.0 (1.0.2i-r0 -> 1.0.2j-r0)
Executing busybox-1.24.2-r11.trigger
OK: 5 MiB in 12 packages
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
fetch http://dl-4.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
(1/63) Installing fakeroot (1.20.2-r3)
(2/63) Installing sudo (1.8.16-r0)
(3/63) Installing libcap (2.25-r0)
(4/63) Installing pax-utils (1.1.6-r0)
(5/63) Installing openssl (1.0.2j-r0)
(6/63) Installing libattr (2.4.47-r4)
(7/63) Installing attr (2.4.47-r4)
(8/63) Installing tar (1.29-r0)
(9/63) Installing pkgconf (0.9.12-r0)
(10/63) Installing patch (2.7.5-r1)
(11/63) Installing libssh2 (1.7.0-r0)
(12/63) Installing libcurl (7.50.3-r0)
(13/63) Installing curl (7.50.3-r0)
(14/63) Installing abuild (2.27.1-r1)
Executing abuild-2.27.1-r1.pre-install
(15/63) Installing binutils-libs (2.26-r0)
(16/63) Installing binutils (2.26-r0)
(17/63) Installing gmp (6.1.0-r0)
(18/63) Installing isl (0.14.1-r0)
(19/63) Installing libgomp (5.3.0-r0)
(20/63) Installing libatomic (5.3.0-r0)
(21/63) Installing libgcc (5.3.0-r0)
(22/63) Installing pkgconfig (0.25-r1)
(23/63) Installing mpfr3 (3.1.2-r0)
(24/63) Installing mpc1 (1.0.3-r0)
(25/63) Installing libstdc++ (5.3.0-r0)
(26/63) Installing gcc (5.3.0-r0)
(27/63) Installing make (4.1-r1)
(28/63) Installing musl-dev (1.1.14-r12)
(29/63) Installing libc-dev (0.7-r0)
(30/63) Installing fortify-headers (0.8-r0)
(31/63) Installing g++ (5.3.0-r0)
(32/63) Installing build-base (0.4-r1)
(33/63) Installing expat (2.1.1-r1)
(34/63) Installing pcre (8.38-r1)
(35/63) Installing git (2.8.3-r0)
(36/63) Installing xz-libs (5.2.2-r1)
(37/63) Installing lzo (2.09-r1)
(38/63) Installing squashfs-tools (4.3-r2)
(39/63) Installing libmagic (5.27-r0)
(40/63) Installing file (5.27-r0)
(41/63) Installing bzip2 (1.0.6-r5)
(42/63) Installing libbz2 (1.0.6-r5)
(43/63) Installing cdrkit (1.1.11-r2)
(44/63) Installing acct (6.6.2-r0)
(45/63) Installing lddtree (1.25-r2)
(46/63) Installing libuuid (2.28-r3)
(47/63) Installing libblkid (2.28-r3)
(48/63) Installing device-mapper (2.02.154-r0)
(49/63) Installing cryptsetup-libs (1.7.1-r0)
(50/63) Installing kmod (22-r0)
(51/63) Installing mkinitfs (3.0.5-r1)
Executing mkinitfs-3.0.5-r1.post-install
(52/63) Installing mtools (4.0.18-r1)
(53/63) Installing alpine-sdk (0.4-r3)
(54/63) Installing ncurses-terminfo-base (6.0-r7)
(55/63) Installing ncurses-terminfo (6.0-r7)
(56/63) Installing ncurses-libs (6.0-r7)
(57/63) Installing readline (6.3.008-r4)
(58/63) Installing bash (4.3.42-r3)
Executing bash-4.3.42-r3.post-install
(59/63) Installing libgit2-libs (0.24.1-r0)
(60/63) Installing libgit2 (0.24.1-r0)
(61/63) Installing openssh-client (7.2_p2-r3)
(62/63) Installing openssh-sftp-server (7.2_p2-r3)
(63/63) Installing openssh (7.2_p2-r3)
Executing busybox-1.24.2-r11.trigger
Executing ca-certificates-20160104-r4.trigger
OK: 198 MiB in 75 packages
 ---> f73132c8c72e
Removing intermediate container 7876608fa4e7
Step 4 : RUN pkg-config --print-errors --exists libgit2
 ---> Running in f69f97142e81
Package libgit2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libgit2.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libgit2', required by 'world', not found
The command '/bin/sh -c pkg-config --print-errors --exists libgit2' returned a non-zero code: 1

那是什么错呢?为什么看不到已安装的libgit2(0.24.1-r0).我真的尝试了所有可能的方法来在Docker容器中构建并安装此软件包,但我不能简单地做到这一点.我不知道怎么了.请帮我.

————–编辑

我的Dockerfile中的最后一条命令实际上是从这里获取的http://lists.subsurface-divelog.org/pipermail/subsurface/2014-November/015646.html

当然,这里描述的问题和我遇到的问题是不同的

—————-编辑2

任何有兴趣自行完成工作的人都可以遵循-

FROM golang:1.7-alpine
ENV TARGET venv
RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
RUN apk update && apk upgrade && apk add --no-cache bash git openssh alpine-sdk libcurl
RUN apk update && apk add cmake
RUN git clone git://github.com/libgit2/libgit2.git
WORKDIR $GOPATH/libgit2
RUN git checkout v0.24.0 && rm -rf build && mkdir build && cd build \
    && cmake .. -DCMAKE_INSTALL_PREFIX=$TARGET -DBUILD_CLAR=OFF && cmake --build . --target install
ENV PKG_CONFIG_PATH /go/libgit2/build/venv/lib/pkgconfig:$PKG_CONFIG_PATH

对于更简单,更清洁的方法,请遵循公认的答案.这仅具有具有libgit2版本的优点,该版本尚无法通过apk获得.

还有一件事–DBUILD_CLAR = OFF因为我不想在图像中安装Python只是为了运行测试

解决方法:

您正在尝试使用libgit2编译软件包,因此需要libgit2-dev开发软件包以及标头,pc文件等.

该docker文件文件成功构建了git2go:

FROM golang:1.7-alpine
RUN apk update && apk upgrade && apk add --no-cache bash git openssh alpine-sdk libgit2-dev
RUN go get -v github.com/libgit2/git2go

标签:alpine,go,docker,libgit2,linux
来源: https://codeday.me/bug/20191118/2025403.html