[llvm-dev] [Kaleidoscope] symbol(s) not found during compiling

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] [Kaleidoscope] symbol(s) not found during compiling

Bruce Hoult via llvm-dev
Hi,

I am very excited to take the awesome tutorial of implementing *Kaleidoscope*. But I got stuck here...

I have done the AST parsing, however, when I introduce these 'llvm/IR/*' headers, I got a compiling error... But if I delete these headers it runs well ...

"""headers
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Verifier.h"
"""

"""error
$ g++ -I/usr/local/opt/llvm/include -L/usr/local/opt/llvm/lib -std=c++11 k-lang.cc
Undefined symbols for architecture x86_64:
  "llvm::DisableABIBreakingChecks", referenced from:
      llvm::VerifyDisableABIBreakingChecks in k-lang-14fa17.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
"""

My OS is MacOS High Sierra v10.13.3

Source Codes could be viewed on: [GitHub](https://github.com/Higuoxing/llvm-playground)

I am still trying to google it ... and it would be great if someone could help me...

Again, thanks for awesome LLVM and this awesome tutorial :D

Best Regards,
Xing

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] [Kaleidoscope] symbol(s) not found during compiling

Bruce Hoult via llvm-dev
On 1 June 2018 at 14:31, Xing GUO via llvm-dev <[hidden email]> wrote:
> $ g++ -I/usr/local/opt/llvm/include -L/usr/local/opt/llvm/lib -std=c++11

The -L option tells Clang where it should look for libraries, but
there's no corresponding option telling it which libraries to link
against. You need to link against specific LLVM libraries like
libLLVMCore.dylib.

You could do it manually ("-lLLVMCore" might work, depending on
exactly what you use), but using llvm-config as suggested on the
tutorial page is likely to be a lot simpler (and also get you any
other options that are necessary; I think LLVM expects some macros
that come out of "llvm-config --cxxflags" for example).

Cheers.

Tim.
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] [Kaleidoscope] symbol(s) not found during compiling

Bruce Hoult via llvm-dev
In reply to this post by Bruce Hoult via llvm-dev
You’ll need to link LLVM libraries.
I suggest you set up your project as a subproject under LLVM source tree and use CMake configs to properly (and easily!) link LLVM Libraries

Zhang

在 2018年6月1日,21:31,Xing GUO via llvm-dev <[hidden email]> 写道:

Hi,

I am very excited to take the awesome tutorial of implementing *Kaleidoscope*. But I got stuck here...

I have done the AST parsing, however, when I introduce these 'llvm/IR/*' headers, I got a compiling error... But if I delete these headers it runs well ...

"""headers
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Verifier.h"
"""

"""error
$ g++ -I/usr/local/opt/llvm/include -L/usr/local/opt/llvm/lib -std=c++11 k-lang.cc
Undefined symbols for architecture x86_64:
  "llvm::DisableABIBreakingChecks", referenced from:
      llvm::VerifyDisableABIBreakingChecks in k-lang-14fa17.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
"""

My OS is MacOS High Sierra v10.13.3

Source Codes could be viewed on: [GitHub](https://github.com/Higuoxing/llvm-playground)

I am still trying to google it ... and it would be great if someone could help me...

Again, thanks for awesome LLVM and this awesome tutorial :D

Best Regards,
Xing
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] [Kaleidoscope] symbol(s) not found during compiling

Bruce Hoult via llvm-dev
Hi Tim and Zhang!

Thanks a lot! I should have read the docs carefully and dig more about LLVM :D


Best Regards,
Xing



mayuyu.io <[hidden email]> 于2018年6月1日周五 下午9:47写道:
You’ll need to link LLVM libraries.
I suggest you set up your project as a subproject under LLVM source tree and use CMake configs to properly (and easily!) link LLVM Libraries

Zhang

在 2018年6月1日,21:31,Xing GUO via llvm-dev <[hidden email]> 写道:

Hi,

I am very excited to take the awesome tutorial of implementing *Kaleidoscope*. But I got stuck here...

I have done the AST parsing, however, when I introduce these 'llvm/IR/*' headers, I got a compiling error... But if I delete these headers it runs well ...

"""headers
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Verifier.h"
"""

"""error
$ g++ -I/usr/local/opt/llvm/include -L/usr/local/opt/llvm/lib -std=c++11 k-lang.cc
Undefined symbols for architecture x86_64:
  "llvm::DisableABIBreakingChecks", referenced from:
      llvm::VerifyDisableABIBreakingChecks in k-lang-14fa17.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
"""

My OS is MacOS High Sierra v10.13.3

Source Codes could be viewed on: [GitHub](https://github.com/Higuoxing/llvm-playground)

I am still trying to google it ... and it would be great if someone could help me...

Again, thanks for awesome LLVM and this awesome tutorial :D

Best Regards,
Xing
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev