git中的编译错误:imap-send.o:在函数`verify_hostname'
为了准备升级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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,在我设定
汇编之后,成功了。
完整的编译命令是:
通常使用
- with-openssl
应该可以使用,但是根据- with-openssl
选项的注释,它在配置中,它看起来在/foo/bar/包括和/foo/bar/ lib 目录。根据
-libdir
openssl的install.md中的选项,默认情况下,这是 lib 。某些构建目标在构建配置中具有多利布后缀集。
我猜并确认,在编译OpenSSL时,-libdir选项的值已将其更改为 lib64 ,因此导致Lib库使用 - with-openssl时未读取,我可能已经找到了一种更典型的方式:
完整的编译命令是:
通过使用编译参数' - with-lib'设置lib目录名称,我成功地指定了OpenSSL的LIB目录位置。
我建议更多使用此方法
Well, after I set
the compilation was successful.
The full compile command is:
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-opensslI may have found a more canonical way:
The full compile command is:
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
上面的答案都没有。
如果您已经安装了使用自定义前缀的OpenSSL(默认的
前缀为
/usr/local )然后您需要更改命令以反映这一点。假设您使用
安装了它 - 前缀=/opt
。然后,我的解决方案将被编码为希望这对某人有帮助。
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
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 asHope this helps someone.