git中的编译错误:imap-send.o:在函数`verify_hostname'

发布于 2025-02-12 20:18:09 字数 1266 浏览 1 评论 0原文

为了准备升级Gitlab-EE,我想升级到最新版本2.37.0, 编译源代码时的错误:

    LINK git-imap-send
imap-send.o: In function `verify_hostname':
/opt/tmp/git-2.37.0/imap-send.c:242: undefined reference to `OPENSSL_sk_num'
/opt/tmp/git-2.37.0/imap-send.c:244: undefined reference to `OPENSSL_sk_value'
/opt/tmp/git-2.37.0/imap-send.c:250: undefined reference to `OPENSSL_sk_pop_free'
/opt/tmp/git-2.37.0/imap-send.c:250: undefined reference to `OPENSSL_sk_pop_free'
imap-send.o: In function `ssl_socket_connect':
/opt/tmp/git-2.37.0/imap-send.c:277: undefined reference to `OPENSSL_init_ssl'
/opt/tmp/git-2.37.0/imap-send.c:278: undefined reference to `OPENSSL_init_ssl'
/opt/tmp/git-2.37.0/imap-send.c:280: undefined reference to `TLS_method'
/opt/tmp/git-2.37.0/imap-send.c:335: undefined reference to `SSL_get1_peer_certificate'
/opt/tmp/git-2.37.0/imap-send.c:293: undefined reference to `SSL_CTX_set_options'
collect2: error: ld returned 1 exit status
make: *** [git-imap-send] Error 1

我在一段时间前将OpensSL升级到3.0.3,

# openssl version 
OpenSSL 3.0.3 3 May 2022 (Library: OpenSSL 3.0.3 3 May 2022)

并且安装目录为'/usr/local/bin/openssl',将动态库添加到/etc/ld.so.conf.d/openssl3。 conf

我该怎么做才能使git正确编译?

In preparation for upgrading gitlab-ee, I want to upgrade git to the latest version 2.37.0,
Error when compiling source code:

    LINK git-imap-send
imap-send.o: In function `verify_hostname':
/opt/tmp/git-2.37.0/imap-send.c:242: undefined reference to `OPENSSL_sk_num'
/opt/tmp/git-2.37.0/imap-send.c:244: undefined reference to `OPENSSL_sk_value'
/opt/tmp/git-2.37.0/imap-send.c:250: undefined reference to `OPENSSL_sk_pop_free'
/opt/tmp/git-2.37.0/imap-send.c:250: undefined reference to `OPENSSL_sk_pop_free'
imap-send.o: In function `ssl_socket_connect':
/opt/tmp/git-2.37.0/imap-send.c:277: undefined reference to `OPENSSL_init_ssl'
/opt/tmp/git-2.37.0/imap-send.c:278: undefined reference to `OPENSSL_init_ssl'
/opt/tmp/git-2.37.0/imap-send.c:280: undefined reference to `TLS_method'
/opt/tmp/git-2.37.0/imap-send.c:335: undefined reference to `SSL_get1_peer_certificate'
/opt/tmp/git-2.37.0/imap-send.c:293: undefined reference to `SSL_CTX_set_options'
collect2: error: ld returned 1 exit status
make: *** [git-imap-send] Error 1

I upgraded openssl to 3.0.3 some time ago

# openssl version 
OpenSSL 3.0.3 3 May 2022 (Library: OpenSSL 3.0.3 3 May 2022)

and the installation directory is '/usr/local/bin/openssl', add the dynamic library to /etc/ld.so.conf.d/openssl3.conf

What should I do to get git to compile correctly?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不弃不离 2025-02-19 20:18:09

好吧,在我设定

export LDFLAGS=-L/usr/local/lib64/

汇编之后,成功了。

完整的编译命令是:

export LDFLAGS=-L/usr/local/lib64/
./configure
make 
make install

通常使用- with-openssl应该可以使用,但是根据- with-openssl选项的注释,它在配置中,它看起来在/foo/bar/包括和/foo/bar/ lib 目录。
根据 -libdir openssl的install.md中的选项,默认情况下,这是 lib 某些构建目标在构建配置中具有多利布后缀集。我猜并确认,在编译OpenSSL时,-libdir选项的值已将其更改为 lib64 ,因此导致Lib库使用 - with-openssl时未读取,


我可能已经找到了一种更典型的方式:

完整的编译命令是:

./configure --with-openssl=/usr/local/ --with-lib=lib64
make
make install

通过使用编译参数' - with-lib'设置lib目录名称,我成功地指定了OpenSSL的LIB目录位置。

我建议更多使用此方法

Well, after I set

export LDFLAGS=-L/usr/local/lib64/

the compilation was successful.

The full compile command is:

export LDFLAGS=-L/usr/local/lib64/
./configure
make 
make install

Normally using --with-openssl should work, but according to the comments on the --with-openssl option in configure, it looks in the /foo/bar/include and /foo/bar/lib directories.
According to the explanation of the --libdir option in the INSTALL.md of openssl, By default this is lib.Some build targets have a multilib postfix set in the build configuration.I guessed and confirmed that when compiling openssl, the value of the --libdir option has been changed to lib64, so Cause the lib library is not read when using --with-openssl


I may have found a more canonical way:

The full compile command is:

./configure --with-openssl=/usr/local/ --with-lib=lib64
make
make install

By using the compile parameter '--with-lib' to set the lib directory name, I successfully specified the lib directory location of openssl.

I recommend using this method more

零度° 2025-02-19 20:18:09

上面的答案都没有。

如果您已经安装了使用自定义前缀的OpenSSL(默认的

sudo ldconfig /usr/local/lib64

前缀为/usr/local )然后您需要更改命令以反映这一点。假设您使用安装了它 - 前缀=/opt。然后,我的解决方案将被编码为

sudo ldconfig /opt/lib64

希望这对某人有帮助。

None of the answers above worked.

What did work was after installing the custom version of OpenSSL (by custom I mean not installed with APT) was to run the command

sudo ldconfig /usr/local/lib64

Now if you have installed OpenSSL with a custom prefix (the default prefix is /usr/local) then you need to change the command to reflect that. Lets say you installed it with --prefix=/opt. Then my solution would be coded as

sudo ldconfig /opt/lib64

Hope this helps someone.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文