[cfe-users] Setting target to 64 bits

Miguel Guedes miguel.a.guedes at gmail.com
Fri Apr 19 06:24:35 PDT 2013


Hello List,


I've built llvm/clang 3.2 for target architecture x86 only by specifying 
LLVM_TARGETS_TO_BUILD=X86 . I then proceeded to write a program based on 
clang to parse a source file. Unfortunately the diagnostics are 
outputting the error,

  /usr/include/x86_64-linux-gnu/gnu/stubs.h:7:11: fatal error: 'gnu/
stubs-32.h' file not found

stubs-32.h is included by stubs.h when the word size is 32 bits.

How can I set the target options to 64 bits?

Currently doing:

    llvm::IntrusiveRefCntPtr<TargetOptions> pto(new TargetOptions());
    pto->Triple = llvm::sys::getDefaultTargetTriple();

    std::cout << pto->Triple << std::endl;
    
    TargetInfo *pti = TargetInfo::CreateTargetInfo(ci.getDiagnostics(), 
*pto);
    ci.setTarget(pti);


The contents of pto->Triple are,

  x86_64-unknown-linux-gnu


My system is 64 bits,

  Linux 3.5.0-28-generic SMP x86_64 x86_64 x86_64 GNU/Linux




More information about the cfe-users mailing list