<div dir="ltr"><div dir="ltr">On Mon, 7 Sep 2020 at 17:18, Simone Atzeni <<a href="mailto:satzeni@nvidia.com">satzeni@nvidia.com</a>> wrote:<br></div><div class="gmail_quote"><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-US">
<div class="gmail-m_-2555161971481114609WordSection1">
<p class="MsoNormal">Thanks Csaba and Richard.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I understand now, indeed if I add a “#define complex _Complex”, it compiles.<u></u><u></u></p>
<p class="MsoNormal">I can’t understand why before adding the define, it worked with Clang 5 and fails with Clang 8, though. Looks like this behavior changed after clang 5 (not sure about the exact version).</p></div></div></blockquote><div><br></div><div>This probably means that your system didn't have a C++ <complex.h> that Clang could find before, and so the C <complex.h> was picked up instead.</div><div> </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-US"><div class="gmail-m_-2555161971481114609WordSection1">
<p class="MsoNormal">Thanks.<u></u><u></u></p>
<p class="MsoNormal">Simone<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>> <br>
<b>Sent:</b> Monday, September 7, 2020 4:21 PM<br>
<b>To:</b> Simone Atzeni <<a href="mailto:satzeni@nvidia.com" target="_blank">satzeni@nvidia.com</a>><br>
<b>Cc:</b> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [cfe-dev] Can't compile C++ complex type number example after building Clang with non-standard gcc installation (AARCH64)<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<table border="1" cellpadding="0" style="background:rgb(255,235,156)">
<tbody>
<tr>
<td style="padding:0.75pt">
<p class="MsoNormal"><b><span style="font-size:7.5pt;font-family:Verdana,sans-serif;color:black">External email: Use caution opening links or attachments</span></b><span style="font-size:7.5pt;font-family:Verdana,sans-serif;color:black">
</span><u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal">On Mon, 7 Sep 2020, 14:27 Simone Atzeni via cfe-dev, <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">Hi,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I built Clang using my own build of gcc-7.4.0.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">My cmake command looks like this:<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">toolchain=/path/to/gcc-7.4.0/install</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">CC=${toolchain}/bin/gcc                                                      
</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">CXX=${toolchain}/bin/g++                                                     
</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">cmake -G "Ninja"                                                             
</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">-DGCC_INSTALL_PREFIX=${toolchain}                                            
</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">-DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,${toolchain}/lib64 -L${toolchain}/lib64"  
</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">-DTARGET_TRIPLE=aarch64-unknown-linux-gnu                                    
</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">-DCMAKE_INSTALL_PREFIX="${install_dir}"                                      
</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">-DCMAKE_BUILD_TYPE="Release"                                                 
</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">-DLLVM_ENABLE_PROJECTS="clang;compiler-rt"                                   
</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">${src}  
</span><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Then when I try to compile this example:<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">$ cat complex.cpp</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">#include <complex.h></span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New""> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">int main()</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">{</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">    typedef float complex kmp_cmplx32;</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">}</span><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I get the the error below.<u></u><u></u></p>
<p class="MsoNormal">The include paths used by clang have `complex.h`, etc. The same example in “C” compiles fine.<u></u><u></u></p>
<p class="MsoNormal">What am I missing?<u></u><u></u></p>
</div>
</div>
</blockquote>
</div>
<div>
<p class="MsoNormal"><complex.h> in C++ has nothing to do with <complex.h> in C, and in particular does not define a "complex" macro expanding to _Complex.<u></u><u></u></p>
</div>
<div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">Thanks!<u></u><u></u></p>
<p class="MsoNormal">Simone<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">$ /home/sw/thirdparty/llvm-project/install/Linux_aarch64/llvm-8.0/bin/clang++  complex.cpp -v</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">clang version 8.0.1</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">Target: aarch64-unknown-linux-gnu</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">Thread model: posix</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">InstalledDir: /home/sw/thirdparty/llvm-project/install/Linux_aarch64/llvm-8.0/bin</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">Found candidate GCC installation: /home/sw/thirdparty/llvm-project/toolchains/install/Linux_aarch64/gcc-7.4.0/lib/gcc/aarch64-unknown-linux-gnu/7.4.0</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">Selected GCC installation: /home/sw/thirdparty/llvm-project/toolchains/install/Linux_aarch64/gcc-7.4.0/lib/gcc/aarch64-unknown-linux-gnu/7.4.0</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">Candidate multilib: .;@m64</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">Selected multilib: .;@m64</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">"/home/sw/thirdparty/llvm-project/install/Linux_aarch64/llvm-8.0/bin/clang-8" -cc1 -triple aarch64-unknown-linux-gnu -emit-obj
 -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name complex.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu generic -target-feature
 +neon -target-abi aapcs -fallow-half-arguments-and-returns -dwarf-column-info -debugger-tuning=gdb -v -resource-dir /home/sw/thirdparty/llvm-project/install/Linux_aarch64/llvm-8.0/lib/clang/8.0.1 -internal-isystem /home/sw/thirdparty/llvm-project/toolchains/install/Linux_aarch64/gcc-7.4.0/lib/gcc/aarch64-unknown-linux-gnu/7.4.0/../../../../include/c++/7.4.0
 -internal-isystem /home/sw/thirdparty/llvm-project/toolchains/install/Linux_aarch64/gcc-7.4.0/lib/gcc/aarch64-unknown-linux-gnu/7.4.0/../../../../include/c++/7.4.0/aarch64-unknown-linux-gnu -internal-isystem /home/sw/thirdparty/llvm-project/toolchains/install/Linux_aarch64/gcc-7.4.0/lib/gcc/aarch64-unknown-linux-gnu/7.4.0/../../../../include/c++/7.4.0/backward
 -internal-isystem /usr/local/include -internal-isystem /home/sw/thirdparty/llvm-project/install/Linux_aarch64/llvm-8.0/lib/clang/8.0.1/include -internal-externc-isystem /usr/include/aarch64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem
 /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/satzeni -ferror-limit 19 -fmessage-length 191 -fno-signed-char -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/complex-b60b10.o -x c++ complex.cpp
 -faddrsig</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">clang -cc1 version 8.0.1 based upon LLVM 8.0.1 default target aarch64-unknown-linux-gnu</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">ignoring nonexistent directory "/include"</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">#include "..." search starts here:</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">#include <...> search starts here:</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">/home/sw/thirdparty/llvm-project/toolchains/install/Linux_aarch64/gcc-7.4.0/lib/gcc/aarch64-unknown-linux-gnu/7.4.0/../../../../include/c++/7.4.0</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">/home/sw/thirdparty/llvm-project/toolchains/install/Linux_aarch64/gcc-7.4.0/lib/gcc/aarch64-unknown-linux-gnu/7.4.0/../../../../include/c++/7.4.0/aarch64-unknown-linux-gnu</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">/home/sw/thirdparty/llvm-project/toolchains/install/Linux_aarch64/gcc-7.4.0/lib/gcc/aarch64-unknown-linux-gnu/7.4.0/../../../../include/c++/7.4.0/backward</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">/usr/local/include</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">/home/sw/thirdparty/llvm-project/install/Linux_aarch64/llvm-8.0/lib/clang/8.0.1/include</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">/usr/include/aarch64-linux-gnu</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">/usr/include</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">End of search list.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">complex.cpp:5:26: error: expected ';' at end of declaration</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">    typedef float complex kmp_cmplx32;</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">                         ^</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">                         ;</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">1 error generated.</span><u></u><u></u></p>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
</div>
</div>

</blockquote></div></div>