<div dir="ltr"><div><div>Hi Hong,<br><br></div>This Fortran/C mangling issue is a bit tricky. It has to be done during the configuration process because the C and Fortran compilers won&#39;t necessarily know how to properly mangle the function names. The thing is that it the configuration process depends on using the same compilers as any other code that links to the generated libraries. You can check out Bill Hoffman&#39;s blog at <a href="http://www.kitware.com/blog/home/post/231">http://www.kitware.com/blog/home/post/231</a> which explains this issue and how CMake handles it. Now if ParaView Catalyst was built with GCC and you built your simulation code with PGI, for example, then it wouldn&#39;t surprise me that this issue crops up. What compilers did you use for your ParaView build and your simulation code build? If they are consistent then it is a problem with CMake or ParaView&#39;s superbuild.<br>
<br></div>Regards,<br>Andy<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Sep 6, 2013 at 3:54 PM, Hong Yi <span dir="ltr">&lt;<a href="mailto:hongyi@renci.org" target="_blank">hongyi@renci.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Hi Andy,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Thanks for the useful info. You are exactly right – the problem is caused by C/Fortran mangling of the names. In the Fortran code, underbar trailing is not
 there for all catalyst-related function calls, those underbar trailing to the function names as shown in the linking errors are automatically added by C/Fortran mangling in the final linking stage. I also pulled in the Fortran example in the github repo, and
 got the similar undefined reference errors in the final linking stage when linking to the ParaView 4.0 built with superbuild. So the linking problem seems to be generic to Fortran code linking to Catalyst.
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">I checked the Catalyst static lib built with superbuild and found the lib only includes function symbols without the trailing underbar such as coprocessorinitialize,
 which explains why those undefined reference errors result. I also tried to build ParaView 3.98 with superbuild which included FortranAdaptor lib, and found the FortranAdatpor lib built with superbuild does not include the trailing underbar for coprocessor-related
 functions, while the FortranAdaptor lib built from source does include the trailing underbar, which explains why I can link our simulation code to Catalyst 3.98 built from source, but cannot successfully link to Catalyst 3.98 built with superbuild. So here
 is my question:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Should Catalyst libs built with superbuild contain those coprocessing function symbols with trailing underbar in addition to those corresponding function symbols
 without trailing underbar? Specifically, for example, I am wondering whether both coprocessorinitialize and coprocessorinitialize_ need to present so these coprocessing functions can be called from different languages including Fortran? Could you confirm whether
 this is the case? If so, I need to check my superbuild to see why those trailing underbar functions are not created in the Catalyst libs. Let me know if you, David, or anybody else can confirm whether this is the case, or offer any ideas/suggestions.<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Thanks,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Hong<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Andy Bauer [mailto:<a href="mailto:andy.bauer@kitware.com" target="_blank">andy.bauer@kitware.com</a>]
<br>
<b>Sent:</b> Friday, September 06, 2013 12:33 PM<br>
<b>To:</b> Hong Yi<br>
<b>Cc:</b> <a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a><br>
<b>Subject:</b> Re: [Paraview] Errors when linking catalyst in ParaView version 4.0.1 to simulation code on Titan<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi Hong,<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">I think it&#39;s the Fortran mangling of the names. Try taking out the underscore on the Fortran subroutine calls. Let me know if that doesn&#39;t help. Otherwise it may be an issue with how C/Fortran mangles things. The GCC behavior should be
 the following:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Fortran -&gt; call xyz()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">C -&gt; void xyz_() {...}.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">All of these methods should be available in the vtkPVCatalyst module. If you can&#39;t get it to work, try to see what you can do with the Fortran example in the github repo.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">Regards,<br>
And<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Thu, Sep 5, 2013 at 5:52 PM, Hong Yi &lt;<a href="mailto:hongyi@renci.org" target="_blank">hongyi@renci.org</a>&gt; wrote:<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">When linking our simulation code (a variant of phasta) to Catalyst in ParaView version 4.0.1 built on Titan with superbuild, I got the following
 linking errors:<br>
<br>
-----------------<br>
../../lib/libincompressible.a(itrdrv.f.o): In function `itrdrv_&#39;:<br>
itrdrv.f:(.text+0x2add): undefined reference to `coprocessorinitialize_&#39;<br>
itrdrv.f:(.text+0x6198): undefined reference to `coprocessorfinalize_&#39;<br>
itrdrv.f:(.text+0x973d): undefined reference to `coprocessorfinalize_&#39;<br>
../../lib/libincompressible.a(phastaadaptor.f.o): In function `phastacoprocessor_&#39;:<br>
phastaadaptor.f:(.text+0x84): undefined reference to `requestdatadescription_&#39;<br>
phastaadaptor.f:(.text+0x95): undefined reference to `needtocreategrid_&#39;<br>
phastaadaptor.f:(.text+0xba): undefined reference to `coprocess_&#39;<br>
/usr/bin/ld: link errors found, deleting executable `../../bin/phastaIC.exe&#39;<br>
-----------------<br>
<br>
I use CMake to link Catalyst to our simulation code. I was able to resolve those linking errors when linking to ParaView version 3.98.1 by adding &quot;find_package(ParaView 3.98 REQUIRED COMPONENTS FortranAdaptor)&quot; in addition to find_package for vtkCoProcessorImplementation
 and then link both to the final executable. However, for ParaView version 4.0.1, it seems FortranAdaptor does not exist any more which defines those functions such as coprocessorinitialize, etc. Here is the corresponding excerpt in my CMakeLists.txt related
 to linking Catalyst in ParaView version 4.0.1:<br>
-------------------<br>
if(USE_CATALYST)<br>
       find_package(ParaView 3.98 REQUIRED COMPONENTS vtkPVPythonCatalyst)<br>
        find_library(PHASTA_ADAPTOR_LIB PhastaAdaptorLib)<br>
        include(&quot;${PARAVIEW_USE_FILE}&quot;)<br>
        set(Adaptor_SRCS phastaadaptor.f)<br>
        add_library(Adaptor ${Adaptor_SRCS})<br>
        target_link_libraries(Adaptor ${PHASTA_ADAPTOR_LIB} vtkPVPythonCatalyst)<br>
        add_definitions(&quot;-DUSE_CATALYST&quot;)<br>
endif()<br>
-------------------<br>
<br>
Adaptor is then linked to the final executable. <br>
<br>
Please let me know if you have ideas on what I should do to resolve those linking errors.<br>
<br>
Many thanks,<br>
<br>
Hong<br>
<br>
<br>
<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">
http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div>
</div>

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