[LLVMdev] initializer does not match global variable type.

Reid Spencer rspencer at reidspencer.com
Mon Oct 16 16:15:44 PDT 2006


Hi Todd,

On Mon, 2006-10-16 at 14:04 -0700, Anderson, Todd A wrote:
> >-----Original Message-----
> >From: llvmdev-bounces at cs.uiuc.edu 
> >[mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Chris Lattner
> >Sent: Monday, October 16, 2006 2:09 PM
> >To: LLVM Developers Mailing List
> >Subject: Re: [LLVMdev] initializer does not match global variable type.
> >
> >On Mon, 16 Oct 2006, Anderson, Todd A wrote:
> >> I have an objective-c file, bar.m, that I try to process in the
> >> following way generating the error shown below.  Any  help would
> >> be appreciated.  I suspect the error is in the first few lines
> >> of output.
> >
> >That is really really strange.  Can you please file a bugzilla 
> >report and 
> >indicate what target you have llvm-gcc configured for?
> 
> I don't understand what llvm-gcc has to do with this.  

I think in your instructions (below) you referred to using "cfrontend-g
++" which both Chris and I took to mean llvm-g++.

> Maybe I wasn't
> clear.  The "g++" is ordinary vanilla g++, not llvm-g++.  Are there
> any versioning issues with regular g++ compiling llvm2cpp generated
> C++ files?  

This could be the weak link. llvm2cpp is a relatively new and fairly
untested addition to the llvm toolsuite. Its purposes are more for
instruction and example generation than for use in compiling. It is
entirely possible that llvm2cpp is not generating *exactly* the 
C++ code necessary to recreate your module. This is especially true
since your source language is Objective-C and that has never been tried
with llvm2cpp.

> I believe cfrontend-g++ comes from the cfrontend tarball.

Okay, that's the llvm-gcc that Chris was referring to.

> llvm2cpp came from the llvm tarball.  My g++ was 4.1.1.  The LLVM
> libs are from the llvm tarball I believe and the objc library is
> probably the gcc 4.1.1 one.  What other information would help?
> 

Well, what are you trying to accomplish?

> >>> cfrontend-g++ -o bar.bc bar.m
> >>> llvm2cpp -o bar.cpp bar.bc
> >>> g++ -c bar.o bar.cpp
> >>> ld -o bar bar.o -l objc -l LLVMCore -l LLVMSupport -l LLVMSystem
> >>> ./bar

Are you just trying to get your bar.m program to run? If so, there's a
route that doesn't involve llvm2cpp:

cfrontend-g++ -o bar.bc bar.m   # Source -> Bytecode
llc -o bar.s bar.bc             # Bytecode -> Native Assembly Source
g++ -S bar.s -o bar.o           # Native Assembly -> Object File
g++ -o bar bar.o -lobjc 
./bar

Reid.




More information about the llvm-dev mailing list