<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’m building for an embedded system, this is working fine with gcc 5.2.0, but I’ve become interested in clang.  In 3.9.1 everything builds fine (once I fixed the real bugs – thank you to everyone who wrote useful warnings).  I’m interested
 in trying clang 6.0.0, and there things don’t build.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The first error I get is is from cmake:<o:p></o:p></p>
<p class="MsoNormal">    [2/2] Linking C executable cmTC_03cd5<o:p></o:p></p>
<p class="MsoNormal">FAILED: cmTC_03cd5 <o:p></o:p></p>
<p class="MsoNormal">    : && /opt/jdx/tools//usr/local/share/icecc/bin//clang --sysroot=/home/user/repo/jdx/wr8-baytrail_64/buildbox -fno-omit-frame-pointer -gsplit-dwarf -fdiagnostics-color=always --target=x86_64-wrs-linux  --sysroot=/home/repo/jdx/wr8-baytrail_64/buildbox
 -rdynamic -O2 -L/home/repo/jdx/wr8-baytrail_64/buildbox/usr/local/lib -Wl,--gdb-index -lrt -lpthread -Wl,--disable-new-dtags CMakeFiles/cmTC_03cd5.dir/testCCompiler.c.o  -o cmTC_03cd5   && :<o:p></o:p></p>
<p class="MsoNormal">/opt/jdx/tools/sysroots/x86_64-wrlinuxsdk-linux/usr/bin/x86_64-wrs-linux/x86_64-wrs-linux-ld: error: cannot open crtbegin.o: No such file or directory<o:p></o:p></p>
<p class="MsoNormal">/opt/jdx/tools/sysroots/x86_64-wrlinuxsdk-linux/usr/bin/x86_64-wrs-linux/x86_64-wrs-linux-ld: error: cannot open crtend.o: No such file or directory<o:p></o:p></p>
<p class="MsoNormal">    /opt/jdx/tools/sysroots/x86_64-wrlinuxsdk-linux/usr/bin/x86_64-wrs-linux/x86_64-wrs-linux-ld: error: cannot find -lgcc<o:p></o:p></p>
<p class="MsoNormal">    /opt/jdx/tools/sysroots/x86_64-wrlinuxsdk-linux/usr/bin/x86_64-wrs-linux/x86_64-wrs-linux-ld: error: cannot find -lgcc<o:p></o:p></p>
<p class="MsoNormal">    clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">crtbegin.o is in /home/repo/jdx/wr8-baytrail_64/buildbox/usr/lib64/x86_64-wrs-linux/5.2.0/crtbegin.o When I copy the missing files to /home/repo/jdx/wr8-baytrail_64/buildbox/usr/lib64 cmake passes and but the build fails on unable to find
 <string> and <vector>, I started to add include paths for jdx/wr8-baytrail_64/buildbox/usr/include/c++/5.2.0/ and that gets farther.  However it is time to stop hacking the wrong way and fix the real problem. I suspect the problem is related to clang not understanding
 my --target option and thus not asking gcc for the paths to the missing files, but I don’t really know how to make this work. 
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">A search finds <a href="https://stackoverflow.com/questions/4160262/clang-linker-problem">
https://stackoverflow.com/questions/4160262/clang-linker-problem</a>, but it isn’t helpful because the code in that area has changed so much.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My host is x86-64 linux.  The target OS is x86_64 embedded linux (the sysroot is NOT compatible with the host libraries)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Can someone give me a hint about where I should look to make this work. I can change either the command line arguments or the clang source code but I’m not clear on where the right place to look is.<o:p></o:p></p>
</div>
</body>
</html>