<div dir="ltr">Thanks, Tim.<div><br></div><div>You are right, it's using macOS' stdio.h, which is a terrible idea.</div><div><br></div><div>Clang docs on --sysroot:</div><div><br></div><div><font face="courier new, monospace">When you have extracted your cross-compiler from a zip file into a directory, you have to use --sysroot=<path>. The path is the root directory where you have unpacked your file, and Clang will look for the directories bin, lib, include in there.<br></font></div><div><br></div><div>I have a silly question: where can I download the mentioned zip file with all <font face="courier new, monospace">bin</font>, <font face="courier new, monospace">lib</font>, and <font face="courier new, monospace">include</font> files for x64 Linux target?</div><div><br></div><div>So far I've been copying files one by one (<span style="font-family:"courier new",monospace">/lib64/ld-linux-x86-64.so.2 /usr/lib/x86_64-linux-gnu/</span><span style="font-family:"courier new",monospace">crt1.o /usr/lib/x86_64-linux-gnu/</span><span style="font-family:"courier new",monospace">crti.o</span><font face="arial, sans-serif">, etc) and it's been a painful process.</font></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 7, 2019 at 9:34 PM Tim Northover <<a href="mailto:t.p.northover@gmail.com">t.p.northover@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Ivan,<br>
<br>
On Fri, 7 Jun 2019 at 11:19, Ivan Medoedov via llvm-dev<br>
<<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> LLD 8.0.0 (compatible with GNU linkers)<br>
> ld.lld: error: undefined symbol: _fopen<br>
> >>> referenced by fopen.c<br>
> >>> test.o:(main)<br>
<br>
I suspect you're getting the macOS version of stdio.h, which makes<br>
fopen some kind of alias. You really should use a sysroot when<br>
cross-compiling, though you *might* get away with just<br>
-I/path/to/linux/usr/include. Just what you've copied across might<br>
well be sufficient to use with --sysroot.<br>
<br>
Cheers.<br>
<br>
Tim.<br>
</blockquote></div>