<div dir="ltr">When running ./pro the program works as expected, but when the .so file is recompiled ./pro does not show any change. Change occurs only when the makefile is rerun. When moving ${LIBS} before ${PETSC_LIB} there is no change as well.<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 21 October 2013 21:19, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
   Please always make sure to include the mailing list in your list of emails. Otherwise it just goes to me, and I don't know what I am talking about.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
   Barry<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Oct 21, 2013, at 3:18 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
<br>
><br>
>   What happens when you run<br>
><br>
> ./pro<br>
><br>
> ?<br>
><br>
>  Try putting ${LIBS}  before the ${PETSC_LIB}  in the makefile<br>
><br>
>   Barry<br>
><br>
><br>
> On Oct 21, 2013, at 3:10 PM, Anthony Vergottis <<a href="mailto:a.vergottis@ucl.ac.uk">a.vergottis@ucl.ac.uk</a>> wrote:<br>
><br>
>> OK this is the makefile,<br>
>><br>
>> include ${PETSC_DIR}/conf/variables<br>
>> include ${PETSC_DIR}/conf/rules<br>
>> LIBS=-L/home/adonis/Dropbox/ParallelSolver -Wl,-rpath,/home/adonis/Dropbox/ParallelSolver -lpro<br>
>><br>
>><br>
>> pro: pro.o 2D_CBS_Solver.o<br>
>>            ${CLINKER} -o pro pro.o 2D_CBS_Solver.o ${PETSC_LIB} ${LIBS}<br>
>>            ${RM} pro.o 2D_CBS_Solver.o<br>
>><br>
>><br>
>> The terminal output (in bold are my commands),<br>
>><br>
>> adonis@LinuxBox:~/Dropbox/ParallelSolver$ g++ -shared -fPIC -o libpro.so 2D_CBS_Solver.cpp<br>
>> adonis@LinuxBox:~/Dropbox/ParallelSolver$ ls -l<br>
>> total 84<br>
>> -rw-rw-r-- 1 adonis adonis   144 Oct 21 20:56 2D_CBS_Solver.cpp<br>
>> -rw-rw-r-- 1 adonis adonis   144 Oct 21 20:50 2D_CBS_Solver.cpp~<br>
>> -rw-rw-r-- 1 adonis adonis   429 Oct 21 19:13 2D_CBS_Solver.h<br>
>> drwxrwxr-x 2 adonis adonis  4096 Oct 18 14:31 include<br>
>> -rwxrwxr-x 1 adonis adonis  7968 Oct 21 21:02 libpro.so<br>
>> -rw------- 1 adonis adonis   291 Oct 21 21:01 Makefile<br>
>> -rw------- 1 adonis adonis   291 Oct 21 21:01 Makefile~<br>
>> -rwxrwxr-x 1 adonis adonis 42896 Oct 21 21:02 pro<br>
>> -rw-rw-r-- 1 adonis adonis   940 Oct 21 20:42 pro.cpp<br>
>> drwxrwxr-x 2 adonis adonis  4096 Oct 21 20:54 Solvers<br>
>> adonis@LinuxBox:~/Dropbox/ParallelSolver$ file libpro.so<br>
>> libpro.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0x928d227f5816b3de3329f4364a688b6146df8c60, not stripped<br>
>> adonis@LinuxBox:~/Dropbox/ParallelSolver$ make pro<br>
>> /home/adonis/Documents/petsc-3.4.2/linux-gnu-c-debug/bin/mpicxx -o pro.o -c -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -g  -fPIC    -I/home/adonis/Documents/petsc-3.4.2/include -I/home/adonis/Documents/petsc-3.4.2/linux-gnu-c-debug/include    -D__INSDIR__= pro.cpp<br>

>> /home/adonis/Documents/petsc-3.4.2/linux-gnu-c-debug/bin/mpicxx -o 2D_CBS_Solver.o -c -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -g  -fPIC    -I/home/adonis/Documents/petsc-3.4.2/include -I/home/adonis/Documents/petsc-3.4.2/linux-gnu-c-debug/include    -D__INSDIR__= 2D_CBS_Solver.cpp<br>

