gpt4 book ai didi

linux - libgit2 alpine linux docker 错误

转载 作者:IT王子 更新时间:2023-10-29 01:05:18 34 4
gpt4 key购买 nike

好的,这超出了我的理解。我真的不知道这里到底出了什么问题,但确实有问题。我的头撞在墙上,快要崩溃了,但什么也没有发生。任何善良的人都可以帮助我。

这是我的 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 编译一个包,因此您需要包含头文件、pc 文件等的 libgit2-dev 开发包。

这个 docker file 文件构建 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

关于linux - libgit2 alpine linux docker 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39982804/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com