9.0/i386 build failure

Dimitry Andric dim at FreeBSD.org
Sat Nov 5 13:19:58 UTC 2011

On 2011-11-04 20:09, Michael W. Lucas wrote:
> I suspect I'm building on a system that's too old, but it's worth
> asking.
> FreeBSD eyeball.lodden.com 9.0-CURRENT FreeBSD 9.0-CURRENT #0: Sat Aug 29 00:31:14 EDT 2009     mwlucas at stretchlimo.blackhelicopters.org:/usr/obj/usr/src/sys/GENERIC  i386
> csup today.  no /etc/src.conf, /etc/make.conf only contains a perl
> definition.
> ...
> c++ -O2 -pipe -I/usr/src/usr.bin/clang/tblgen/../../../contrib/llvm/include -I/usr/src/usr.bin/clang/tblgen/../../../contrib/llvm/tools/clang/include -I/usr/src/usr.bin/clang/tblgen/../../../contrib/llvm/utils/TableGen -I. -I/usr/src/usr.bin/clang/tblgen/../../../contrib/llvm/../../lib/clang/include -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DLLVM_HOSTTRIPLE=\"i386-unknown-freebsd9.0\" -I/usr/obj/usr/src/tmp/legacy/usr/include  -static -L/usr/obj/usr/src/tmp/legacy/usr/lib -o tblgen ARMDecoderEmitter.o AsmMatcherEmitter.o AsmWriterEmitter.o AsmWriterInst.o CallingConvEmitter.o CodeEmitterGen.o CodeGenDAGPatterns.o CodeGenInstruction.o CodeGenRegisters.o CodeGenTarget.o DAGISelEmitter.o DAGISelMatcher.o DAGISelMatcherEmitter.o DAGISelMatcherGen.o DAGISelMatcherOpt.o DisassemblerEmitter.o EDEmitter.o FastISelEmitter.o FixedLenDecoderEmitter.o InstrEnumEmitter.o InstrInfoEmitter.o IntrinsicEmitter.o PseudoLoweringEmitter.o RegisterInfoEmi
tter.o SetTheory.o StringMatcher.o SubtargetEmitter.o TGValueTypes.o TableGen.o X86DisassemblerTables.o X86RecognizableInstr.o /usr/obj/usr/src/tmp/usr/src/usr.bin/clang/tblgen/../../../lib/clang/libllvmtablegen/libllvmtablegen.a /usr/obj/usr/src/tmp/usr/src/usr.bin/clang/tblgen/../../../lib/clang/libllvmsupport/libllvmsupport.a -legacy
> /usr/obj/usr/src/tmp/usr/src/usr.bin/clang/tblgen/../../../lib/clang/libllvmsupport/libllvmsupport.a(Atomic.o)(.text+0x25): In function `llvm::sys::AtomicIncrement(unsigned int volatile*)':
> : undefined reference to `__sync_add_and_fetch_4'

Hm, the only way I can imagine this happening, is then you compile your
system with -march=i386.  In that case the atomic primitives, such as
__sync_add_and_fetch, are called as external functions, which would lead
to a link error like the above.

I tried building 9-STABLE from a 9-CURRENT box that was not updated
since April 2011, and from a fairly recent 8-STABLE, but both did not
exhibit this issue.

Are you using any special other settings, e.g. in your environment, or
on the make command line?  In case, it would be handy if you post the
full buildlog somewhere, so we can see which flags have been used to
compile the llvmsupport library.

More information about the freebsd-current mailing list