Hi all,
I am trying to link my code statically. The code is dynamically compiled and works fine by the linking options below:
MKL = "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_intel_lp64.so "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_intel_thread.so "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_core.so -L"~/intel/Compiler/11.1/064/mkl/lib/em64t" -liomp5 -lpthread -lm -DMKL_Complex16="std::complex" -static-intel
Now I tried the line below to get static code:
MKL = "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_intel_lp64.a "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_intel_thread.a "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_core.a "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_solver_lp64.a -L"~/intel/Compiler/11.1/064/mkl/lib/em64t" -openmp -lpthread -lm -DMKL_Complex16="std::complex" -static-intel
and when I use above linking, I get many unresolved referenced to almost all MKL functions I have used. Is there anything wrong with the link above? Is it also possible to just provide the path, so the compiler can statically bind all libraries needed? I read somewhere that using "-static-intel" would do such thing, but it didn't help.
Thanks,
D.
I am trying to link my code statically. The code is dynamically compiled and works fine by the linking options below:
MKL = "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_intel_lp64.so "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_intel_thread.so "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_core.so -L"~/intel/Compiler/11.1/064/mkl/lib/em64t" -liomp5 -lpthread -lm -DMKL_Complex16="std::complex
Now I tried the line below to get static code:
MKL = "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_intel_lp64.a "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_intel_thread.a "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_core.a "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_solver_lp64.a -L"~/intel/Compiler/11.1/064/mkl/lib/em64t" -openmp -lpthread -lm -DMKL_Complex16="std::complex
and when I use above linking, I get many unresolved referenced to almost all MKL functions I have used. Is there anything wrong with the link above? Is it also possible to just provide the path, so the compiler can statically bind all libraries needed? I read somewhere that using "-static-intel" would do such thing, but it didn't help.
Thanks,
D.
链接已复制
7 回复数
Hello danltu.se!
you forgot to use -Wl,--start-group/-Wl,--end-group linker options. So, your link line will look:
MKL = "-Wl,--start-group ~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_intel_lp64.a "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_intel_thread.a "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_core.a "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_solver_lp64.a -Wl,--end-group -L"~/intel/Compiler/11.1/064/mkl/lib/em64t" -openmp -lpthread -lm -DMKL_Complex16="std::complex" -static-intel
Andrey
you forgot to use -Wl,--start-group/-Wl,--end-group linker options. So, your link line will look:
MKL = "-Wl,--start-group ~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_intel_lp64.a "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_intel_thread.a "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_core.a "~/intel/Compiler/11.1/064/mkl/lib/em64t"/libmkl_solver_lp64.a -Wl,--end-group -L"~/intel/Compiler/11.1/064/mkl/lib/em64t" -openmp -lpthread -lm -DMKL_Complex16="std::complex
Andrey
Thanks Andrey, when I compile with the link you said I still get this error:
error while loading shared libraries: libguide.so: cannot open shared object file: No such file or directory
should I still add more libraries to be linked?
Thanks,
D.
error while loading shared libraries: libguide.so: cannot open shared object file: No such file or directory
should I still add more libraries to be linked?
Thanks,
D.
danltu.se,
compiler shouldn`t put dependencies to libguide to your application. Looks like this dependency is coming from somewhere else (for example, from third-party libs which you are using in your application). Could you provide FULL link line?
Andrey
compiler shouldn`t put dependencies to libguide to your application. Looks like this dependency is coming from somewhere else (for example, from third-party libs which you are using in your application). Could you provide FULL link line?
Andrey