[LLVMdev] Help with Mac OS X 10.6.2 build

Todd Rovito rovitotv at gmail.com
Sun Feb 7 01:58:58 PST 2010


Greetings,
    I am having trouble getting the Kaleidoscope example to build from
tutorial #3 on Mac OS X 10.6.2.  I didn't have too much trouble
getting llvm-2.6 and llvm-gcc-frontend to build.  Thanks for the help.
 Here are the steps I followed:

Environment variables for build
export LLVMOBJDIR=/opt/llvm
export TARGETOPTIONS='--with-arch=nocona --with-tune=generic'
export TRIPLE=i686-apple-darwin9			// I wonder should it be darwin10
export BUILDOPTIONS=LLVM_VERSION_INFO=2.6

Notes for llvm-2.6
cd ~/prog/llvm-2.6
./configure --prefix=/opt/llvm $TARGETOPTIONS --build=$TRIPLE
--host=$TRIPLE --target=$TRIPLE
# I also tried the command below neither seemed to work with example
in tutorial #3
# ./configure --prefix=/opt/llvm
make
make install

Notes for llvm-gcc frontend
Follow the instructions for Darwin/X86 (32- and 64bit support), note
the 32 bit instructions would not compile on 10.6.2:

../llvm-gcc4.2-2.6.source/configure --prefix=`pwd`/../install
--program-prefix=llvm-     --enable-llvm=$LLVMOBJDIR
--enable-languages=c,c++$EXTRALANGS $TARGETOPTIONS
--with-gxx-include-dir=/usr/include/c++/4.0.0 --build=$TRIPLE
--host=$TRIPLE --target=$TRIPLE
make $BUILDOPTIONS
make install
ln -sf /usr/lib/libstdc++.6.dylib `pwd`/../install/lib
ln -sf /usr/lib/libstdc++.6.dylib `pwd`/../install/lib/libstdc++.dylib

To build the toy program in the Tutorial I used this command:
g++ -g -O3 toy3.cpp `llvm-config --cppflags --ldflags --libs core` -o toy3

Error that I get:

Tutorial rovitotv$ g++ -g -O3 toy3.cpp `llvm-config --cppflags
--ldflags --libs core` -o toy3
ld: warning: in /opt/llvm/lib/libLLVMCore.a, file is not of required
architecture
ld: warning: in /opt/llvm/lib/libLLVMSupport.a, file is not of
required architecture
ld: warning: in /opt/llvm/lib/libLLVMSystem.a, file is not of required
architecture
Undefined symbols:
  "llvm::SymbolTableListTraits<llvm::Instruction,
llvm::BasicBlock>::addNodeToList(llvm::Instruction*)", referenced
from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      CallExprAST::Codegen()      in ccHkdHVT.o
      FunctionAST::Codegen()      in ccHkdHVT.o
      llvm::IRBuilder<true,
llvm::ConstantFolder>::InsertHelper(llvm::Instruction*, llvm::Twine
const&) constin ccHkdHVT.o
  "llvm::APFloat::APFloat(double)", referenced from:
      NumberExprAST::Codegen()      in ccHkdHVT.o
  "llvm::BasicBlock::BasicBlock(llvm::LLVMContext&, llvm::Twine
const&, llvm::Function*, llvm::BasicBlock*)", referenced from:
      FunctionAST::Codegen()      in ccHkdHVT.o
  "llvm::Module::getFunction(llvm::StringRef const&) const", referenced from:
      CallExprAST::Codegen()      in ccHkdHVT.o
      PrototypeAST::Codegen()      in ccHkdHVT.o
  "llvm::Value::getName() const", referenced from:
      PrototypeAST::Codegen()      in ccHkdHVT.o
  "llvm::Function::Function(llvm::FunctionType const*,
llvm::GlobalValue::LinkageTypes, llvm::Twine const&, llvm::Module*)",
referenced from:
      PrototypeAST::Codegen()      in ccHkdHVT.o
  "llvm::Instruction::Instruction(llvm::Type const*, unsigned int,
llvm::Use*, unsigned int, llvm::Instruction*)", referenced from:
      llvm::CallInst::CallInst<__gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >
>(llvm::Value*, __gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >,
__gnu_cxx::__normal_iterator<llvm::Value**, std::vector<llvm::Value*,
std::allocator<llvm::Value*> > >, llvm::Twine const&,
llvm::Instruction*)in ccHkdHVT.o
  "llvm::Type::getDoubleTy(llvm::LLVMContext&)", referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      PrototypeAST::Codegen()      in ccHkdHVT.o
      PrototypeAST::Codegen()      in ccHkdHVT.o
  "llvm::ConstantExpr::getCompare(unsigned short, llvm::Constant*,
