<div class="gmail_quote">On Thu, May 24, 2012 at 9:31 PM, Chetan Jhurani <span dir="ltr"><<a href="mailto:chetan.jhurani@gmail.com" target="_blank">chetan.jhurani@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">I faced a similar problem when using -x argument with nvcc during<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">petsc configuration, which could be fixed if CFLAGS was not passed<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">to the linker. So sending this info in case it is useful.</span></p>
</div></div></blockquote><div><br></div><div>So in general, CFLAGS must be passed to the linker (it contains optimization and debugging stuff that should be consistent). The -x option is very special in that it cannot be passed to the linker.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif""><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif""><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">[jhurani@enrico ~]$ cat a.c<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">int main()<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">{<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">}<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">[jhurani@enrico ~]$ nvcc a.c -x c++ -c<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">[jhurani@enrico ~]$ nvcc a.o -x c++<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">a.o:1: error: stray '\177' in program<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">a.o:1: error: stray '\2' in program<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">a.o:1: error: stray '\1' in program<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">a.o:1: error: stray '\1' in program<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">a.o:1:8: warning: null character(s) ignored<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">a.o:1: error: stray '\1' in program<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">a.o:1:18: warning: null character(s) ignored<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">and many more lines…<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif"">Chetan<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Verdana","sans-serif""><u></u> <u></u></span></p><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"><div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:petsc-dev-bounces@mcs.anl.gov" target="_blank">petsc-dev-bounces@mcs.anl.gov</a> [mailto:<a href="mailto:petsc-dev-bounces@mcs.anl.gov" target="_blank">petsc-dev-bounces@mcs.anl.gov</a>] <b>On Behalf Of </b>Jed Brown<br>
<b>Sent:</b> Thursday, May 24, 2012 7:09 PM<br><b>To:</b> For users of the development version of PETSc<br><b>Subject:</b> [petsc-dev] Need a CFLAGS that does is *not* included in the link<u></u><u></u></span></p></div></div>
<div class="im"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Building PETSc with clang++ produces a warning about compiling *.c as C++ being deprecated. To silence the warning, we would need to pass "-x c++" to the compiler, but NOT to the linker. CFLAGS is currently also passed to the linker. Is this something we want to fix?<u></u><u></u></p>
<div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Clang used to SEGV when "-x c++" is passed to the linker. Now (latest SVN) it just interprets the object file as C++ source (which obviously produces a ton of garbage).<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><a href="http://llvm.org/bugs/show_bug.cgi?id=12924" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=12924</a><u></u><u></u></p></div>
</div></div></div></div></blockquote></div><br>