<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>
<blockquote type="cite"> the convenience of entering and running
their code on their iOS device.</blockquote>
Off-topic FYI: Not sure if this may have changed in the meantime,
but in the past iOS didn't allow 3rd-party Apps to run
JIT-compiled code.<br>
</p>
<p><a class="moz-txt-link-freetext" href="https://stackoverflow.com/questions/5054732">https://stackoverflow.com/questions/5054732</a><br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 17/01/2020 05:24, Igor Gomon wrote:<br>
</div>
<blockquote type="cite"
cite="mid:MN2PR13MB366190784B663746A81A2E97FC310@MN2PR13MB3661.namprd13.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
Hi Lang,</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
I have tried the same program but using stdio.h and printf(). It
works fine on Windows.
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
But my use-case requires C++ support. I currently have a C++
text editor app in the App Store and I am working on adding
on-device compilation and running capabilities (ideally). The
reason for C++ support is because I believe there is a large
community of people who are studying C++ in school and they
would appreciate the convenience of entering and running their
code on their iOS device.</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
--</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
Best Regards,</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
Igor</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
face="Calibri, sans-serif" color="#000000"><b>From:</b> Lang
Hames <a class="moz-txt-link-rfc2396E" href="mailto:lhames@gmail.com"><lhames@gmail.com></a><br>
<b>Sent:</b> Thursday, January 16, 2020 10:01 PM<br>
<b>To:</b> Igor Gomon <a class="moz-txt-link-rfc2396E" href="mailto:giv_ua@hotmail.com"><giv_ua@hotmail.com></a><br>
<b>Cc:</b> Stefan Gränitz <a class="moz-txt-link-rfc2396E" href="mailto:stefan.graenitz@gmail.com"><stefan.graenitz@gmail.com></a>;
David Blaikie <a class="moz-txt-link-rfc2396E" href="mailto:dblaikie@gmail.com"><dblaikie@gmail.com></a>;
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a> <a class="moz-txt-link-rfc2396E" href="mailto:llvm-dev@lists.llvm.org"><llvm-dev@lists.llvm.org></a><br>
<b>Subject:</b> Re: [llvm-dev] clang interpreter failed to
materialize symbols</font>
<div> </div>
</div>
<div dir="auto">Hi Igor,
<div><br>
</div>
<div>Regarding that stack trace: C++ code and interactions with
the C++ standard library are not as well supported as C/libC,
especially on Windows.</div>
<div><br>
</div>
<div>What happens if you write your hello-world program in C
using printf?</div>
<div><br>
</div>
<div>Does your use-case require C++?</div>
<div><br>
</div>
<div>— Lang.</div>
<div><br>
<div dir="ltr">Sent from my iPad</div>
<div dir="ltr"><br>
<blockquote type="cite">On Jan 15, 2020, at 9:51 PM, Igor
Gomon <a class="moz-txt-link-rfc2396E" href="mailto:giv_ua@hotmail.com"><giv_ua@hotmail.com></a> wrote:<br>
<br>
</blockquote>
</div>
<blockquote type="cite">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
Hi Stefan,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
I just tried the -jit-kind=orc-lazy with lli executable
and it solves the problem on Ubuntu 18.04 (still does
not work on Windows 10). But this solution is good
enough for me now. Thanks again for your help!</div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
--</div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
Best Regards,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
Igor<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font
style="font-size:11pt" face="Calibri, sans-serif"
color="#000000"><b>From:</b> Igor Gomon
<a class="moz-txt-link-rfc2396E" href="mailto:giv_ua@hotmail.com"><giv_ua@hotmail.com></a><br>
<b>Sent:</b> Tuesday, January 14, 2020 7:38 PM<br>
<b>To:</b> Stefan Gränitz
<a class="moz-txt-link-rfc2396E" href="mailto:stefan.graenitz@gmail.com"><stefan.graenitz@gmail.com></a><br>
<b>Cc:</b> David Blaikie <a class="moz-txt-link-rfc2396E" href="mailto:dblaikie@gmail.com"><dblaikie@gmail.com></a>;
Lang Hames <a class="moz-txt-link-rfc2396E" href="mailto:lhames@gmail.com"><lhames@gmail.com></a>;
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-rfc2396E" href="mailto:llvm-dev@lists.llvm.org"><llvm-dev@lists.llvm.org></a><br>
<b>Subject:</b> RE: [llvm-dev] clang interpreter
failed to materialize symbols</font>
<div> </div>
</div>
<style>
<!--
@font-face
{font-family:"Cambria Math"}
@font-face
{font-family:Calibri}
p.x_x_MsoNormal, li.x_x_MsoNormal, div.x_x_MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
a:link, span.x_x_MsoHyperlink
{color:blue;
text-decoration:underline}
pre
{margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black}
p.x_x_gmail-m-4439422298999852875msolistparagraph, li.x_x_gmail-m-4439422298999852875msolistparagraph, div.x_x_gmail-m-4439422298999852875msolistparagraph
{margin-right:0in;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:black}
span.x_x_HTMLPreformattedChar
{font-family:"Courier New";
color:black}
@page WordSection1
{margin:1.0in 1.0in 1.0in 1.0in}
ol
{margin-bottom:0in}
ul
{margin-bottom:0in}
-->
</style>
<div lang="EN-US">
<div class="x_x_WordSection1">
<p class="x_x_MsoNormal">Hi Stefan,</p>
<p class="x_x_MsoNormal"> </p>
<p class="x_x_MsoNormal">I just tried it. Here is what
I got:</p>
<p class="x_x_MsoNormal">PS
C:\Users\giv_u\source\repos\ConsoleApplication1\ConsoleApplication1>
lli -jit-kind=orc-lazy .\ConsoleApplication1.bc</p>
<p class="x_x_MsoNormal">Assertion failed:
isa<X>(Val) && "cast<Ty>()
argument of incompatible type!", file
C:\dev\llvm-project\llvm\include\llvm/Support/Casting.h,
line 264</p>
<p class="x_x_MsoNormal"> </p>
<p class="x_x_MsoNormal">--</p>
<p class="x_x_MsoNormal">Thanks,</p>
<p class="x_x_MsoNormal">Igor</p>
<p class="x_x_MsoNormal"> </p>
<p class="x_x_MsoNormal">Sent from <a
href="https://go.microsoft.com/fwlink/?LinkId=550986"
moz-do-not-send="true">
Mail</a> for Windows 10</p>
<p class="x_x_MsoNormal"> </p>
<div style="border:none; border-top:solid #E1E1E1
1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_x_MsoNormal" style="border:none;
padding:0in"><b>From: </b><a
href="mailto:stefan.graenitz@gmail.com"
moz-do-not-send="true">Stefan Gränitz</a><br>
<b>Sent: </b>Tuesday, January 14, 2020 11:46 AM<br>
<b>To: </b><a href="mailto:giv_ua@hotmail.com"
moz-do-not-send="true">Igor Gomon</a><br>
<b>Cc: </b><a href="mailto:dblaikie@gmail.com"
moz-do-not-send="true">David Blaikie</a>; <a
href="mailto:lhames@gmail.com"
moz-do-not-send="true">
Lang Hames</a>; <a
href="mailto:llvm-dev@lists.llvm.org"
moz-do-not-send="true">llvm-dev@lists.llvm.org</a><br>
<b>Subject: </b>Re: [llvm-dev] clang interpreter
failed to materialize symbols</p>
</div>
<p class="x_x_MsoNormal"> </p>
<p class="x_x_MsoNormal" style="margin-bottom:12.0pt">Hi
Igor, not sure if that will work, but have you tried
lli -jit-kind=orc-lazy ? The default is still MCJIT:<br>
<a
href="https://github.com/llvm/llvm-project/blob/master/llvm/tools/lli/lli.cpp#L88"
moz-do-not-send="true">https://github.com/llvm/llvm-project/blob/master/llvm/tools/lli/lli.cpp#L88</a></p>
<div>
<p class="x_x_MsoNormal">On 13/01/2020 19:07, David
Blaikie via llvm-dev wrote:</p>
</div>
<blockquote style="margin-top:5.0pt;
margin-bottom:5.0pt">
<div>
<p class="x_x_MsoNormal">(+Lang for
JIT/interpreter questions)</p>
</div>
<p class="x_x_MsoNormal"> </p>
<div>
<div>
<p class="x_x_MsoNormal">On Sun, Jan 5, 2020 at
5:00 PM Igor Gomon via llvm-dev <<a
href="mailto:llvm-dev@lists.llvm.org"
moz-do-not-send="true">llvm-dev@lists.llvm.org</a>>
wrote:</p>
</div>
<blockquote style="border:none; border-left:solid
#CCCCCC 1.0pt; padding:0in 0in 0in 6.0pt;
margin-left:4.8pt; margin-right:0in">
<div>
<div>
<p class="x_x_MsoNormal" style="">Hello,</p>
<p class="x_x_MsoNormal" style=""> </p>
<p class="x_x_MsoNormal" style="">I am new
to LLVM and what I am trying to do is to
get a very simple “hello-world” C++
program to compile to LLVM IR and then to
run it using lli tool.</p>
<p class="x_x_MsoNormal" style="">So here is
the program code (hello.cpp):</p>
<p class="x_x_MsoNormal"
style="margin-left:.5in">#include
<iostream></p>
<p class="x_x_MsoNormal"
style="margin-left:.5in">int main (int
argc, char *argv[])</p>
<p class="x_x_MsoNormal"
style="margin-left:.5in">{</p>
<p class="x_x_MsoNormal"
style="margin-left:.5in"> std::cout
<< "Hello World!\n";</p>
<p class="x_x_MsoNormal"
style="margin-left:.5in"> return 0;</p>
<p class="x_x_MsoNormal"
style="margin-left:.5in">}</p>
<p class="x_x_MsoNormal" style="">Below are
the steps I do to achieve that goal:</p>
<ol start="1" type="1">
<li
class="x_x_gmail-m-4439422298999852875msolistparagraph"
style="">clang++.exe hello.cpp -S
-emit-llvm -o hello.ll (produces
hello.ll about 307KB in size)</li>
<li
class="x_x_gmail-m-4439422298999852875msolistparagraph"
style="">llvm-link.exe hello.ll -o
hello.bc (produces the bit-code file
about 79KB in size).</li>
<li
class="x_x_gmail-m-4439422298999852875msolistparagraph"
style="">lli.exe hello.bc (terminates
with a segmentation fault). The dump is
below.</li>
</ol>
<p class="x_x_MsoNormal" style=""> </p>
<p class="x_x_MsoNormal" style="">I
understand that some symbols are not
loaded (C++ standard library symbols). I
am not sure how I can specify the location
of those symbols to lli tool (I tried
–extra-object option but no effect).</p>
<p class="x_x_MsoNormal" style="">Could
someone please let me know what am I
missing or doing wrong?
</p>
<p class="x_x_MsoNormal" style="">Any help
is greatly appreciated!!!</p>
<p class="x_x_MsoNormal" style=""> </p>
<p class="x_x_MsoNormal" style="">--</p>
<p class="x_x_MsoNormal" style="">Thanks,</p>
<p class="x_x_MsoNormal" style="">Igor</p>
<p class="x_x_MsoNormal" style=""> </p>
<p class="x_x_MsoNormal" style="">Stack
dump:</p>
<p class="x_x_MsoNormal" style="">0.
Program arguments:
C:\dev\llvm-project\build\Debug\bin\lli.exe
.\hello.bc</p>
<p class="x_x_MsoNormal" style="">0x0000000000000000
(0x0000000000000010 0xCCCCCCCCCCCCCCCC
0x000000575B18D640 0x00007FF68DEF6186)
<unknown module></p>
<p class="x_x_MsoNormal" style="">0x000001AF8A3004F6
(0xCCCCCCCCCCCCCCCC 0x000000575B18D640
0x00007FF68DEF6186 0x000001AF8A4B0000)
<unknown module></p>
<p class="x_x_MsoNormal" style="">0x0000000000000010
(0x000000575B18D640 0x00007FF68DEF6186
0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE)
<unknown module></p>
<p class="x_x_MsoNormal" style="">0xCCCCCCCCCCCCCCCC
(0x00007FF68DEF6186 0x000001AF8A4B0000
0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0)
<unknown module></p>
<p class="x_x_MsoNormal" style="">0x000000575B18D640
(0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE
0x000000575B18D6A0 0x000001AF8A300032)
<unknown module></p>
<p class="x_x_MsoNormal" style="">0x00007FF68DEF6186
(0x000001AF8A85B410 0x000000575B18D678
0xCCCCCCCCCCCCCCCC 0x000001AF8A4B0000),
std::_Construct_in_place<std::_Container_proxy,std::_Container_base12
*>() + 0x56 bytes(s), C:\Program Files
(x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory,
line 205</p>
<p class="x_x_MsoNormal" style="">0x00007FF68DEF45E8
(0x0000000000000000 0x000000005B18D6B1
0xFFFFFFFFFFFFFFFE 0x000000575B18DB80),
std::_Container_base12::_Alloc_proxy<std::allocator<std::_Container_proxy>
>() + 0x58 bytes(s), C:\Program Files
(x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory,
line 1100</p>
<p class="x_x_MsoNormal" style="">0x00007FF68DF36634
(0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC
0xCCCCCCCCCCCCCCCC 0x0000000000000001),
std::vector<llvm::GenericValue,std::allocator<llvm::GenericValue>
>::vector<llvm::GenericValue,std::allocator<llvm::GenericValue>
>() + 0x54 bytes(s), C:\Program Files
(x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\vector,
line 446</p>
<p class="x_x_MsoNormal" style="">0x00007FF68E06B048
(0x000001AF8A6A3058 0x0000000000000001
0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC),
llvm::APInt::getZExtValue() + 0x28
bytes(s),
C:\dev\llvm-project\llvm\include\llvm\ADT\APInt.h,
line 1589 + 0xA byte(s)</p>
<p class="x_x_MsoNormal" style="">0x00007FF68ED9E0F0
(0x000001AF8A563310 0x000000575B18DB88
0x000001AF8A583F18 0x000000575B18DBC0),
llvm::MCJIT::runFunction() + 0x480
bytes(s),
C:\dev\llvm-project\llvm\lib\ExecutionEngine\MCJIT\MCJIT.cpp,
line 550 + 0x16 byte(s)</p>
<p class="x_x_MsoNormal" style="">0x00007FF68EC09680
(0x000001AF8A563310 0x000001AF8A583F18
0x00007FF6920964A0 0x000001AF8A532460),
llvm::ExecutionEngine::runFunctionAsMain()
+ 0x410 bytes(s),
C:\dev\llvm-project\llvm\lib\ExecutionEngine\ExecutionEngine.cpp,
line 470 + 0x65 byte(s)</p>
<p class="x_x_MsoNormal" style="">0x00007FF68DEE4200
(0x0000000000000002 0x000001AF8A5515B0
0x000001AF8A532460 0x00007FF6909C0A7D),
main() + 0x1D10 bytes(s),
C:\dev\llvm-project\llvm\tools\lli\lli.cpp,
line 614 + 0x4D byte(s)</p>
<p class="x_x_MsoNormal" style="">0x00007FF6909C1A29
(0x00007FF690C2C000 0x00007FF690C2FE30
0x0000000000000000 0x0000000000000000),
invoke_main() + 0x39 bytes(s),
d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl,
line 79</p>
<p class="x_x_MsoNormal" style="">0x00007FF6909C190E
(0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000),
__scrt_common_main_seh() + 0x12E bytes(s),
d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl,
line 288 + 0x5 byte(s)</p>
<p class="x_x_MsoNormal" style="">0x00007FF6909C17CE
(0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000),
__scrt_common_main() + 0xE bytes(s),
d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl,
line 331</p>
<p class="x_x_MsoNormal" style="">0x00007FF6909C1AB9
(0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000),
mainCRTStartup() + 0x9 bytes(s),
d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp,
line 17</p>
<p class="x_x_MsoNormal" style="">0x00007FFC76417BD4
(0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000),
BaseThreadInitThunk() + 0x14 bytes(s)</p>
<p class="x_x_MsoNormal" style="">0x00007FFC7746CED1
(0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000),
RtlUserThreadStart() + 0x21 bytes(s)</p>
<p class="x_x_MsoNormal" style=""> </p>
<p class="x_x_MsoNormal" style="">Sent from
<a
href="https://go.microsoft.com/fwlink/?LinkId=550986"
target="_blank" moz-do-not-send="true">
Mail</a> for Windows 10</p>
<p class="x_x_MsoNormal" style=""> </p>
</div>
</div>
<p class="x_x_MsoNormal">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org"
target="_blank" moz-do-not-send="true">llvm-dev@lists.llvm.org</a><br>
<a
href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev"
target="_blank" moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></p>
</blockquote>
</div>
<p class="x_x_MsoNormal"><br>
<br>
</p>
<pre>_______________________________________________</pre>
<pre>LLVM Developers mailing list</pre>
<pre><a href="mailto:llvm-dev@lists.llvm.org" moz-do-not-send="true">llvm-dev@lists.llvm.org</a></pre>
<pre><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></pre>
</blockquote>
<pre>-- </pre>
<pre><a href="https://flowcrypt.com/pub/stefan.graenitz@gmail.com" moz-do-not-send="true">https://flowcrypt.com/pub/stefan.graenitz@gmail.com</a></pre>
<p class="x_x_MsoNormal"><span
style="font-size:10.0pt; font-family:"Courier
New"; color:black"> </span></p>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="https://flowcrypt.com/pub/stefan.graenitz@gmail.com">https://flowcrypt.com/pub/stefan.graenitz@gmail.com</a></pre>
</body>
</html>