anyone could help me about static dynamic library?

anyone could help me about static dynamic library?

i am a newbee in ifc. i found one problem:
i compiled one program. the file of libmkl_p4.so is needed for optimization. but in final step, i want compiling in static dynamic library. so it is conflicted with -static, which exclude the .so file. i have no idea now.
maybe the problem is simple and my question is stupid .could anyone help me?
thank you
here is the abstract of my complint option
FC=ifort
FFLAGS=-tpp5 -lirc -O2 -static-libirc
GUIDE=/opt/intel/mkl72/lib/32/libguide.a
LAPACK=/opt/intel/mkl72/lib/32/libmkl_lapack.a
BLAS=/opt/intel/mkl72/lib/32/libmkl_p4.so
LIBS=-L/opt/intel_fc_80/lib -static-libcxa -lguide $(LAPACK) $(BLAS) $(G2C)$(GUIDE) -L/opt/intel_fc_80/lib -lirc
and
$(FC) -static -static-libcxa -lirc -lguide -lpthread -lirc -o siesta
$(LDFLAGS) $(ALL_OBJS) $(FDF) $(MPI_INTERFACE)
$(NETCDF_INTERFACE) $(COMP_LIBS) $(LIBS)

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

To link the BLAS dynamically you should be referencing -lmkl to link in libmkl.so. This will dynamically dispatch the appropriate software at runtime. So if you have an Intel Pentium 4 processor,libmkl_p4.so would be linked at runtime. Take a look at

http://www.intel.com/software/products/mkl/docs/mklusel.htm

for further information on linking.

-Todd

maybe i have not expressed clearly enough. my horrible English :smileysad:

what i want is to compile the code in one machine and the program could run on other machines without any change. i mean static compiling.
in fact, the program could run in other machine if i copied libmkl_p4.so into the new machine. new i do not know if i could find a way without copying the .so file.
i noticed that the libmkl_p4.so is different from others. it had no .a file with the same name while in mkl6.0 it had ( ifmy remember is notwrong) . could i get .a file from .so file.
thank you again

If you want to link the BLAS statically, link to libmkl_ia32.a. This contains optimized kernels for all the IA32 processors. A check of CPUID at runtime will automatically run the optimal version for that processor.

-Todd

i have replaced libmkl_p4.so by libmkl_ia32.a.
but still there are new errors.
now the lib i was using is
ifort -openmp -i-static -static -o Prog -Vaxlib balabala.o
-L/opt/intel/mkl72/lib/32 -lmkl_lapack -lmkl_ia32 -lpthread -lguide
and the new error is
/opt/intel/mkl72/lib/32/libmkl_ia32.a(_izamax.o): In function `izamax_':
_izamax.o(.text+0x0): multiple definition of `izamax_'
linpack.o(.text+0xdbe): first defined here
/usr/bin/ld: Warning: size of symbol `izamax_' changed from 278 to 60 in /opt/intel/mkl72/lib/32/libmkl_
ia32.a(_izamax.o)

make: *** [Prog] Error 1
i am more puzzled.
linpack.o is one of my .o files i have compiled. normally, multiple definition should not cause unsuccesful compiling, is it ?
thank you again
what's more, i found the -mkl option does not work, only -lmkl_ia32 and -lmkl_lapack work.

It might be more efficient to submit an issue if you are not finding the suggestions here helpful.

Note that there is no '-mkl' option. Intel MKL consists only of librarys. One of the libraries (if you wish to link dynamically) is libmkl.so which can be linked using the '-lmkl' shortcut. That said, the link line you have below should work from the MKL standpoint. Your problem seems to be related to the duplicateinclusion of izamax_ in linpack.o and in MKL.

The problem here is that your compile module (LINPACK) had the level 1 BLAS in it. At least one function that is not in your compile module is in MKL and further more the compile unit within MKL also has within it one of more of the functions that are in your compile unit so both sets of functions are being linked in, resulting in multiply defined references.

You need to remove the functions from your source code that give multiple defines, recompile, and relink.

Bruce

Leave a Comment

Please sign in to add a comment. Not a member? Join today