>> /home/adonis/Documents/petsc-3.4.2/linux-gnu-c-debug/bin/mpicxx -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -g  -o pro pro.o 2D_CBS_Solver.o -Wl,-rpath,/home/adonis/Documents/petsc-3.4.2/linux-gnu-c-debug/lib -L/home/adonis/Documents/petsc-3.4.2/linux-gnu-c-debug/lib  -lpetsc -Wl,-rpath,/home/adonis/Documents/petsc-3.4.2/linux-gnu-c-debug/lib -lflapack -lfblas -lX11 -lpthread -lparmetis -lmetis -lm -Wl,-rpath,/usr/lib/gcc/x86_64-linux-gnu/4.6 -L/usr/lib/gcc/x86_64-linux-gnu/4.6 -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/lib/x86_64-linux-gnu -L/lib/x86_64-linux-gnu -lmpichf90 -lgfortran -lm -lgfortran -lm -lquadmath -lm -lmpichcxx -lstdc++ -ldl -lmpich -lopa -lmpl -lrt -lpthread -lgcc_s -ldl  -L/home/adonis/Dropbox/ParallelSolver -Wl,-rpath,/home/adonis/Dropbox/ParallelSolver -lpro<br>

>> /bin/rm -f pro.o 2D_CBS_Solver.o<br>
>> adonis@LinuxBox:~/Dropbox/ParallelSolver$ ldd pro<br>
>>    linux-vdso.so.1 =>  (0x00007fff1dffe000)<br>
>>    libpetsc.so => /home/adonis/Documents/petsc-3.4.2/linux-gnu-c-debug/lib/libpetsc.so (0x00007f24f4da6000)<br>
>>    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f24f4b88000)<br>
>>    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f24f4888000)<br>
>>    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f24f4672000)<br>
>>    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f24f42b2000)<br>
>>    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f24f3f7d000)<br>
>>    libparmetis.so => /home/adonis/Documents/petsc-3.4.2/linux-gnu-c-debug/lib/libparmetis.so (0x00007f24f3d2f000)<br>
>>    libgfortran.so.3 => /usr/lib/x86_64-linux-gnu/libgfortran.so.3 (0x00007f24f3a17000)<br>
>>    libmpich.so.10 => /home/adonis/Documents/petsc-3.4.2/linux-gnu-c-debug/lib/libmpich.so.10 (0x00007f24f364b000)<br>
>>    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f24f3447000)<br>
>>    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f24f314a000)<br>
>>    /lib64/ld-linux-x86-64.so.2 (0x00007f24f6176000)<br>
>>    libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f24f2f2c000)<br>
>>    libmetis.so => /home/adonis/Documents/petsc-3.4.2/linux-gnu-c-debug/lib/libmetis.so (0x00007f24f2cb0000)<br>
>>    libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f24f2a7a000)<br>
>>    libmpl.so.1 => /home/adonis/Documents/petsc-3.4.2/linux-gnu-c-debug/lib/libmpl.so.1 (0x00007f24f2875000)<br>
>>    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f24f266c000)<br>
>>    libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f24f2469000)<br>
>>    libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f24f2263000)<br>
>><br>
>><br>
>> I hope this helps and is more clear. The  libpro.so object for some reason is not being linked.<br>
>><br>
>> Thanks<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> On 21 October 2013 20:56, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
>><br>
>>  Please cut and paste everything you've done in this process, the make, the running of ldd etc<br>
>><br>
>>   Barry<br>
>><br>
>> On Oct 21, 2013, at 2:53 PM, Anthony Vergottis <<a href="mailto:a.vergottis@ucl.ac.uk">a.vergottis@ucl.ac.uk</a>> wrote:<br>
>><br>
>>> Thanks for the replies. Unfortunatly this has still not worked. When using the ldd command the shared library libpro.so is not listed there. Any other ideas why this may be not linking?<br>
>>><br>
>>> Thanks again.<br>
>>><br>
>>><br>
>>> On 21 October 2013 20:35, Satish Balay <<a href="mailto:balay@mcs.anl.gov">balay@mcs.anl.gov</a>> wrote:<br>
>>> On Mon, 21 Oct 2013, Anthony Vergottis wrote:<br>
>>><br>
>>>> Dear All,<br>
>>>><br>
>>>> I was wondering how does one include a .so object when compiling with a<br>
>>>> PETSc makefile? I have made various .so object for many projects and they<br>
>>>> work properly by specifying the -L location and the -lLibrary name. But<br>
>>>> when I try to link the .so object via a PETSc make file (after compilation<br>
>>>> with no errors) the ldd command does not show the library as being linked.<br>
>>>><br>
>>>> Is there any internal behaviour of PETSc I should be aware of?  Have tried<br>
>>>> everything possible.<br>
>>>><br>
>>>> I have configure PETSc with the following flags (if this helps).<br>
>>>><br>
>>>> --download-mpich --with-clanguage=c++ --download-f-blas-lapack<br>
>>>> --download-metis --download-parmetis --with-shared-libraries=1<br>
>>>> --with-dynamic-loading=1<br>
>>>><br>
>>>> This is the sample makefile:<br>
>>>><br>
>>>> include ${PETSC_DIR}/conf/variables<br>
>>>> include ${PETSC_DIR}/conf/rules<br>
>>>> LIBS=-L/home/adonis/Dropbox/ParallelSolver -lpro<br>
>>><br>
>>> you need:<br>
>>><br>
>>> LIBS=-L/home/adonis/Dropbox/ParallelSolver -Wl,-rpath,/home/adonis/Dropbox/ParallelSolver -lpro<br>
>>><br>
>>> Satish<br>
>>><br>
>>>><br>
>>>> pro: pro.o 2D_CBS_Solver.o<br>
>>>>            ${CLINKER} -o pro pro.o 2D_CBS_Solver.o ${PETSC_LIB} ${LIBS}<br>
>>>>            ${RM} pro.o 2D_CBS_Solver.o<br>
>>>><br>
>>>> After this makefile is run still ldd does not show linkage.<br>
>>>><br>
>>>> Any help would be appreciated. Thanks in advance.<br>
>>>><br>
>>>> Best regards,<br>
>>>> Anthony<br>
>>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> Anthony Vergottis<br>
>>><br>
>>> PhD Student<br>
>>> Department of Mechanical Engineering<br>
>>> University College London<br>
>>> Gower Street<br>
>>> London<br>
>>> WC1E 6BT<br>
>>><br>
>>> E-mail: <a href="mailto:a.vergottis@ucl.ac.uk">a.vergottis@ucl.ac.uk</a><br>
>>> Tel (UK Mobile): <a href="tel:%28%2B44%29%20079%201263%200064" value="+447912630064">(+44) 079 1263 0064</a><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> --<br>
>> Anthony Vergottis<br>
>><br>
>> PhD Student<br>
>> Department of Mechanical Engineering<br>
>> University College London<br>
>> Gower Street<br>
>> London<br>
>> WC1E 6BT<br>
>><br>
>> E-mail: <a href="mailto:a.vergottis@ucl.ac.uk">a.vergottis@ucl.ac.uk</a><br>
>> Tel (UK Mobile): <a href="tel:%28%2B44%29%20079%201263%200064" value="+447912630064">(+44) 079 1263 0064</a><br>
><br>
<br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><div style="line-height:18px;color:rgb(0,0,0);font-family:Tahoma;font-size:13px">Anthony Vergottis</div><div style="line-height:18px;color:rgb(0,0,0);font-family:Tahoma;font-size:13px">
<br style="line-height:18px"></div><div style="line-height:18px;color:rgb(0,0,0);font-family:Tahoma;font-size:13px">PhD Student</div><div style="line-height:18px;color:rgb(0,0,0);font-family:Tahoma;font-size:13px"><span style="line-height:normal;font-family:Arial,sans-serif;font-size:13px">Department of Mechanical Engineering</span><br>
</div><div style="line-height:18px;color:rgb(0,0,0);font-family:Tahoma;font-size:13px"><font face="Arial,sans-serif" style="line-height:normal">University College London</font></div><div style="line-height:18px;color:rgb(0,0,0);font-family:Tahoma;font-size:13px">
<font face="Arial,sans-serif" style="line-height:normal">Gower Street</font></div><div style="line-height:18px;color:rgb(0,0,0);font-family:Tahoma;font-size:13px"><font face="Arial,sans-serif" style="line-height:normal">London </font></div>
<div style="line-height:18px;color:rgb(0,0,0);font-family:Tahoma;font-size:13px"><font face="Arial,sans-serif" style="line-height:normal">WC1E 6BT</font></div><div style="line-height:18px;color:rgb(0,0,0);font-family:Tahoma;font-size:13px">
<font face="Arial,sans-serif" style="line-height:normal"><br style="line-height:18px"></font></div><div style="line-height:18px;color:rgb(0,0,0);font-family:Tahoma;font-size:13px"><font face="Arial,sans-serif" style="line-height:normal">E-mail: </font><a href="mailto:i.stojanovic@ucl.ac.uk" style="line-height:18px;color:rgb(0,104,207)" target="_blank"><font face="Arial,sans-serif" style="line-height:normal">a.vergottis@ucl.ac.uk</font></a><font face="Arial,sans-serif" style="line-height:normal"> </font> </div>
<div style="line-height:18px;color:rgb(0,0,0);font-family:Tahoma;font-size:13px">Tel (UK Mobile): (+44) 079 1263 0064</div></div>
</div>