Open egon010 opened 14 years ago
What version of g++ are you using (g++ --version)? The _sync* support is only in newer gcc versions (4.2+ or 4.3+)? We develop on an older 10.4.x box that defaults to 4.0.x so have to install gcc43 from Fink. The configure script does some detection for the "g++-4" binary to support this but that may not be portable to other systems. The compiler detection code is in setup/m4/mo-compiler.m4 in case you need to change what binaries are searched for.
I should add that OS X also has its own atomics support but coming up with a good multi-platform atomics library is somewhat non-trivial. Since we are building all of our code with gcc we just use their _sync* support for now. Eventually Monarch will move to the newer c++ standard atomics when they are more widely supported.
Ok, looks like there will be some work necessary to support some possibilities on OSX, but was able to get through the compile, now to the linker problem:
Linking dist/lib/libmort.dylib... Undefined symbols: "_sync_sub_and_fetch4", referenced from: monarch::rt::Collectablemonarch::rt::DynamicObjectImpl::release(monarch::rt::Collectablemonarch::rt::DynamicObjectImpl::Reference volatile) in DynamicObject-macos.o monarch::rt::Collectablemonarch::rt::DynamicObjectIteratorImpl::release(monarch::rt::Collectablemonarch::rt::DynamicObjectIteratorImpl::Reference volatile) in DynamicObjectIterator-macos.o monarch::rt::Collectablemonarch::rt::Exception::release(monarch::rt::Collectablemonarch::rt::Exception::Reference volatile) in Exception-macos.o monarch::rt::Collectablemonarch::rt::Runnable::release(monarch::rt::Collectablemonarch::rt::Runnable::Reference volatile) in JobDispatcher-macos.o monarch::rt::Collectablemonarch::rt::Runnable::release(monarch::rt::Collectablemonarch::rt::Runnable::Reference volatile) in PooledThread-macos.o monarch::rt::Collectablemonarch::rt::Exception::release(monarch::rt::Collectablemonarch::rt::Exception::Reference volatile) in Thread-macos.o monarch::rt::Collectablemonarch::rt::Runnable::release(monarch::rt::Collectablemonarch::rt::Runnable::Reference volatile*) in Thread-macos.o "sync_bool_compare_and_swap_1", referenced from: monarch::rt::HazardPtrList::acquire() in HazardPtrList-macos.o "___sync_bool_compare_and_swap_4", referenced from: monarch::rt::HazardPtrList::acquire() in HazardPtrList-macos.o ld: symbol(s) not found
_sync calls are GCC compiler intrinsics so these symbol errors should not happen. What version of g++ are you using? I'll look into adding some preprocessor support to make _sync failures due to compiler version issues more obvious.
Ok, looks like there will be some work necessary to support some possibilities on OSX, but was able to get through the compile, now to the linker problem:
Linking dist/lib/libmort.dylib... Undefined symbols: "_sync_sub_and_fetch4", referenced from: monarch::rt::Collectablemonarch::rt::DynamicObjectImpl::release(monarch::rt::Collectablemonarch::rt::DynamicObjectImpl::Reference volatile) in DynamicObject-macos.o monarch::rt::Collectablemonarch::rt::DynamicObjectIteratorImpl::release(monarch::rt::Collectablemonarch::rt::DynamicObjectIteratorImpl::Reference volatile) in DynamicObjectIterator-macos.o monarch::rt::Collectablemonarch::rt::Exception::release(monarch::rt::Collectablemonarch::rt::Exception::Reference volatile) in Exception-macos.o monarch::rt::Collectablemonarch::rt::Runnable::release(monarch::rt::Collectablemonarch::rt::Runnable::Reference volatile) in JobDispatcher-macos.o monarch::rt::Collectablemonarch::rt::Runnable::release(monarch::rt::Collectablemonarch::rt::Runnable::Reference volatile) in PooledThread-macos.o monarch::rt::Collectablemonarch::rt::Exception::release(monarch::rt::Collectablemonarch::rt::Exception::Reference volatile) in Thread-macos.o monarch::rt::Collectablemonarch::rt::Runnable::release(monarch::rt::Collectablemonarch::rt::Runnable::Reference volatile*) in Thread-macos.o "sync_bool_compare_and_swap_1", referenced from: monarch::rt::HazardPtrList::acquire() in HazardPtrList-macos.o "___sync_bool_compare_and_swap_4", referenced from: monarch::rt::HazardPtrList::acquire() in HazardPtrList-macos.o ld: symbol(s) not found
@egon010 I know it is an archaic thread, but was a solution found? (You did pass -latomic
ldflag, right?)
Us "maintainers" haven't touched code in this repository in over a decade. Is anyone still using this project? I'd be curious to hear if it built and worked on any modern platform.
Us "maintainers" haven't touched code in this repository in over a decade. Is anyone still using this project? I'd be curious to hear if it built and worked on any modern platform.
@davidlehn Well, I got a similar error when trying to fix libomp
for PPC. I was able to fix the build, but linking fails with those undefined atomics (despite libatomic being linked). So I was looking for a solution.
P. S. If monarch
exists in Macports, I can try building it.
First error: __sync_bool_compare_and_swap' was not declared in this scope
monarch/dist/include/monarch/rt/Atomic.h: In static member function 'static bool monarch::rt::Atomic::compareAndSwap(volatile T*, T, T) [with T = bool]': monarch/cpp/rt/HazardPtrList.cpp:36: instantiated from here monarch/dist/include/monarch/rt/Atomic.h:137: error: '__sync_bool_compare_and_swap' was not declared in this scope
Still looking to see if I can find the cause.