{"thread":{"id":"36124","subject":"[PATCH] configure.ac: link with -liconv for locale_charset()","startedAt":"2014-03-11T18:35:29Z","lastAt":"2014-03-20T21:12:48Z","messageCount":6,"participants":["Dmitry Marakasov","Junio C Hamano","Дилян Палаузов"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"236518","messageId":"20140311183529.GA73693@hades.panopticon","threadId":"36124","inReplyTo":null,"subject":"[PATCH] configure.ac: link with -liconv for locale_charset()","fromName":"Dmitry Marakasov","fromEmail":"amdmi3@amdmi3.ru","sentAt":"2014-03-11T18:35:29Z","receivedAt":"2014-03-11T18:35:29Z","isPatch":true,"sender":{"key":"amdmi3@amdmi3.ru","avatar":"https://avatars.githubusercontent.com/u/474217?v=4"},"body":"On e.g. FreeBSD 10.x, the following situation is common:\n- there's iconv implementation in libc, which has no locale_charset()\n  function\n- there's GNU libiconv installed from Ports Collection\n\nGit build process\n- detects that iconv is in libc and thus -liconv is not needed for it\n- detects locale_charset in -liconv, but for some reason doesn't add it\n  to CHARSET_LIB (as it would do with -lcharset if locale_charset() was\n  found there instead of -liconv)\n- git doesn't build due to unresolved external locale_charset()\n\nFix this by adding -liconv to CHARSET_LIB if locale_charset() is\ndetected in this library.\n\nSigned-off-by: Dmitry Marakasov <amdmi3@amdmi3.ru>\n---\n configure.ac | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git configure.ac configure.ac\nindex 2f43393..3f5c644 100644\n--- configure.ac\n+++ configure.ac\n@@ -890,7 +890,7 @@ GIT_CONF_SUBST([HAVE_STRINGS_H])\n # and libcharset does\n CHARSET_LIB=\n AC_CHECK_LIB([iconv], [locale_charset],\n-       [],\n+       [CHARSET_LIB=-liconv],\n        [AC_CHECK_LIB([charset], [locale_charset],\n                      [CHARSET_LIB=-lcharset])])\n GIT_CONF_SUBST([CHARSET_LIB])\n-- \n1.9.0\n"},{"id":"236534","messageId":"xmqqsiqoo4ma.fsf@gitster.dls.corp.google.com","threadId":"36124","inReplyTo":"20140311183529.GA73693@hades.panopticon","subject":"Re: [PATCH] configure.ac: link with -liconv for locale_charset()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-03-11T20:35:41Z","receivedAt":"2014-03-11T20:35:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dmitry Marakasov <amdmi3@amdmi3.ru> writes:\n\n> On e.g. FreeBSD 10.x, the following situation is common:\n> - there's iconv implementation in libc, which has no locale_charset()\n>   function\n> - there's GNU libiconv installed from Ports Collection\n>\n> Git build process\n> - detects that iconv is in libc and thus -liconv is not needed for it\n> - detects locale_charset in -liconv, but for some reason doesn't add it\n>   to CHARSET_LIB (as it would do with -lcharset if locale_charset() was\n>   found there instead of -liconv)\n> - git doesn't build due to unresolved external locale_charset()\n>\n> Fix this by adding -liconv to CHARSET_LIB if locale_charset() is\n> detected in this library.\n>\n> Signed-off-by: Dmitry Marakasov <amdmi3@amdmi3.ru>\n> ---\n\nLooks sensible; Dilyan, any comments?\n\n>  configure.ac | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git configure.ac configure.ac\n> index 2f43393..3f5c644 100644\n> --- configure.ac\n> +++ configure.ac\n> @@ -890,7 +890,7 @@ GIT_CONF_SUBST([HAVE_STRINGS_H])\n>  # and libcharset does\n>  CHARSET_LIB=\n>  AC_CHECK_LIB([iconv], [locale_charset],\n> -       [],\n> +       [CHARSET_LIB=-liconv],\n>         [AC_CHECK_LIB([charset], [locale_charset],\n>                       [CHARSET_LIB=-lcharset])])\n>  GIT_CONF_SUBST([CHARSET_LIB])\n"},{"id":"236549","messageId":"531F902D.4050102@aegee.org","threadId":"36124","inReplyTo":"xmqqsiqoo4ma.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] configure.ac: link with -liconv for locale_charset()","fromName":"Дилян Палаузов","fromEmail":"dilyan.palauzov@aegee.org","sentAt":"2014-03-11T22:37:33Z","receivedAt":"2014-03-11T22:37:33Z","isPatch":true,"sender":{"key":"dilyan.palauzov@aegee.org","avatar":null},"body":"Hello,\n\nthis changes effectively the meaning of CHARSET_LIB to \nalways/unconditionally contain the library with the charset_locale () \nfunction.  The snippet at the end of the email updates the description \nin /Makefile .\n\nHowever, I checked now how gnulib deals with locale_charset ().  Contary \nto my expectation, where gnulib builds only functions if they are not \nfound in libraries on the target system, gnulib module localcharset \nbuilds unconditionally from source the function locale_charset ().  I \nguess they do this in a portable way, but still.\n\nMy preference is to agree on universal approach for finding this \nfunction, something like:\n   OK, if found in libiconv, else\n   OK, if found in libcharset, else\n   OK, here are the sources, build the function from them, and don't \nlook for it in (shared) libaries\n\nI asked at bug-gnulib@ why they build locale_charset() before checking \nfor it in libiconv / libcharset.  My posting shall appear at \nhttp://lists.gnu.org/archive/html/bug-gnulib/2014-03/index.html .  Let's \nsee what the answer will be.\n\nI don't know if in the git codebase generally is refused to use gnulib \ncode, but if you agree on the above procedure with 3xOK, then \nlocale_charset() will be available even on systems, that don't have this \nfunction in libcharset or libiconv.... Maybe /compat/poll/poll.[ch] in \ngit-core from gnulib had similar history.\n\nKind regards\n   Дилян\n\n\nOn 11.03.2014 21:35, Junio C Hamano wrote:\n> Dmitry Marakasov <amdmi3@amdmi3.ru> writes:\n>\n>> On e.g. FreeBSD 10.x, the following situation is common:\n>> - there's iconv implementation in libc, which has no locale_charset()\n>>    function\n>> - there's GNU libiconv installed from Ports Collection\n>>\n>> Git build process\n>> - detects that iconv is in libc and thus -liconv is not needed for it\n>> - detects locale_charset in -liconv, but for some reason doesn't add it\n>>    to CHARSET_LIB (as it would do with -lcharset if locale_charset() was\n>>    found there instead of -liconv)\n>> - git doesn't build due to unresolved external locale_charset()\n>>\n>> Fix this by adding -liconv to CHARSET_LIB if locale_charset() is\n>> detected in this library.\n>>\n>> Signed-off-by: Dmitry Marakasov <amdmi3@amdmi3.ru>\n>> ---\n>\n> Looks sensible; Dilyan, any comments?\n>\n>>   configure.ac | 2 +-\n>>   1 file changed, 1 insertion(+), 1 deletion(-)\n>>\n>> diff --git configure.ac configure.ac\n>> index 2f43393..3f5c644 100644\n>> --- configure.ac\n>> +++ configure.ac\n>> @@ -890,7 +890,7 @@ GIT_CONF_SUBST([HAVE_STRINGS_H])\n>>   # and libcharset does\n>>   CHARSET_LIB=\n>>   AC_CHECK_LIB([iconv], [locale_charset],\n>> -       [],\n>> +       [CHARSET_LIB=-liconv],\n>>          [AC_CHECK_LIB([charset], [locale_charset],\n>>                        [CHARSET_LIB=-lcharset])])\n>>   GIT_CONF_SUBST([CHARSET_LIB])\n\n\n----------\ndiff --git a/Makefile b/Makefile\nindex dddaf4f..dce4694 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -59,9 +59,9 @@ all::\n  # FreeBSD can use either, but MinGW and some others need to use\n  # libcharset.h's locale_charset() instead.\n  #\n-# Define CHARSET_LIB to you need to link with library other than -liconv to\n+# Define CHARSET_LIB to the library you need to link with in order to\n  # use locale_charset() function.  On some platforms this needs to set to\n-# -lcharset\n+# -lcharset, on others to -liconv .\n  #\n  # Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't\n  # need -lintl when linking.\n"},{"id":"236547","messageId":"20140311223942.GD11801@hades.panopticon","threadId":"36124","inReplyTo":"xmqqsiqoo4ma.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] configure.ac: link with -liconv for locale_charset()","fromName":"Dmitry Marakasov","fromEmail":"amdmi3@amdmi3.ru","sentAt":"2014-03-11T22:39:42Z","receivedAt":"2014-03-11T22:39:42Z","isPatch":true,"sender":{"key":"amdmi3@amdmi3.ru","avatar":"https://avatars.githubusercontent.com/u/474217?v=4"},"body":"* Junio C Hamano (gitster@pobox.com) wrote:\n\n> > On e.g. FreeBSD 10.x, the following situation is common:\n> > - there's iconv implementation in libc, which has no locale_charset()\n> >   function\n> > - there's GNU libiconv installed from Ports Collection\n> >\n> > Git build process\n> > - detects that iconv is in libc and thus -liconv is not needed for it\n> > - detects locale_charset in -liconv, but for some reason doesn't add it\n> >   to CHARSET_LIB (as it would do with -lcharset if locale_charset() was\n> >   found there instead of -liconv)\n> > - git doesn't build due to unresolved external locale_charset()\n> >\n> > Fix this by adding -liconv to CHARSET_LIB if locale_charset() is\n> > detected in this library.\n> >\n> > Signed-off-by: Dmitry Marakasov <amdmi3@amdmi3.ru>\n> > ---\n> \n> Looks sensible; Dilyan, any comments?\n\nAddendum: build logs before and after the fix:\n\nhttp://people.freebsd.org/~amdmi3/git-iconv-fail.log\nhttp://people.freebsd.org/~amdmi3/git-iconv-fixed.log\n\n-- \nDmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D\namdmi3@amdmi3.ru  ..:  jabber: amdmi3@jabber.ru    http://www.amdmi3.ru\n"},{"id":"236554","messageId":"20140312005702.GA81282@hades.panopticon","threadId":"36124","inReplyTo":"xmqqsiqoo4ma.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] configure.ac: link with -liconv for locale_charset()","fromName":"Dmitry Marakasov","fromEmail":"amdmi3@amdmi3.ru","sentAt":"2014-03-12T00:57:02Z","receivedAt":"2014-03-12T00:57:02Z","isPatch":true,"sender":{"key":"amdmi3@amdmi3.ru","avatar":"https://avatars.githubusercontent.com/u/474217?v=4"},"body":"* Junio C Hamano (gitster@pobox.com) wrote:\n\n> Looks sensible; Dilyan, any comments?\n\nAnother addendum, comment from Tijl Coosemans <tijl@FreeBSD.org> who\njust fixed this problem in FreeBSD ports (differently):\n\n---\nPlease let upstream know they should either use iconv from libc +\nnl_langinfo from libc, or iconv from libiconv + locale_charset from\nlibiconv, but not mix the two.  Actually they could just always use\nnl_langinfo when it's available because locale_charset is not much\nmore than an alias for it.\n---\n\nThe fix used in ports was to just disable check for libcharset.h:\n\nhttp://www.freebsd.org/cgi/query-pr.cgi?pr=187326#reply3\n\n-- \nDmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D\namdmi3@amdmi3.ru  ..:  jabber: amdmi3@jabber.ru    http://www.amdmi3.ru\n"},{"id":"237207","messageId":"xmqqzjkkwp4f.fsf@gitster.dls.corp.google.com","threadId":"36124","inReplyTo":"531F902D.4050102@aegee.org","subject":"Re: [PATCH] configure.ac: link with -liconv for locale_charset()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-03-20T21:12:48Z","receivedAt":"2014-03-20T21:12:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Дилян Палаузов  <dilyan.palauzov@aegee.org> writes:\n\n> diff --git a/Makefile b/Makefile\n> index dddaf4f..dce4694 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -59,9 +59,9 @@ all::\n>  # FreeBSD can use either, but MinGW and some others need to use\n>  # libcharset.h's locale_charset() instead.\n>  #\n> -# Define CHARSET_LIB to you need to link with library other than -liconv to\n> +# Define CHARSET_LIB to the library you need to link with in order to\n>  # use locale_charset() function.  On some platforms this needs to set to\n> -# -lcharset\n> +# -lcharset, on others to -liconv .\n>  #\n>  # Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't\n>  # need -lintl when linking.\n\nThis was unfortunately lost in the noise and I missed it.  I think\nthe updated text is much more clear than the original.\n\nThanks.\n"}]}