use LLVM to convert C++ code to C code

Hi,
I am newbie to llvm.

I am unable to generate bytecode for the following c++ code(to be used for c-code generation)

#include
using namespace std;

int main()
{
vector v;
}

$ llvm-g++ test.cpp

gccld: CallGraph.cpp:277: void llvm::CallGraphNode::removeCallEdgeTo(llvm::CallGraphNode*): Assertion `i && “Cannot find callee to remove!”’ failed.
gccld((anonymous namespace)::PrintStackTrace()+0x18)[0x84833b4]
gccld((anonymous namespace)::SignalHandler(int)+0x100)[0x848363c]
/lib/tls/libc.so.6[0xbe7a48]
/lib/tls/libc.so.6(abort+0x129)[0xbe9319]
/lib/tls/libc.so.6(__assert_fail+0x101)[0xbe0f41]
gccld(llvm::CallGraphNode::removeCallEdgeTo(llvm::CallGraphNode*)+0x3d)[0x837697f]
gccld((anonymous namespace)::PruneEH::DeleteBasicBlock(llvm::BasicBlock*)+0x16f)[0x8348265]
gccld((anonymous namespace)::PruneEH::SimplifyFunction(llvm::Function*)+0x2d4)[0x8347eee]
gccld((anonymous namespace)::PruneEH::runOnSCC(std::vector<llvm::CallGraphNode*, std::allocatorllvm::CallGraphNode* > const&)+0x76)[0x8347804]
gccld(llvm::CallGraphSCCPass::runOnModule(llvm::Module&)+0x99)[0x8378e29]
gccld(llvm::ModulePassManager::runPass(llvm::ModulePass*, llvm::Module*)+0x1b)[0x842a111]
gccld(llvm::PassManagerTllvm::MTraits::runPasses(llvm::Module*, std::map<llvm::Pass*, std::vector<llvm::Pass*, std::allocatorllvm::Pass* >, std::lessllvm::Pass*, std::allocator<std::pair<llvm::Pass* const, std::vector<llvm::Pass*, std::allocatorllvm::Pass* > > > >&)+0x11c)[0x8429098]
gccld(llvm::PassManagerTllvm::MTraits::runOnUnit(llvm::Module*)+0x16a)[0x8428f60]
gccld(llvm::ModulePassManager::runOnModule(llvm::Module&)+0x22)[0x841477e]
gccld(llvm::PassManager::run(llvm::Module&)+0x1f)[0x8414aa9]
gccld(llvm::GenerateBytecode(llvm::Module*, int, bool, std::basic_ostream<char, std::char_traits >*)+0x3af)[0x82a252f]
gccld(main+0xb23)[0x82a6dd7]
/lib/tls/libc.so.6(__libc_start_main+0xe3)[0xbd4e33]
gccld(__gxx_personality_v0+0x121)[0x82a1965]
llvm-g++: Internal error: Aborted (program gccld)
Please submit a full bug report.
See for instructions.

Hi,

I figured it out:
I need to manually compile libstdc++ to LLVM bytecode, generate c code from the LLVM bytecode, then build build shared lib with gcc compiler and then I can use the same to build/link my applications.

Thanks
Chandrashekhar Kumar wrote: