Overview
I've been working my way through the LLVM Kaleidoscope tutorial, and I am a bit stumped on getting Chapter 4 building.
I tried many different things to work this out (see below), but I am running out of things to try. Any help on this would be great.
My setup
- Installed llvm via brew (i.e.,
brew install llvm
)
- New directory with sub-folders titled as
ChapterX
(where X is the chapter I am on)
- Chapters 1-3 have worked out of the box without any issues
What I have tried (Chapter 4)
note: I have made it a point to search the internet all along the way with no luck.
- Similar to the other chapters, I created a Chapter 4 folder, copied the sample code from the tutorial to a
toy.cpp
file, then ran the clang++ build command provided in the tutorial.
- This failed with the error:
toy.cpp:1:10: fatal error: '../include/KaleidoscopeJIT.h' file not found
- Since I was in a new directory without an
include
folder with KaleidoscopeJIT.h
, I downloaded the llvm source code because this missing file was in there.
- I then tried to use the chapter 4 directory in there (
llvm-project/llvm/examples/Kaleidoscope/Chapter4
)
- This failed with the following new error:
fatal error: 'llvm/ExecutionEngine/Orc/TargetProcessControl.h' file not found
- This turned up missing because the homebrew llvm installation that was being used for the build didn't have this file available.
- I figured that maybe the brew install didn't include all the files for this tutorial for some reason, so I tried to build llvm from source code.
- Uninstalled the brew llvm (
brew uninsall llvm
)
- Built llvm from source code following these steps from the llvm site
- Added the newly built llvm to my path
- Tried to build chapter 4 again and received this error:
Undefined symbols for architecture x86_64
- I have also tried installing older versions of LLVM via homebrew (e.g., v9) in case the tutorial was out of date. No luck here either.
question from:
https://stackoverflow.com/questions/65922546/issues-building-llvm-kaleidoscope-chapter-4 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…