diff mbox

package/mono: fix linking options for locale_charset

Message ID 1441437891-6420-1-git-send-email-angelo.compagnucci@gmail.com
State Superseded
Headers show

Commit Message

Angelo Compagnucci Sept. 5, 2015, 7:24 a.m. UTC
* Adding a patch for proper locale_charset linking handling.
* With this patch there is no need anymore for forcing
  libiconv as dependency, mono will now check if locale
  is enabled or not and acts accordingly.

Fixes http://autobuild.buildroot.net/results/8d2cd5619ba4d9cec5c8ac7fef467f47abc18aea/ 
      http://autobuild.buildroot.net/results/a3678744ded94906961430f3a4523cf1f1b0099b/

Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
---

The patch was submitted upstream, I will care of remove it when it will included.

 ...glib-checking-for-locale_charset-function.patch | 28 ++++++++++++++++++++++
 package/mono/Config.in                             |  1 -
 2 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 package/mono/0005-eglib-checking-for-locale_charset-function.patch

Comments

Thomas Petazzoni Sept. 20, 2015, 1:23 p.m. UTC | #1
Dear Angelo Compagnucci,

On Sat,  5 Sep 2015 09:24:51 +0200, Angelo Compagnucci wrote:

> + AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h sys/resource.h)
> ++AC_CHECK_LIB([iconv], [locale_charset],[],[AC_CHECK_LIB([charset], [locale_charset],[LIBS+="-liconv -lcharset"])])

Why are you doing LIBS+="-liconv -lcharset" when locale_charset() is
found is libcharset ?

Here is what the Git configure.ac is doing for the same problem:

# Define CHARSET_LIB if libiconv does not export the locale_charset symbol
# and libcharset does
CHARSET_LIB=
AC_CHECK_LIB([iconv], [locale_charset],
       [CHARSET_LIB=-liconv],
       [AC_CHECK_LIB([charset], [locale_charset],
                     [CHARSET_LIB=-lcharset])])
GIT_CONF_SUBST([CHARSET_LIB])

> diff --git a/package/mono/Config.in b/package/mono/Config.in
> index 0f57703..cf18a03 100644
> --- a/package/mono/Config.in
> +++ b/package/mono/Config.in
> @@ -8,7 +8,6 @@ config BR2_PACKAGE_MONO
>  	depends on BR2_PACKAGE_MONO_ARCH_SUPPORTS
>  	depends on BR2_TOOLCHAIN_HAS_THREADS
>  	depends on !BR2_STATIC_LIBS
> -	select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE

What guarantees you that if libiconv is not available, then libcharset
will be? What will provide the locale_charset() function?

This really need a few more explanations.

Thanks!

Thomas
Angelo Compagnucci Sept. 21, 2015, 6:28 a.m. UTC | #2
Dear Thomas Petazzoni,

2015-09-20 15:23 GMT+02:00 Thomas Petazzoni
<thomas.petazzoni@free-electrons.com>:
> Dear Angelo Compagnucci,
>
> On Sat,  5 Sep 2015 09:24:51 +0200, Angelo Compagnucci wrote:
>
>> + AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h sys/resource.h)
>> ++AC_CHECK_LIB([iconv], [locale_charset],[],[AC_CHECK_LIB([charset], [locale_charset],[LIBS+="-liconv -lcharset"])])
>
> Why are you doing LIBS+="-liconv -lcharset" when locale_charset() is
> found is libcharset ?

Cause it segfaults at runtime if only linked with -lcharset.

> Here is what the Git configure.ac is doing for the same problem:
>
> # Define CHARSET_LIB if libiconv does not export the locale_charset symbol
> # and libcharset does
> CHARSET_LIB=
> AC_CHECK_LIB([iconv], [locale_charset],
>        [CHARSET_LIB=-liconv],
>        [AC_CHECK_LIB([charset], [locale_charset],
>                      [CHARSET_LIB=-lcharset])])
> GIT_CONF_SUBST([CHARSET_LIB])
>
>> diff --git a/package/mono/Config.in b/package/mono/Config.in
>> index 0f57703..cf18a03 100644
>> --- a/package/mono/Config.in
>> +++ b/package/mono/Config.in
>> @@ -8,7 +8,6 @@ config BR2_PACKAGE_MONO
>>       depends on BR2_PACKAGE_MONO_ARCH_SUPPORTS
>>       depends on BR2_TOOLCHAIN_HAS_THREADS
>>       depends on !BR2_STATIC_LIBS
>> -     select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
>
> What guarantees you that if libiconv is not available, then libcharset
> will be? What will provide the locale_charset() function?

Libcharest is only taken into account if libiconv is present but is not
exporting the locale_charset function.
If libiconv is not available, mono will switch to an internal library,
the appropriate logic is already present in various places in source
code.

> This really need a few more explanations.
>
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
diff mbox

Patch

diff --git a/package/mono/0005-eglib-checking-for-locale_charset-function.patch b/package/mono/0005-eglib-checking-for-locale_charset-function.patch
new file mode 100644
index 0000000..52d5638
--- /dev/null
+++ b/package/mono/0005-eglib-checking-for-locale_charset-function.patch
@@ -0,0 +1,28 @@ 
+From 026a8c44d332b3595814ce0aceba255467cd7b6d Mon Sep 17 00:00:00 2001
+From: Angelo Compagnucci <angelo.compagnucci@gmail.com>
+Date: Sat, 5 Sep 2015 08:57:21 +0200
+Subject: [PATCH] eglib: checking for locale_charset function
+
+This patch checks if locale_charset function is availabe in
+libiconv or libcharset and changes the linking options accordingly.
+
+Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
+---
+ eglib/configure.ac | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/eglib/configure.ac b/eglib/configure.ac
+index 9d094ea..5ea220e 100644
+--- a/eglib/configure.ac
++++ b/eglib/configure.ac
+@@ -182,6 +182,7 @@ fi
+ AC_SUBST(G_HAVE_ISO_VARARGS)
+ 
+ AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h sys/resource.h)
++AC_CHECK_LIB([iconv], [locale_charset],[],[AC_CHECK_LIB([charset], [locale_charset],[LIBS+="-liconv -lcharset"])])
+ AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
+ AC_SUBST(HAVE_ALLOCA_H)
+ 
+-- 
+1.9.1
+
diff --git a/package/mono/Config.in b/package/mono/Config.in
index 0f57703..cf18a03 100644
--- a/package/mono/Config.in
+++ b/package/mono/Config.in
@@ -8,7 +8,6 @@  config BR2_PACKAGE_MONO
 	depends on BR2_PACKAGE_MONO_ARCH_SUPPORTS
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on !BR2_STATIC_LIBS
-	select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
 	help
 	  An open source, cross-platform, implementation of C#
 	  and the CLR that is binary compatible with Microsoft.NET.