<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/129698>129698</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[LLVM] Kaleidoscope compilation fails for chapter 4
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nots1dd
</td>
</tr>
</table>
<pre>
Upon compiling Chapter 4 of Kaleidoscope this error pops up:
```bash
untoy.cpp:646:35: error: no member named 'toPtr' in 'llvm::orc::ExecutorSymbolDef'
646 | double (*FP)() = ExprSymbol.toPtr<double (*)()>();
| ~~~~~~~~~~ ^
untoy.cpp:646:50: error: expected expression
646 | double (*FP)() = ExprSymbol.toPtr<double (*)()>();
| ^
untoy.cpp:646:55: error: expected expression
646 | double (*FP)() = ExprSymbol.toPtr<double (*)()>();
| ^
3 errors generated.
```
The main issue lies in this code snippet:
```cpp
// Search the JIT for the __anon_expr symbol.
auto ExprSymbol = ExitOnErr(TheJIT->lookup("__anon_expr"));
/* ExprSymbolDef does not have this method (API change)! */
double (*FP)() = ExprSymbol.toPtr<double (*)()>();
fprintf(stderr, "Evaluated to %f\n", FP());
```
The error persists in future chapters until Chapter 8 where the focus shifts on compiling to object code.
This seems to be the issue of the ORC's API being outdated and I already have a possible solution on how to fix this.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8VUuPpDYQ_jXmUpoWGOhuDhzYfkiz2WhH2UmuI4OLxolxIdvM45LfHtn09HZrkkMOuxZSF2pcVd_31UM4p04GsWblJ1buEzH7gWxtyLtMyqQl-Vb_PpGBjsZJaWVOsBvE5NFCAdTDL0KjkuQ6mhD8oBygtWRhosnBPLG8YWl81unytMINLG1m4-lt1U3hi3WxZnmTlyxvltvBMAQjji1aMGJECYxvPD14y_gGlAmvWj-PwX_ekO0W4_CK3ezJfnsbW9J77BnfsLQBWBdrYJsdLEfS3GoExre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