<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 22, 2017 at 10:29 AM, Martin J. O'Riordan via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-IE"><div class="gmail-m_4479191712290079065WordSection1"><p class="MsoNormal"><span style="font-size:12pt;font-family:"book antiqua",serif;color:black">Our out-of-tree LLVM compiler is configured and built on Linux, but I cannot get it to run under the Windows 10 Linux Subsystem.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"book antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"book antiqua",serif;color:black">When run in this context it reports a crash:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"book antiqua",serif;color:black"><u></u> <u></u></span></p><p class="gmail-m_4479191712290079065MsoPlainText" style="margin-left:36pt">warning: Error disabling address space randomisation: Success<u></u><u></u></p><p class="gmail-m_4479191712290079065MsoPlainText" style="margin-left:36pt">warning: linux_ptrace_test_ret_to_nx: PTRACE_KILL waitpid returned -1: <u></u><u></u></p><p class="gmail-m_4479191712290079065MsoPlainText" style="margin-left:36pt">Interrupted system call<u></u><u></u></p><p class="gmail-m_4479191712290079065MsoPlainText" style="margin-left:36pt"><u></u> </p></div></div></blockquote><div><br></div><div><span style="color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,"segoe ui",helvetica,arial,sans-serif,"apple color emoji","segoe ui emoji","segoe ui symbol";font-size:14px">The above messages are due to a bug in how windows handles ptrace(PTRACE_GETSIGINFO). I think if you downgrade gdb you might not see this error. Does it still segfault when you don't run it in the debugger? Can you do your compile with "-###" and see the "clang -cc1" command and run that one separately?</span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-IE"><div class="gmail-m_4479191712290079065WordSection1"><p class="gmail-m_4479191712290079065MsoPlainText" style="margin-left:36pt"><u></u></p><p class="gmail-m_4479191712290079065MsoPlainText" style="margin-left:36pt">Program received signal SIGSEGV, Segmentation fault.<u></u><u></u></p><p class="gmail-m_4479191712290079065MsoPlainText" style="margin-left:36pt">0x0000000003b31e1b in __ctype_init ()<u></u><u></u></p><p class="gmail-m_4479191712290079065MsoPlainText" style="margin-left:36pt">(gdb) bt<u></u><u></u></p><p class="gmail-m_4479191712290079065MsoPlainText" style="margin-left:36pt">#0 0x0000000003b31e1b in __ctype_init ()<u></u><u></u></p><p class="gmail-m_4479191712290079065MsoPlainText" style="margin-left:36pt">#1 0x0000000003b2ed4e in __libc_start_main ()<u></u><u></u></p><p class="gmail-m_4479191712290079065MsoPlainText" style="margin-left:36pt">#2 0x00000000004022ad in _start ()<u></u><u></u></p><p class="gmail-m_4479191712290079065MsoPlainText" style="margin-left:36pt">(gdb) list<u></u><u></u></p><p class="gmail-m_4479191712290079065MsoPlainText" style="margin-left:36pt">302<u></u><u></u></p><p class="gmail-m_4479191712290079065MsoPlainText" style="margin-left:36pt"><<i>myPathTo</i>>/llvm/tools/clang/<wbr>tools/driver/driver.cpp: <u></u><u></u></p><p class="gmail-m_4479191712290079065MsoPlainText" style="margin-left:36pt">No such file or directory.<u></u><u></u></p><p class="gmail-m_4479191712290079065MsoPlainText" style="margin-left:36pt">(gdb)<u></u><u></u></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"book antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"book antiqua",serif;color:black">However, the Linux version from the LLVM website works perfectly, so it must be something to do with how I am configuring LLVM. The following are the OS and tool versions I am using:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"book antiqua",serif;color:black"><u></u> </span></p></div></div></blockquote><div><br></div><div>Would it work any better if you tried building the compiler natively with this unique configuration on WSL? If it did it might help you isolate the problem.</div><div><br></div><div>Also, Microsoft looks like they have a history of reviewing and addressing compatibility bugs just like this one on their GH repo. </div><div><br></div><div>e.g. <a href="https://github.com/Microsoft/BashOnWindows/issues/1373">https://github.com/Microsoft/BashOnWindows/issues/1373</a></div><div><br></div><div>Sometimes it comes down to them not quite supporting a particular critical syscall quite the same way it behaves on linux.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-IE"><div class="gmail-m_4479191712290079065WordSection1"><p class="MsoNormal"><span style="font-size:12pt;font-family:"book antiqua",serif;color:black"><u></u></span></p><p class="gmail-m_4479191712290079065MsoListParagraph"><u></u><span style="font-size:12pt;font-family:symbol;color:black"><span>·<span style="font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:7pt;line-height:normal;font-family:"times new roman""> </span></span></span><u></u><span style="font-size:12pt;font-family:"book antiqua",serif;color:black">CentOS Linux release 7.1.1503 (Core)<u></u><u></u></span></p><p class="gmail-m_4479191712290079065MsoListParagraph"><u></u><span style="font-size:12pt;font-family:symbol;color:black"><span>·<span style="font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:7pt;line-height:normal;font-family:"times new roman""> </span></span></span><u></u><span style="font-size:12pt;font-family:"book antiqua",serif;color:black">gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)<u></u><u></u></span></p><p class="gmail-m_4479191712290079065MsoListParagraph"><u></u><span style="font-size:12pt;font-family:symbol;color:black"><span>·<span style="font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:7pt;line-height:normal;font-family:"times new roman""> </span></span></span><u></u><span style="font-size:12pt;font-family:"book antiqua",serif;color:black">cmake version 3.5.2<u></u><u></u></span></p><p class="gmail-m_4479191712290079065MsoListParagraph"><u></u><span style="font-size:12pt;font-family:symbol;color:black"><span>·<span style="font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:7pt;line-height:normal;font-family:"times new roman""> </span></span></span><u></u><span style="font-size:12pt;font-family:"book antiqua",serif;color:black">GNU Make 3.82<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"book antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"book antiqua",serif;color:black">and I am configuring with the following options:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"book antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36pt"><span style="font-size:12pt;font-family:"courier new";color:black">mkdir -p build/linux64<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36pt"><span style="font-size:12pt;font-family:"courier new";color:black">cd build/linux64<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36pt"><span style="font-size:12pt;font-family:"courier new";color:black">cmake -Wno-dev -G “Unix Makefiles” ../../llvm \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:72pt"><span style="font-size:12pt;font-family:"courier new";color:black">"-DCMAKE_BUILD_TYPE:STRING=<wbr>Debug" \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:72pt"><span style="font-size:12pt;font-family:"courier new";color:black">"-DCMAKE_INSTALL_PREFIX:<wbr>STRING=$(CLANG_INSTALL_ROOT)/<wbr>Debug" \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:72pt"><span style="font-size:12pt;font-family:"courier new";color:black;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:yellow">"-DCMAKE_EXE_EXPORTS_C_FLAG:<wbr>STRING=" \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:72pt"><span style="font-size:12pt;font-family:"courier new";color:black;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:yellow">"-DCMAKE_EXE_EXPORTS_CXX_FLAG:<wbr>STRING=" \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:72pt"><span style="font-size:12pt;font-family:"courier new";color:black;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:yellow">"-DCMAKE_EXE_LINKER_FLAGS:<wbr>STRING=-static-libgcc -static-libstdc++ -static" \</span><span style="font-size:12pt;font-family:"courier new";color:black"><u></u><u></u></span></p><p class="MsoNormal" style="margin-left:72pt"><span style="font-size:12pt;font-family:"courier new";color:black">-DLLVM_TARGETS_TO_BUILD="<wbr>OURTARGET" \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:72pt"><span style="font-size:12pt;font-family:"courier new";color:black">-DLLVM_DEFAULT_TARGET_TRIPLE=<wbr>ourtarget<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"book antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"book antiqua",serif;color:black">Only the <span style="background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:yellow">highlighted</span> options are perhaps unusual as I need to build with statically linked GCC libraries, and the ‘</span><span style="font-size:12pt;font-family:"courier new";color:black">DCMAKE_EXE_EXPORTS</span><span style="font-size:12pt;font-family:"book antiqua",serif;color:black">’ flags were required to prevent another problem with dynamic libraries, though I have forgotten what this was now.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"book antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"book antiqua",serif;color:black">The resulting compiler works perfectly on Linux, but when I run the same binary in the Windows 10 Linux Subsystem, I get the crash report above.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"book antiqua",serif;color:black"><br></span></p></div></div></blockquote><div><br></div>It's always a good idea to make sure your environment matches when you're comparing two different systems. "env -i clang++ test_case.cpp" on both can help neutralize any funny business that might creep in.</div>
</div></div>