Hello all, I am trying to build the kaleidoscope sample code on Mac os (10.6). What I have done to get llvm libraries : 1) Downloaded llvm-2.6 source code 2) ./configure 3)make 4) make intall Then I tried to build kaleidoscope as described in the tutorial: g++ -g -O3 toy.cpp `llvm-config --cppflags --ldflags --libs core` -o toy I get typical link time errors (undefined symbols: ...) as if the linked libraries were not found ( llvm-config seems to work fine) The very first errors are the following: ld: warning: in /usr/local/lib/libLLVMCore.a, file was built for unsupported file format which is not the architecture being linked (x86_64) ld: warning: in /usr/local/lib/libLLVMSupport.a, file was built for unsupported file format which is not the architecture being linked (x86_64) ld: warning: in /usr/local/lib/libLLVMSystem.a, file was built for unsupported file format which is not the architecture being linked (x86_64) Then I guess libraries are not linked and I get classical errors. By the way, I get the same errors (apart from the first ones) if I build like this (omitting libraries flags): g++ -g -O3 toy.cpp -I/usr/local/include -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -o toy There must be something wrong with the libraries and I assume I have not compiled them the right way. Please let me know if you have any ideas. Regards, romain -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100314/268896d2/attachment.html>
On Mar 14, 2010, at 8:00 AM, Romain Pechayre wrote:> Hello all, > > I am trying to build the kaleidoscope sample code on Mac os (10.6). > What I have done to get llvm libraries : > > 1) Downloaded llvm-2.6 source code > 2) ./configure > 3)make > 4) make intall > > Then I tried to build kaleidoscope as described in the tutorial: > g++ -g -O3 toy.cpp `llvm-config --cppflags --ldflags --libs core` -o toy > I get typical link time errors (undefined symbols: ...) as if the linked libraries were not found ( llvm-config seems to work fine) > > The very first errors are the following: > ld: warning: in /usr/local/lib/libLLVMCore.a, file was built for unsupported file format which is not the architecture being linked (x86_64) > ld: warning: in /usr/local/lib/libLLVMSupport.a, file was built for unsupported file format which is not the architecture being linked (x86_64) > ld: warning: in /usr/local/lib/libLLVMSystem.a, file was built for unsupported file format which is not the architecture being linked (x86_64) > > Then I guess libraries are not linked and I get classical errors.This sounds like LLVM is being built as x86-32, but toy.cpp is being built as x86-64. Try compiling toy.cpp with "-m32". -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100314/94b336f4/attachment.html>
Indeed it works. Thanks ! Is LLVM built with m32 by default ? Cheers, Romain On Mar 14, 2010, at 5:42 PM, Chris Lattner wrote:> > On Mar 14, 2010, at 8:00 AM, Romain Pechayre wrote: > >> Hello all, >> >> I am trying to build the kaleidoscope sample code on Mac os (10.6). >> What I have done to get llvm libraries : >> >> 1) Downloaded llvm-2.6 source code >> 2) ./configure >> 3)make >> 4) make intall >> >> Then I tried to build kaleidoscope as described in the tutorial: >> g++ -g -O3 toy.cpp `llvm-config --cppflags --ldflags --libs core` -o toy >> I get typical link time errors (undefined symbols: ...) as if the linked libraries were not found ( llvm-config seems to work fine) >> >> The very first errors are the following: >> ld: warning: in /usr/local/lib/libLLVMCore.a, file was built for unsupported file format which is not the architecture being linked (x86_64) >> ld: warning: in /usr/local/lib/libLLVMSupport.a, file was built for unsupported file format which is not the architecture being linked (x86_64) >> ld: warning: in /usr/local/lib/libLLVMSystem.a, file was built for unsupported file format which is not the architecture being linked (x86_64) >> >> Then I guess libraries are not linked and I get classical errors. > > This sounds like LLVM is being built as x86-32, but toy.cpp is being built as x86-64. Try compiling toy.cpp with "-m32". > > -Chris-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100314/f88438f7/attachment.html>
I'm not sure why you are getting mixed architecture (bit size) results on 10.6.x but you can also build the examples as part of the llvm build. Set the environmental var BUILD_EXAMPLES to 1before executing the llvm make. Garrison On Mar 14, 2010, at 11:00, Romain Pechayre wrote:> Hello all, > > I am trying to build the kaleidoscope sample code on Mac os (10.6). > What I have done to get llvm libraries : > > 1) Downloaded llvm-2.6 source code > 2) ./configure > 3)make > 4) make intall > > Then I tried to build kaleidoscope as described in the tutorial: > g++ -g -O3 toy.cpp `llvm-config --cppflags --ldflags --libs core` -o toy > I get typical link time errors (undefined symbols: ...) as if the linked libraries were not found ( llvm-config seems to work fine) > > The very first errors are the following: > ld: warning: in /usr/local/lib/libLLVMCore.a, file was built for unsupported file format which is not the architecture being linked (x86_64) > ld: warning: in /usr/local/lib/libLLVMSupport.a, file was built for unsupported file format which is not the architecture being linked (x86_64) > ld: warning: in /usr/local/lib/libLLVMSystem.a, file was built for unsupported file format which is not the architecture being linked (x86_64) > > Then I guess libraries are not linked and I get classical errors. > By the way, I get the same errors (apart from the first ones) if I build like this (omitting libraries flags): > > g++ -g -O3 toy.cpp -I/usr/local/include -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -o toy > > There must be something wrong with the libraries and I assume I have not compiled them the right way. Please let me know if you have any ideas. > > Regards, > > romain > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100315/7627865f/attachment.html>
LLVM 2.6 hadn't updated configure, and would build as 32-bit by default. The easy fix is to always force the desired triple when configuring, I generally use: configure --{build,host,target}=x86_64-apple-darwin10 - Daniel On Mon, Mar 15, 2010 at 4:22 AM, Garrison Venn <gvenn.cfe.dev at gmail.com> wrote:> I'm not sure why you are getting mixed architecture (bit size) results on > 10.6.x but you can also build the examples > as part of the llvm build. > Set the environmental var BUILD_EXAMPLES to 1before executing the llvm make. > Garrison > On Mar 14, 2010, at 11:00, Romain Pechayre wrote: > > Hello all, > I am trying to build the kaleidoscope sample code on Mac os (10.6). > What I have done to get llvm libraries : > 1) Downloaded llvm-2.6 source code > 2) ./configure > 3)make > 4) make intall > Then I tried to build kaleidoscope as described in the tutorial: > > g++ -g -O3 toy.cpp `llvm-config --cppflags --ldflags --libs core` -o toy > > I get typical link time errors (undefined symbols: ...) as if the linked > libraries were not found ( llvm-config seems to work fine) > The very first errors are the following: > ld: warning: in /usr/local/lib/libLLVMCore.a, file was built for unsupported > file format which is not the architecture being linked (x86_64) > ld: warning: in /usr/local/lib/libLLVMSupport.a, file was built for > unsupported file format which is not the architecture being linked (x86_64) > ld: warning: in /usr/local/lib/libLLVMSystem.a, file was built for > unsupported file format which is not the architecture being linked (x86_64) > Then I guess libraries are not linked and I get classical errors. > By the way, I get the same errors (apart from the first ones) if I build > like this (omitting libraries flags): > g++ -g -O3 toy.cpp -I/usr/local/include -D_DEBUG -D_GNU_SOURCE > -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -o toy > There must be something wrong with the libraries and I assume I have not > compiled them the right way. Please let me know if you have any ideas. > Regards, > romain > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >