<div dir="ltr">OK, i found i've forgot to add -I for headers (not sure why they were not detected automatically somehow) and now clang-interpret output is exactly as expected.<div><br></div><div>The question is did it compile or interpreted source file?</div>
<div><br></div><div>I need to understand it as i can't launch executables in my test environment. So i'm going to copy\paste</div><div>clang-interpreter code or extract static lib to avoid ./clang-interpreter executable invocation. Just want to be sure</div>
<div>it does not execute other executables behind the scene.</div><div><br></div><div>My original idea was to interpret .cpp files in 2 steps:</div><div>1) produce .ll file using "clang -S -emit-llvm" using Driver (seems not to invoke other executables behind the scene)</div>
<div>2) interpret it using "lli" tool (copy\paste code or prepare static lib instead of executable) </div><div><br></div><div>Is using clang-interpret code similar to this 2 steps?</div><div><br></div><div>---</div>
<div><br></div><div>PS. My verbose execution:</div><div><br></div><div>







<p class="">MBA-Anton:bin asmirnov$ ./clang-interpreter /tmp/hw.cpp -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include -v</p>
<p class="">clang version 3.4 (198679)</p>
<p class="">Target: x86_64-apple-darwin13.3.0</p>
<p class="">Thread model: posix</p>
<p class="">clang invocation:</p>
<p class=""> "/Users/asmirnov/Documents/dev/src/llvm_34_local_installed2/bin/clang-interpreter" "-cc1" "-triple" "x86_64-apple-macosx10.9.0" "-fsyntax-only" "-disable-free" "-disable-llvm-verifier" "-main-file-name" "hw.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-mdisable-fp-elim" "-masm-verbose" "-munwind-tables" "-target-cpu" "core2" "-v" "-resource-dir" "/Users/asmirnov/Documents/dev/src/llvm_34_local_installed2/bin/../lib/clang/3.4" "-I" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include" "-stdlib=libc++" "-fdeprecated-macro" "-fdebug-compilation-dir" "/Users/asmirnov/Documents/dev/src/llvm_34_local_installed2/bin" "-ferror-limit" "19" "-fmessage-length" "100" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx-10.9.0" "-fencode-extended-block-signature" "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-vectorize-slp" "-x" "c++" "/tmp/hw.cpp"</p>

<p class=""><br></p>
<p class="">clang -cc1 version 3.4 based upon LLVM 3.4svn default target x86_64-apple-darwin13.3.0</p>
<p class="">ignoring nonexistent directory "/Users/asmirnov/Documents/dev/src/llvm_34_local_installed2/bin/../include/c++/v1"</p>
<p class="">ignoring nonexistent directory "/usr/include/c++/v1"</p>
<p class="">ignoring nonexistent directory "/usr/include"</p>
<p class="">#include "..." search starts here:</p>
<p class="">#include <...> search starts here:</p>
<p class=""> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include</p>
<p class=""> /usr/local/include</p>
<p class=""> /Users/asmirnov/Documents/dev/src/llvm_34_local_installed2/bin/../lib/clang/3.4/include</p>
<p class=""> /System/Library/Frameworks (framework directory)</p>
<p class=""> /Library/Frameworks (framework directory)</p>
<p class="">End of search list.</p>
<p class="">hello world</p></div><div>---</div><div><br></div><div>Regards, Anton.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-08-19 13:21 GMT+06:00 Anton Smirnov <span dir="ltr"><<a href="mailto:dev@antonsmirnov.name" target="_blank">dev@antonsmirnov.name</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi.<div><br></div><div>I'm testing llvm/clang release 3.4 and i'm having clang-interpreter issue - headers are not found. But i can compile with clang without problems.</div>
<div><br></div><div>I'm not sure if the issue relates to the trunk/3.5 RC as i need the latest release available.</div>
<div><br></div><div>Please let me know if i miss smth.</div><div><br></div><div>







<p>// test file (hello world)</p><p>MBA-Anton:bin asmirnov$ cat /tmp/hw.cpp </p>
<p>#include <stdio.h></p>
<p><br></p>
<p>int main() {</p>
<p><span>   </span>printf("hello world\n");</p>
<p><span>   </span>return 1;</p>
<p>}</p>
<p>// default compiler info</p><p>MBA-Anton:bin asmirnov$ clang -v</p>
<p>Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)</p>
<p>Target: x86_64-apple-darwin13.3.0</p>
<p>Thread model: posix</p><p><br></p><p>// compile test file with clang</p>
<p>MBA-Anton:bin asmirnov$ clang /tmp/hw.cpp -o /tmp/hw</p><p>// run to test</p>
<p>MBA-Anton:bin asmirnov$ /tmp/hw</p>
<p>hello world</p>
<p>// where clang is?</p><p>MBA-Anton:bin asmirnov$ which clang</p>
<p>/usr/bin/clang</p>

<p><br></p><p>// test clang-interpreter (expected to be translated and launched)</p><p>MBA-Anton:bin asmirnov$ ./clang-interpreter /tmp/hw.cpp</p>
<p>/tmp/hw.cpp:1:10: <span>fatal error: </span>'stdio.h' file not found</p>
<p>#include <stdio.h></p>
<p>         ^</p>
<p>1 error generated.</p><p>---</p><p>Also i don't understand actually if it tries to compile the file first (and i expect it to interpret the source file):</p><p><br></p><p>
MBA-Anton:bin asmirnov$ ./clang-interpreter /tmp/hw.cpp -v</p><p>clang version 3.4 (198679)</p><p>Target: x86_64-apple-darwin13.3.0</p><p>Thread model: posix</p><p>clang invocation:</p>
<p> "/Users/asmirnov/Documents/dev/src/llvm_34_local_installed2/bin/clang-interpreter" "-cc1" "-triple" "x86_64-apple-macosx10.9.0" "-fsyntax-only" "-disable-free" "-disable-llvm-verifier" "-main-file-name" "hw.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-mdisable-fp-elim" "-masm-verbose" "-munwind-tables" "-target-cpu" "core2" "-v" "-resource-dir" "/Users/asmirnov/Documents/dev/src/llvm_34_local_installed2/bin/../lib/clang/3.4" "-stdlib=libc++" "-fdeprecated-macro" "-fdebug-compilation-dir" "/Users/asmirnov/Documents/dev/src/llvm_34_local_installed2/bin" "-ferror-limit" "19" "-fmessage-length" "100" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx-10.9.0" "-fencode-extended-block-signature" "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-vectorize-slp" "-x" "c++" "/tmp/hw.cpp"</p>

<p><br></p><p>clang -cc1 version 3.4 based upon LLVM 3.4svn default target x86_64-apple-darwin13.3.0</p><p>ignoring nonexistent directory "/Users/asmirnov/Documents/dev/src/llvm_34_local_installed2/bin/../include/c++/v1"</p>

<p>ignoring nonexistent directory "/usr/include/c++/v1"</p><p>ignoring nonexistent directory "/usr/include"</p><p>#include "..." search starts here:</p><p>
#include <...> search starts here:</p><p> /usr/local/include</p><p> /Users/asmirnov/Documents/dev/src/llvm_34_local_installed2/bin/../lib/clang/3.4/include</p><p> /System/Library/Frameworks (framework directory)</p>

<p> /Library/Frameworks (framework directory)</p><p>End of search list.</p><p>/tmp/hw.cpp:1:10: <span>fatal error: </span>'stdio.h' file not found</p><p>#include <stdio.h></p>
<p>         ^</p><p>




























</p><p>1 error generated.</p><p><br></p><p>Regards, Anton.</p></div></div>
</blockquote></div><br></div>