bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Build issues with gettext 0.20.2 and 0.21 on Solaris 10 i386 with 64


From: Bruno Haible
Subject: Re: Build issues with gettext 0.20.2 and 0.21 on Solaris 10 i386 with 64 bit
Date: Tue, 01 Dec 2020 20:46:47 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-193-generic; KDE/5.18.0; x86_64; ; )

Hi Dagobert,

> I finally found the issue: gettext after 0.20.1 uses a more recent version of 
> gnulib
> with linker ABI check located in host-cpu-c-abi.m4. This ABI check was not 
> present
> up until gettext 0.20.1 hence compilation for amd64 worked.

Yes, this ABI check is there to avoid that when linking a binary
in 64-bit mode, 32-bit mode libraries disturb the detection of what
dependencies are available, and vice versa.

> Now regarding the error in detail: the check tries to determine which ABI a 
> platform
> can run as derived from the $host_cpu value. The error lies in the assumption 
> that
> $host_cpu == i386 always implies C ABI i386, which is wrong at least for 
> Solaris x86
> where $host_cpu is always i386 for all CPU types including 64 bit.

No, what you state is wrong.

The `uname -m` value returns "i86pc" and thus does not allow to distinguish
32-bit and 64-bit builds.

But the $host_cpu value from the canonical triplet $host allows to do so.

config.guess contains logic to determine the bitness by invoking the compiler:

    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
        set_cc_for_build
        SUN_ARCH=i386
        # If there is a compiler, see if it is configured for 64-bit objects.
        # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
        # This test works for both compilers.
        if test "$CC_FOR_BUILD" != no_compiler_found; then
            if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
                (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
                grep IS_64BIT_ARCH >/dev/null
            then
                SUN_ARCH=x86_64
            fi
        fi
        echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 
's/[^.]*//')"
        exit ;;

And this code works fine. I verified this:
  - on a Solaris 10 machine:
      CC="cc -O", CC="gcc -O2"                       -> HOST_CPU="i386"
      CC="cc -xarch=generic64 -O", CC="gcc -m64 -O2" -> HOST_CPU="x86_64"
  - on a Solaris 11.4 machine:
      CC="gcc -m32 -O2" -> HOST_CPU="i386"
      CC="gcc -O2"      -> HOST_CPU="x86_64"

You must be specifying a --host triplet incorrectly in your build. Possibly
through a --host option when you run configure. Possibly through a --cache-file
that points to a file with a wrong setting.

> diff --git a/m4/host-cpu-c-abi.m4 b/m4/host-cpu-c-abi.m4
> index 6db2aa2..3e40db7 100644
> --- a/m4/host-cpu-c-abi.m4
> +++ b/m4/host-cpu-c-abi.m4
> @@ -55,12 +55,7 @@ AC_DEFUN([gl_HOST_CPU_C_ABI],
>      [case "$host_cpu" in
>               
>  changequote(,)dnl
> -       i[34567]86 )
> -changequote([,])dnl
> -         gl_cv_host_cpu_c_abi=i386
> -         ;;
> -      
> -       x86_64 )
> +       i[34567]86 | x86_64 )
>           # On x86_64 systems, the C compiler may be generating code in one of
>           # these ABIs:

This patch is not needed once the $host triplet is correct.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]