作者duansai (said)
看板LinuxDev
标题[LIB ] 请教﹕关於gcc和ifort的-L和-l参数的制定问题
时间Tue Dec 19 18:35:00 2006
ifrot为﹕9.1.040﹔gcc为﹕3.2.3
用man察看其用法﹐发现好像gcc的-L和-l与ifort的意义不一样。
对於gcc -l其明确指出﹕
The directories searched include several standard system directories plus any
that you specify with -L
也就是说对於-l﹐gcc会先搜索所有制定的-L文件夹﹐并且﹕
The only difference between using an -l option and specifying a file name is
that -l surrounds library with lib and .a and searches several directories.
这个意思是说-l和直接指定的libXXX.a的唯一区别是-l会搜索文件夹。
但是对於ifort﹐它的说明文件就含糊很多﹕
The standard libraries, like libc, are loaded with the -l loader option and
not a full pathname. The wrong library can be loaded if there are files with
names like libc.a or libc.so in the directories specified with the -L loader
option, or in the default directories searched by the loader.
这样好像ifort里面-l不光指定了libXXX.a﹐连libXXX.so也制定了。并且根据我的观察﹐
好像在ifort里面-L指定的目录只是对後面连接的-l有用。举个例子来说﹕
-lsvml -L/usr/lib/gcc-lib -lg2c -L/opt/intel/mkl lmkl_ia32
如果在gcc的选项中﹐这个意思应该是说﹕
先在/usr/lib/gcc-lib和/opt/intel/mkl目录下找libsvml.a libg2c.a libmkl_ia32.a
三个静态库﹐如果找不到的话﹐就在系统默认的目录下找。
如果在ifort的选项中﹐这个意思应该是说﹕
现在系统的默认目录下找libsvml.a或者libsvml.so﹔然後再在/usr/lib/gcc-lib找
libg2c.a或者libg2c.so﹔最後在/opt/intel/mkl目录下找libmkl_ia32.a或者
libmkl_ia32.so
不知道我这样理解对不对﹖
还有一个是关於-Wl的意义﹐对於ifort是这样的﹕
-Wl,<o1>[,<o2>,...]
Passes options <o1>, <o2>, and so forth, to the linker for processing. If
the linker is not invoked, these options are ignored.
不知道怎麽理解﹐那位能给个比较明白的例子﹖
因为我的英文比较菜﹐所以不能很好的理解manual的意思。劳烦大家指正。谢谢 :)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 210.34.14.21
1F:推 qrtt1:参考 #43 12/19 19:15
2F:推 duansai:对於gcc我觉得我的理解没有错﹐但是对於ifort我不知道那样 12/20 21:46
3F:→ duansai:理解有没有问题﹖还是说ifort和gcc是一样的﹖ 12/20 21:47