VMKit link

Hi all,

I am trying to build VMKit on Linux/x86 and I got error messages like below,

llvm[1]: Linking Debug+Asserts executable vmjc
/root/llvm/vmkit/tools/vmjc/Debug+Asserts/vmjc.o: In function
`mvm::SpinLock::acquire()':
/root/llvm/vmkit/include/mvm/Threads/Locks.h:164: undefined reference
to `__sync_val_compare_and_swap_4'
/root/llvm/vmkit/include/mvm/Threads/Locks.h:168: undefined reference
to `__sync_val_compare_and_swap_4'
/root/llvm/vmkit/Debug+Asserts/lib/libJ3.a(JavaClass.o): In function
`j3::Class::resolveClass()':
/root/llvm/vmkit/lib/J3/VMCore/JavaClass.cpp:941: undefined reference
to `__sync_val_compare_and_swap_1'
/root/llvm/vmkit/Debug+Asserts/lib/libJ3.a(JavaObject.o): In function
`j3::JavaObject::hashCode(j3::JavaObject*)':
/root/llvm/vmkit/lib/J3/VMCore/JavaObject.cpp:59: undefined reference
to `__sync_val_compare_and_swap_4'
/root/llvm/vmkit/Debug+Asserts/lib/libClasspath.a(JavaUpcalls.o): In
function `Java_sun_misc_Unsafe_compareAndSwapInt':
/root/llvm/vmkit/lib/J3/Classpath/Classpath.inc:322: undefined
reference to `__sync_bool_compare_and_swap_4'
/root/llvm/vmkit/Debug+Asserts/lib/libClasspath.a(JavaUpcalls.o): In
function `mvm::Collector::objectReferenceTryCASBarrier(gc*, gc**, gc*,
gc*)':
/root/llvm/vmkit/lib/Mvm/GCMmap2/MvmGC.h:375: undefined reference to
`__sync_val_compare_and_swap_4'
/root/llvm/vmkit/Debug+Asserts/lib/libJ3Compiler.a(JavaJITCompiler.o):
In function `j3::JavaJ3LazyJITCompiler::addCallback(j3::Class*,
unsigned short, j3::Signdef*, bool, llvm::BasicBlock*)':
/root/llvm/vmkit/lib/J3/Compiler/JavaJITCompiler.cpp:454: undefined
reference to `__sync_val_compare_and_swap_4'
/root/llvm/vmkit/Debug+Asserts/lib/libCommonThread.a(CollectionRV.o):
In function `mvm::CooperativeCollectionRV::synchronize()':
/root/llvm/vmkit/lib/Mvm/CommonThread/CollectionRV.cpp:66: undefined
reference to `__sync_bool_compare_and_swap_1'
/root/llvm/vmkit/Debug+Asserts/lib/libCommonThread.a(ObjectLocks.o):
In function `mvm::ThinLock::removeFatLock(mvm::FatLock*,
mvm::LockSystem&)':
/root/llvm/vmkit/lib/Mvm/CommonThread/ObjectLocks.cpp:56: undefined
reference to `__sync_val_compare_and_swap_4'
/root/llvm/vmkit/Debug+Asserts/lib/libCommonThread.a(ObjectLocks.o):
In function `mvm::ThinLock::release(gc*, mvm::LockSystem&)':
/root/llvm/vmkit/lib/Mvm/CommonThread/ObjectLocks.cpp:203: undefined
reference to `__sync_val_compare_and_swap_4'
/root/llvm/vmkit/lib/Mvm/CommonThread/ObjectLocks.cpp:215: undefined
reference to `__sync_val_compare_and_swap_4'
/root/llvm/vmkit/Debug+Asserts/lib/libCommonThread.a(ObjectLocks.o):
In function `mvm::ThinLock::changeToFatlock(gc*, mvm::LockSystem&)':
/root/llvm/vmkit/lib/Mvm/CommonThread/ObjectLocks.cpp:76: undefined
reference to `__sync_val_compare_and_swap_4'
/root/llvm/vmkit/Debug+Asserts/lib/libCommonThread.a(ObjectLocks.o):
In function `mvm::ThinLock::overflowThinLock(gc*, mvm::LockSystem&)':
/root/llvm/vmkit/lib/Mvm/CommonThread/ObjectLocks.cpp:39: undefined
reference to `__sync_val_compare_and_swap_4'
/root/llvm/vmkit/Debug+Asserts/lib/libCommonThread.a(ObjectLocks.o):/root/llvm/vmkit/lib/Mvm/CommonThread/ObjectLocks.cpp:120:
more undefined references to `__sync_val_compare_and_swap_4' follow
/root/llvm/vmkit/Debug+Asserts/lib/libCommonThread.a(ctthread.o): In
function `mvm::thread::leaveUncooperativeCode()':
/root/llvm/vmkit/lib/Mvm/CommonThread/ctthread.cpp:273: undefined
reference to `__sync_bool_compare_and_swap_4'
/root/llvm/vmkit/Debug+Asserts/lib/libCommonThread.a(ctthread.o): In
function `mvm::thread::enterUncooperativeCode(void*)':
/root/llvm/vmkit/lib/Mvm/CommonThread/ctthread.cpp:260: undefined
reference to `__sync_bool_compare_and_swap_4'
/root/llvm/vmkit/Debug+Asserts/lib/libCommonThread.a(ctthread.o): In
function `mvm::thread::enterUncooperativeCode(unsigned int)':
/root/llvm/vmkit/lib/Mvm/CommonThread/ctthread.cpp:248: undefined
reference to `__sync_bool_compare_and_swap_4'
collect2: ld returned 1 exit status
make[1]: *** [/root/llvm/vmkit/Debug+Asserts/bin/vmjc] Error 1
make[1]: Leaving directory `/root/llvm/vmkit/tools/vmjc'
make: *** [all] Error 1

Please help.

Thank you.

Shin

Hi,

  I guess you miss "-lpthread"?

Regards,
chenwj

Hi Shen,

Also make sure your version of gcc is at least 4.2 (4.0 does not work with atomic builtins IIRC), and that you’re compiling for something at least i486 (i386 does not have the atomic builtins support).

Nicolas