git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Facing error in git-imap-send while compiling Git

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 21, 2020, 21:09 UTC
Message-ID
<nycvar.QRO.7.76.6.2001212144560.46@tvgsbejvaqbjf.bet>
In-Reply-To
<CAFFaXsxLd8duDPTE1H-zJiYnTVSB3pHCfBV+08Y4jLvCWR9kNw@mail.gmail.com>
Hi,
On Tue, 21 Jan 2020, Nirmal Khedkar wrote:
Show 78 quoted lines
> On Tue, Jan 21, 2020 at 3:05 AM Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> >
> > On Tue, 21 Jan 2020, Nirmal Khedkar wrote:
> >
> > > On Fri, Jan 17, 2020 at 7:05 PM Johannes Schindelin
> > > <Johannes.Schindelin@gmx.de> wrote:
> > > >
> > > > On Fri, 17 Jan 2020, Nirmal Khedkar wrote:
> > > >
> > > > > On Fri, Jan 17, 2020 at 4:21 AM Junio C Hamano <gitster@pobox.com> wrote:
> > > > > >
> > > > > > Perhaps the thread
> > > > > >
> > > > > >   https://lore.kernel.org/git/xmqqpnfv3tq4.fsf@gitster-ct.c.googlers.com
> > > > > >
> > > > > > may help?
> > > > >
> > > > > It did, to the extent that I now know why I'm facing these errors out
> > > > > of the blue.
> > > > >
> > > > > I'm  not quite sure as to what am I supposed to do right now, should I
> > > > > wait for Liam's patch to be merged,  or should I implement his fixes
> > > > > locally or should I just downgrade my openssl?
> > > > >
> > > > > Liam's PR (#516 on GitGitGadget [1]) haven't yet passed all build
> > > > > checks and I guess its still a work in progress. Nevertheless I've
> > > > > tried implementing his fixes to imap-send.c, and the make still fails.
> > > > > Am I missing something here?
> > > >
> > > > Speaking for myself, I am still waiting for
> > > > https://public-inbox.org/git/xmqqpnfv3tq4.fsf@gitster-ct.c.googlers.com/
> > > > to be addressed adequately. I think this is the main blocker.
> > > >
> > > > You could be that person who addresses this, as already 10 days went past
> > > > without even so much as an acknowledgement of Junio's suggestion. Maybe
> > > > you can make it work, and submit a fixed patch (You could take authorship
> > > > and add a footer "Original-patch-by: Liam Huang <liamhuang0205@gmail.com>"
> > > > because it is most likely a total rewrite of Liam's patch).
> > > >
> > > > Ciao,
> > > > Johannes
> > >
> > > The OpenSSL version on my system is 1.1.1. I've tried implementing
> > > Junio's suggestions, and it just doesn't work.
> >
> > Does the code otherwise compile cleanly with `make DEVELOPER=1`?
> >
> > > It gives me the same
> > > error as it gave me earlier.
> > >
> >
> > Those are linker errors, meaning that the symbols were not found in the
> > libraries.
> >
> > If you build with `make V=1 DEVELOPER=1` you should see that
> > `git-imap-send` links in OpenSSL via -lssl (and/or -lcrypto). Is this the
> > case for you?
>
> Doing "echo DEVELOPER=1 >config.mak" does not help in any way. I get
> the same errors. Here's my diff, in case I have been making mistakes
> all along.
>
>
> ---
> diff --git a/imap-send.c b/imap-send.c
> index 6c54d8c29d..73ed3bc287 100644
> --- a/imap-send.c
> +++ b/imap-send.c
> @@ -42,6 +42,12 @@ typedef void *SSL;
>  #define USE_CURL_DEFAULT 0
>  #endif
>
> +#if OPENSSL_VERSION_NUMBER < 0x10100000L
> +    #define OPENSSL_sk_num(x) sk_GENERAL_NAME_num(x)
> +    #define OPENSSL_sk_value(x,y) sk_GENERAL_NAME_value((x),(y))
> +    #define OPENSSL_sk_pop_free(x,y) sk_GENERAL_NAME_pop_free((x),(y))
> +#endif
That looks sensible.
Show 15 quoted lines
> +
>  static int verbosity;
>  static int use_curl = USE_CURL_DEFAULT;
>
> @@ -59,6 +65,8 @@ static struct option imap_send_options[] = {
>  #define DRV_BOX_BAD     -2
>  #define DRV_STORE_BAD   -3
> ---
>
> From my limited knowledge of OpenSSL libraries, I think the error has
> more to do with 'SSL_library_init()' , which appears like a
> constructor to the OpenSSL library. I found these emails regarding
> "if" cases around this function. Please check out these patches:
> 1. Rosen Penev:
> https://lore.kernel.org/git/20181227023548.396-1-rosenp@gmail.com/

I remember that one. And I agreed with Junio that the documentation suggests that the call is _optional_, while the patch suggests that it would be _incorrect_ instead.

And looking at https://www.openssl.org/docs/man1.1.1/man3/SSL_library_init.html suggests to me that it is still supported.

Having said that, if I look at the headers installed for `libssl-dev` version `1.1.1-1ubuntu2.1~18.04.5` in my Ubuntu installation, I see that `/usr/include/openssl/ssl.h` defines that symbol as:

	#  define SSL_library_init() OPENSSL_init_ssl(0, NULL)
but _only_:
	# if OPENSSL_API_COMPAT < 0x10100000L

So maybe that disagrees with the documentation that says that SSL_library_init() is optional?

The curious thing is that `OPENSSL_API_COMPAT` is not even defined anywhere. So maybe it _is_ the right thing to also `#define SSL_library_init() (void)` in the diff you listed above?

_Maybe_ guarded within `#ifndef SSL_library_init ... #endif` guards?
> 2. eroen: https://lore.kernel.org/git/20170112104219.563497-1-git-scm@occam.eroen.eu/
That sounds like a good suggestion, too.
> Are the fixes made in these patches relevant here. Please let me know
> if I'm going wrong.

Yes, both threads are relevant, and if you can reconcile them into a patch that makes Git compile with OpenSSL v1.1.1, I will try my best to review them (Cc: me, just in case).

Ciao, Johannes

Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 14 in “Facing error in git-imap-send while compiling Git”
  1. Nirmal KhedkarJan 16, 2020
  2. Junio C HamanoJan 16, 2020
  3. Nirmal KhedkarJan 17, 2020
  4. Johannes SchindelinJan 17, 2020
  5. Nirmal KhedkarJan 20, 2020
  6. Johannes SchindelinJan 20, 2020
  7. Nirmal KhedkarJan 21, 2020
  8. Junio C HamanoJan 21, 2020
  9. Johannes SchindelinJan 21, 2020
  10. Junio C HamanoJan 22, 2020
  11. Nirmal KhedkarJan 30, 2020
  12. Beat BolliJan 30, 2020
  13. Johannes SchindelinFeb 1, 2020
  14. Nirmal KhedkarFeb 15, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.