Archive Index This month's Index

Subject: Multilib issue with c-ares

Multilib issue with c-ares

From: Markus Rothe <>
Date: Mon, 26 Aug 2013 16:43:29 +0200


I have a problem using c-ares in a multilib environment, for which I
found a patch in Fedora that does not seem to have found its way
upstream. The following minimal code demonstrates the problem:

    % cat this.c
    #include <ares.h>
    int main() { return 0; }
    % x86_64-pc-linux-gnu-gcc -o this -m32 this.c
    In file included from /usr/include/ares.h:23:0,
                     from this.c:2:
    /usr/include/ares_rules.h:100:3: error: size of array ‘__cares_rule_01__’ is negative

I.e. using an x86_64 compiler in 32bit mode.

The problem is in ares_build.h and solved by applying this patch (taken
from [1]):

    diff -up c-ares-1.10.0/ c-ares-1.10.0/
    --- c-ares-1.10.0/ 2013-05-13 11:40:22.697814087 +0200
    +++ c-ares-1.10.0/ 2013-05-13 11:40:26.236813966 +0200
    @@ -96,7 +96,14 @@

     /* The size of `long', as computed by sizeof. */
    +#include <bits/wordsize.h>
    +#if __WORDSIZE == 32
    +#define CARES_SIZEOF_LONG 4
    +#elif __WORDSIZE == 64
    +#define CARES_SIZEOF_LONG 8
    +#error "Unknown word size"

     /* Integral data type used for ares_socklen_t. */
    diff -up c-ares-1.10.0/ c-ares-1.10.0/
    --- c-ares-1.10.0/ 2013-05-13 11:41:00.480812797 +0200
    +++ c-ares-1.10.0/ 2013-05-13 11:41:17.210812226 +0200
    @@ -457,7 +457,6 @@ AC_CHECK_SIZEOF(size_t)

     AC_CHECK_TYPE(long long,

I don't know if this is the correct/prefered solution for the problem,
but it solves the problem for me.

Please consider applying this or a similar patch.

Thank you.


Received on 2013-08-26