[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] can libevent-devel for x86_64 and i686 coexist on a x86_64 machine?



On Tue, Nov 30, 2010 at 10:22 AM, Mr Dash Four
<mr.dash.four@xxxxxxxxxxxxxx> wrote:
>
>>> I will file a bug with Fedora because this needs to be fixed - as things
>>> stand now it won't work as event-config.h will get overwritten by
>>> whatever
>>> package was installed last which is plain wrong. Thanks for your input!
>>>
>>
>> Ok.  FWIW for Fedora (and maybe for Linux in general) you can probably
>> get away with having the /usr/include/event2/event-config.h look
>> something like:
>>
>>
>> #ifndef _EVENT2_EVENT_CONFIG_WRAPPER_H
>> #define _EVENT2_EVENT_CONFIG_WRAPPER_H
>>
>> #include <bits/wordsize.h>
>> #if __WORDSIZE == 64
>> #include <event2/event-config64.h>
>> #else
>> #include <event2/event-config32.h>
>> #endif
>>
>> #endif
>>
>> Though of course there may be better ways too.
>>
>
> This is what I think it should be (haven't tested this yet - will do that
> this evening):
>
>
> event2/event-config.h
> ~~~~~~~~~~~~~~
>
> /* This file is here to prevent a file conflict on multiarch systems.  A
> * conflict will frequently occur because arch-specific build-time
> * configuration options are stored (and used, so they can't just be stripped
> * out) in event-config.h.  The original event-config.h has been renamed.
> * DO NOT INCLUDE THE NEW FILE DIRECTLY -- ALWAYS INCLUDE THIS ONE INSTEAD.
> */
>
> #ifdef event2_eventconfig_multilib_redirection_h
> #error "Do not define event2_eventconfig_multilib_redirection_h!"
> #endif
> #define event2_eventconfig_multilib_redirection_h
>
> #if defined(__x86_64__)
> #include "event2/event-config-x86_64.h"
> #else
> #include "event2/event-config-i386.h"
> #endif
>
> #undef event2_eventconfig_multilib_redirection_h
>
> event2/event-config-x86_64.h
> ~~~~~~~~~~~~~~~~~~~~
>
> /* Prepended at libevent package build-time.  Don't include this file
> directly,
> * use <event2/event-config.h> instead. */
>
> #ifndef event2_eventconfig_multilib_redirection_h
> #error "Don't include this file directly, use <event2/event-config.h>
> instead!"
> #endif
>
> .... (the rest of the original event-config.h for x86_64 arch follows)


That's plausible; packagers should probably indeed do something like
this; I hope that the package maintainer accepts it or something likes
it.

You might also mention in the header there that the new file is
provided by the distribution, not by Libevent itself.

> I've (shamelessly) borrowed the skeleton for the above from the
> openssl-devel package. The only sticking point is with "#if
> defined(__x86_64__)" as I am not 100% certain that is 'automatically'
> defined by the preprocessor - I need to check whether that is indeed the
> case.

You can get a list of macros automatically defined by gcc with
echo "" | gcc -E -dM -x c - | sort

-- 
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.