[petsc-users] Petscmatlabengine, libicudata not found, undefined symbol mexPrintf

Brad Aagaard baagaard at usgs.gov
Tue Feb 15 20:44:43 CST 2011


Birendra-

PyLith extracts the link flags from PETSc during the PyLith configure, 
so any libraries PETSc uses should automatically get linked into the 
PyLith Python modules and libraries. Only if these libraries end up in 
some unusual PETSc make related variable would they be missed in the 
PyLith linking. You can also run "ldd libpylith.so" in the directory 
containing libpylith.so to make sure it is finding the shared libraries.

Brad


On 2/15/11 5:56 PM, Barry Smith wrote:
>
> On Feb 15, 2011, at 6:56 PM, Birendra jha wrote:
>
>> Dear Petsc users,
>>
>> I am getting "cannot find -licudata" error during "make test" on petsc-dev, even when libicudata.so.42.1, and its link, libicudata.so.42 are in /home/bjha/MATLAB/R2010b/bin/glnx86. Petsc "make" was fine.
>
>    Run ls -l /home/bjha/MATLAB/R2010b/bin/glnx86 and send the output
> also run file  /home/bjha/MATLAB/R2010b/bin/glnx86/libicudata.so.42
>
>>
>> bjha at ubuntu:~/src/petsc-dev$ make PETSC_DIR=/home/bjha/src/petsc-dev PETSC_ARCH=linux_gcc-4.4.1_64 test
>> Running test examples to verify correct installation
>> --------------Error detected during compile or link!-----------------------
>> See http://www.mcs.anl.gov/petsc/petsc-2/documentation/faq.html
>> mpicxx -o ex19.o -c -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -g -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/home/bjha/src/petsc-dev/include -I/home/bjha/src/petsc-dev/linux_gcc-4.4.1_64/include -I/home/bjha/src/petsc-dev/include/sieve -I/home/bjha/MATLAB/R2010b/extern/include -I/home/bjha/tools/gcc-4.4.1_64/include -D__INSDIR__=src/snes/examples/tutorials/ ex19.c
>> mpicxx -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -g   -o ex19  ex19.o -L/home/bjha/src/petsc-dev/linux_gcc-4.4.1_64/lib  -lpetsc -Wl,-rpath,/home/bjha/src/petsc-dev/linux_gcc-4.4.1_64/lib -lparmetis -lmetis -Wl,-rpath,/home/bjha/MATLAB/R2010b/sys/os/glnx86:/home/bjha/MATLAB/R2010b/bin/glnx86:/home/bjha/MATLAB/R2010b/extern/lib/glnx86 -L/home/bjha/MATLAB/R2010b/bin/glnx86 -L/home/bjha/MATLAB/R2010b/extern/lib/glnx86 -leng -lmex -lmx -lmat -lut -licudata -licui18n -licuuc -lml -lchaco -L/usr/lib/atlas -llapack_atlas -llapack -latlas -lblas -L/home/bjha/tools/gcc-4.4.1_64/lib -L/usr/lib/gcc/i486-linux-gnu/4.4.3 -L/usr/lib/i486-linux-gnu -ldl -lmpi -lopen-rte -lopen-pal -lnsl -lutil -lgcc_s -lpthread -lmpi_f90 -lmpi_f77 -lgfortran -lm -lm -lm -lm -lmpi_cxx -lstdc++ -lmpi_cxx -lstdc++ -ldl -lmpi -lopen-rte -lopen-pal -lnsl -lutil -lgcc_s -lpthread -ldl
>> /usr/bin/ld: cannot find -licudata
>> collect2: ld returned 1 exit status
>> make[3]: [ex19] Error 1 (ignored)
>> /bin/rm -f ex19.o
>> --------------Error detected during compile or link!-----------------------
>> See http://www.mcs.anl.gov/petsc/petsc-2/documentation/faq.html
>> mpif90 -c  -Wall -Wno-unused-variable -g   -I/home/bjha/src/petsc-dev/include -I/home/bjha/src/petsc-dev/linux_gcc-4.4.1_64/include -I/home/bjha/src/petsc-dev/include/sieve -I/home/bjha/MATLAB/R2010b/extern/include -I/home/bjha/tools/gcc-4.4.1_64/include    -o ex5f.o ex5f.F
>> mpif90 -Wall -Wno-unused-variable -g   -o ex5f ex5f.o -L/home/bjha/src/petsc-dev/linux_gcc-4.4.1_64/lib  -lpetsc -Wl,-rpath,/home/bjha/src/petsc-dev/linux_gcc-4.4.1_64/lib -lparmetis -lmetis -Wl,-rpath,/home/bjha/MATLAB/R2010b/sys/os/glnx86:/home/bjha/MATLAB/R2010b/bin/glnx86:/home/bjha/MATLAB/R2010b/extern/lib/glnx86 -L/home/bjha/MATLAB/R2010b/bin/glnx86 -L/home/bjha/MATLAB/R2010b/extern/lib/glnx86 -leng -lmex -lmx -lmat -lut -licudata -licui18n -licuuc -lml -lchaco -L/usr/lib/atlas -llapack_atlas -llapack -latlas -lblas -L/home/bjha/tools/gcc-4.4.1_64/lib -L/usr/lib/gcc/i486-linux-gnu/4.4.3 -L/usr/lib/i486-linux-gnu -ldl -lmpi -lopen-rte -lopen-pal -lnsl -lutil -lgcc_s -lpthread -lmpi_f90 -lmpi_f77 -lgfortran -lm -lm -lm -lm -lmpi_cxx -lstdc++ -lmpi_cxx -lstdc++ -ldl -lmpi -lopen-rte -lopen-pal -lnsl -lutil -lgcc_s -lpthread -ldl
>> /usr/bin/ld: cannot find -licudata
>> collect2: ld returned 1 exit status
>> make[3]: [ex5f] Error 1 (ignored)
>> /bin/rm -f ex5f.o
>> Completed test examples
>>
>>
>> It is correct that I didn't install matlab in the default directory (/usr/local) because I had some permission issues on Ubuntu. But I have been running matlab (by running /MATLAB/R2010b/bin/matlab.sh) without any issues
>> for some time now. So it should be that, I suppose.
>>
>> I still went ahead with compiling my application with few lines of PetscMatlabEngine functions, just to test:
>>
>>   PetscMatlabEngine e;
>>   PetscScalar *array; array[0]=0;
>>   const char name[]="a";
>>   PetscMatlabEngineCreate(PETSC_COMM_WORLD,PETSC_NULL,&e);
>>   PetscMatlabEnginePutArray(e,1,1,array,name);
>>   PetscMatlabEngineGetArray(e,1,1,array,name);
>>   PetscMatlabEngineDestroy(e);
>>
>> Do I need to include any header file (e.g. petscmatlab.h) in the header of my class file?
>
>    No
>
>> Right now, the application compiled (make, make install) fine without any such include file. The application have been using Petsc for its solver without any issues, so it includes all the necessary files. I just want to exten the application to call some matlab scripts by using PetscMatlabEngine.
>>
>> But, I get runtime error for mexPrintf:
>>
>> bjha at ubuntu:~/src/pylith-dev/examples/3d/hex8$ pylith step06_pres.cfg
>> Traceback (most recent call last):
>>   File "/home/bjha/tools/gcc-4.4.1_64/bin/pylith", line 37, in<module>
>>     from pylith.apps.PyLithApp import PyLithApp
>>   File "/home/bjha/tools/gcc-4.4.1_64/lib/python2.6/site-packages/pylith/apps/PyLithApp.py", line 23, in<module>
>>     from PetscApplication import PetscApplication
>>   File "/home/bjha/tools/gcc-4.4.1_64/lib/python2.6/site-packages/pylith/apps/PetscApplication.py", line 27, in<module>
>>     class PetscApplication(Application):
>>   File "/home/bjha/tools/gcc-4.4.1_64/lib/python2.6/site-packages/pylith/apps/PetscApplication.py", line 41, in PetscApplication
>>     from pylith.utils.PetscManager import PetscManager
>>   File "/home/bjha/tools/gcc-4.4.1_64/lib/python2.6/site-packages/pylith/utils/PetscManager.py", line 29, in<module>
>>     import pylith.utils.petsc as petsc
>>   File "/home/bjha/tools/gcc-4.4.1_64/lib/python2.6/site-packages/pylith/utils/petsc.py", line 25, in<module>
>>     _petsc = swig_import_helper()
>>   File "/home/bjha/tools/gcc-4.4.1_64/lib/python2.6/site-packages/pylith/utils/petsc.py", line 21, in swig_import_helper
>>     _mod = imp.load_module('_petsc', fp, pathname, description)
>> ImportError: /home/bjha/tools/gcc-4.4.1_64/lib/libpylith.so.0: undefined symbol: mexPrintf
>
>    Somehow all the Matlab shared libraries need to be found when python loads libpylith.so is loaded.  I don't know how this is done in Linux. It is really a python question if you want to use a dynamic library in python that uses another shared library how do you make sure python gets all the shared libraries loaded to resolve the symbols?
>
>     Barry
>
>>
>>
>> Can anyone help/suggest something?
>>
>> Thanks a lot
>> Bir
>>
>>
>>
>
>



More information about the petsc-users mailing list