Joseph
Joseph

Reputation: 1091

libACE and clang/clang++, undefined reference to `ACE_Atomic_Op<ACE_Thread_Mutex, long>

I'm compiling an application using clang++ 3.8 , libACE 6.3.3 and including the -std=c++11

But i'm having issues with inclusion of ACE Atomic_OP

including such headers:

#include <ace/ACE.h>
#include <ace/Thread.h>
#include <ace/TSS_T.h>
#include <ace/Atomic_Op.h>

i've

../game/libgame.a(WorldSocketMgr.cpp.o): In function ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator--()': /usr/include/ace/Atomic_Op.inl:72: undefined reference to ACE_Atomic_Op::decrement_fn_' ../game/libgame.a(WorldSocketMgr.cpp.o): In function ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator++()': /usr/include/ace/Atomic_Op.inl:50: undefined reference to ACE_Atomic_Op::increment_fn_' ../game/libgame.a(WorldSession.cpp.o): In function ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator=(long)': /usr/include/ace/Atomic_Op.inl:166: undefined reference to ACE_Atomic_Op::exchange_fn_' ../game/libgame.a(WorldSession.cpp.o): In function ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-=(long)': /usr/include/ace/Atomic_Op.inl:114: undefined reference to ACE_Atomic_Op::exchange_add_fn_' clang: error: linker command failed with exit code 1 (use -v to see invocation)

How can i solve it?

UPDATE:

i've changed

ACE_Atomic_Op<ACE_Thread_Mutex, time_t> m_timeOutTime;

in

ACE_Atomic_Op<ACE_Thread_Mutex, int> m_timeOutTime;

and

ACE_Atomic_Op<ACE_Thread_Mutex, long> m_refs;

in

ACE_Atomic_Op<ACE_Thread_Mutex, int> m_refs;

it now compiles, but i'm not sure it's a safe solution.

Upvotes: 1

Views: 953

Answers (1)

user823738
user823738

Reputation: 17521

Update

This was caused by a bug in ACE prior to version 6.4.3. It is now fixed.


Original Answer:

A little late response, but I hope it may help anyone who finds this post in the future.

It looks like ACE has a bug (or just did not update their code). Unfortunately, the only solution for now is to hack ACE's files.

You need to find edit either config-linux.h or config-macosx-snowleopard.h - based on what you use. Then you find this chunk of oode and delete it:

# ifdef __clang__
#  undef ACE_HAS_GCC_ATOMIC_BUILTINS
# endif

Upvotes: 1

Related Questions