llvm::Constant*)", referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
  "llvm::ConstantExpr::getSub(llvm::Constant*, llvm::Constant*)",
referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
  "llvm::Instruction::~Instruction()", referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      llvm::CmpInst::~CmpInst()in ccHkdHVT.o
      llvm::CmpInst::~CmpInst()in ccHkdHVT.o
      llvm::CallInst::CallInst<__gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >
>(llvm::Value*, __gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >,
__gnu_cxx::__normal_iterator<llvm::Value**, std::vector<llvm::Value*,
std::allocator<llvm::Value*> > >, llvm::Twine const&,
llvm::Instruction*)in ccHkdHVT.o
  "llvm::Module::Module(llvm::StringRef const&, llvm::LLVMContext&)",
referenced from:
      _main in ccHkdHVT.o
  "llvm::APFloat::~APFloat()", referenced from:
      NumberExprAST::Codegen()      in ccHkdHVT.o
      NumberExprAST::Codegen()      in ccHkdHVT.o
  "llvm::Value::dump() const", referenced from:
      vtable for llvm::CmpInstin ccHkdHVT.o
  "llvm::getGlobalContext()", referenced from:
      NumberExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      PrototypeAST::Codegen()      in ccHkdHVT.o
      PrototypeAST::Codegen()      in ccHkdHVT.o
      FunctionAST::Codegen()      in ccHkdHVT.o
      _main in ccHkdHVT.o
      __static_initialization_and_destruction_0(int, int)in ccHkdHVT.o
  "vtable for llvm::FCmpInst", referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
  "llvm::Type::getForwardedTypeInternal() const", referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      llvm::PATypeHolder::get() constin ccHkdHVT.o
      llvm::PATypeHolder::get() constin ccHkdHVT.o
      llvm::CallInst::CallInst<__gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >
>(llvm::Value*, __gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >,
__gnu_cxx::__normal_iterator<llvm::Value**, std::vector<llvm::Value*,
std::allocator<llvm::Value*> > >, llvm::Twine const&,
llvm::Instruction*)in ccHkdHVT.o
  "llvm::CallInst::init(llvm::Value*, llvm::Value* const*, unsigned
int)", referenced from:
      llvm::CallInst::CallInst<__gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >
>(llvm::Value*, __gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >,
__gnu_cxx::__normal_iterator<llvm::Value**, std::vector<llvm::Value*,
std::allocator<llvm::Value*> > >, llvm::Twine const&,
llvm::Instruction*)in ccHkdHVT.o
  "llvm::BinaryOperator::Create(llvm::Instruction::BinaryOps,
llvm::Value*, llvm::Value*, llvm::Twine const&, llvm::Instruction*)",
referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
  "llvm::Type::isFPOrFPVector() const", referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
  "llvm::Value::setName(llvm::Twine const&)", referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      CallExprAST::Codegen()      in ccHkdHVT.o
      PrototypeAST::Codegen()      in ccHkdHVT.o
      FunctionAST::Codegen()      in ccHkdHVT.o
      llvm::IRBuilder<true,
llvm::ConstantFolder>::InsertHelper(llvm::Instruction*, llvm::Twine
const&) constin ccHkdHVT.o
      llvm::CallInst::CallInst<__gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >
>(llvm::Value*, __gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >,
__gnu_cxx::__normal_iterator<llvm::Value**, std::vector<llvm::Value*,
std::allocator<llvm::Value*> > >, llvm::Twine const&,
llvm::Instruction*)in ccHkdHVT.o
  "llvm::AttrListPtr::~AttrListPtr()", referenced from:
      llvm::CallInst::CallInst<__gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >
>(llvm::Value*, __gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >,
__gnu_cxx::__normal_iterator<llvm::Value**, std::vector<llvm::Value*,
std::allocator<llvm::Value*> > >, llvm::Twine const&,
llvm::Instruction*)in ccHkdHVT.o
  "llvm::ReturnInst::ReturnInst(llvm::LLVMContext&, llvm::Value*,
llvm::Instruction*)", referenced from:
      FunctionAST::Codegen()      in ccHkdHVT.o
  "llvm::ConstantExpr::getCast(unsigned int, llvm::Constant*,
llvm::Type const*)", referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
  "llvm::Module::dump() const", referenced from:
      _main in ccHkdHVT.o
  "llvm::ConstantExpr::getMul(llvm::Constant*, llvm::Constant*)",
referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
  "vtable for llvm::CallInst", referenced from:
      llvm::CallInst::CallInst<__gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >
>(llvm::Value*, __gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >,
__gnu_cxx::__normal_iterator<llvm::Value**, std::vector<llvm::Value*,
std::allocator<llvm::Value*> > >, llvm::Twine const&,
llvm::Instruction*)in ccHkdHVT.o
  "llvm::User::operator new(unsigned long, unsigned int)", referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      CallExprAST::Codegen()      in ccHkdHVT.o
      PrototypeAST::Codegen()      in ccHkdHVT.o
      FunctionAST::Codegen()      in ccHkdHVT.o
  "llvm::Type::getInt1Ty(llvm::LLVMContext&)", referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
  "llvm::ConstantExpr::getAdd(llvm::Constant*, llvm::Constant*)",
referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
  "llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*,
llvm::Type const*, llvm::Twine const&, llvm::Instruction*)",
referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
  "llvm::verifyFunction(llvm::Function const&,
llvm::VerifierFailureAction)", referenced from:
      FunctionAST::Codegen()      in ccHkdHVT.o
  "llvm::User::operator delete(void*)", referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      llvm::CmpInst::~CmpInst()in ccHkdHVT.o
  "llvm::Function::arg_size() const", referenced from:
      CallExprAST::Codegen()      in ccHkdHVT.o
      PrototypeAST::Codegen()      in ccHkdHVT.o
  "llvm::VectorType::get(llvm::Type const*, unsigned int)", referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
  "llvm::Function::BuildLazyArguments() const", referenced from:
      PrototypeAST::Codegen()      in ccHkdHVT.o
  "llvm::FunctionType::get(llvm::Type const*, std::vector<llvm::Type
const*, std::allocator<llvm::Type const*> > const&, bool)", referenced
from:
      PrototypeAST::Codegen()      in ccHkdHVT.o
  "llvm::sys::AtomicIncrement(unsigned int volatile*)", referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      llvm::Type::addRef() constin ccHkdHVT.o
      llvm::PATypeHolder::addRef()     in ccHkdHVT.o
      llvm::PATypeHolder::get() constin ccHkdHVT.o
      llvm::PATypeHolder::get() constin ccHkdHVT.o
      llvm::CallInst::CallInst<__gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >
>(llvm::Value*, __gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >,
__gnu_cxx::__normal_iterator<llvm::Value**, std::vector<llvm::Value*,
std::allocator<llvm::Value*> > >, llvm::Twine const&,
llvm::Instruction*)in ccHkdHVT.o
  "typeinfo for llvm::Instruction", referenced from:
      typeinfo for llvm::CmpInstin ccHkdHVT.o
  "llvm::CmpInst::CmpInst(llvm::Type const*,
llvm::Instruction::OtherOps, unsigned short, llvm::Value*,
llvm::Value*, llvm::Twine const&, llvm::Instruction*)", referenced
from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
  "llvm::ConstantFP::get(llvm::LLVMContext&, llvm::APFloat const&)",
referenced from:
      NumberExprAST::Codegen()      in ccHkdHVT.o
  "llvm::sys::AtomicDecrement(unsigned int volatile*)", referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      llvm::Type::dropRef() constin ccHkdHVT.o
      llvm::PATypeHolder::get() constin ccHkdHVT.o
      llvm::PATypeHolder::get() constin ccHkdHVT.o
      llvm::CallInst::CallInst<__gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >
>(llvm::Value*, __gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >,
__gnu_cxx::__normal_iterator<llvm::Value**, std::vector<llvm::Value*,
std::allocator<llvm::Value*> > >, llvm::Twine const&,
llvm::Instruction*)in ccHkdHVT.o
  "llvm::Type::destroy() const", referenced from:
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      BinaryExprAST::Codegen()      in ccHkdHVT.o
      llvm::Type::dropRef() constin ccHkdHVT.o
      llvm::PATypeHolder::get() constin ccHkdHVT.o
      llvm::PATypeHolder::get() constin ccHkdHVT.o
      llvm::CallInst::CallInst<__gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >
>(llvm::Value*, __gnu_cxx::__normal_iterator<llvm::Value**,
std::vector<llvm::Value*, std::allocator<llvm::Value*> > >,
__gnu_cxx::__normal_iterator<llvm::Value**, std::vector<llvm::Value*,
std::allocator<llvm::Value*> > >, llvm::Twine const&,
llvm::Instruction*)in ccHkdHVT.o
ld: symbol(s) not found
collect2: ld returned 1 exit status



More information about the llvm-dev mailing list