On Tue, Mar 24, 2015 at 03:15:38PM +0800, Ri-Ping YU <[email protected]>
wrote:
> Hi, everyone
> I'm trying to adopt Libev in my project. But one error occured while
> cross-compiling, Log is below
>
> ev.c:1314:3: error: #error "memory fences not defined for your
> architecture, please report"
That means that for your architecture, ecb.h (which is inside ev.c) could not
detect proper memory fences.
There are multiple ways around it:
a) the best thing (for us) would be to add support for your architecture.
to do this, search for code like this in ev.c:
#elif __amd64 || __amd64__ || __x86_64 || __x86_64__
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : :
: "memory")
#define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : :
: "memory")
#define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("")
copy the section and define appropriate fence instructions and a proper
preprocessor test. if you then send it to us, the next person will not
even run into this issue :)
we'd of course provide assistance with this as well.
b) upgrading to a newer version of gcc (or clang) will also do the trick, e.g.
gcc 4.4
and newer has support for memory fences out of the box.
c) if your target architecture is single-cpu/core, you can define
ECB_NO_SMP while compiling libev (e.g. via CPPFLAGS), and you will
never need memory fences.
d) if you never use libev in multithreaded code, but only ever from one
thread within a process, you can define ECB_NO_THREADS while compiling
libev, and you will never need memory fences.
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / [email protected]
-=====/_/_//_/\_,_/ /_/\_\
_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev