Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29390 Discussions

err using -fast or -static option on Fedora12_x86_64 ( ld: cannot find -lm)

hiroyuki_maruyama
857 Views

Dear Sir;

I try and test ifort_11.1.064 on fedora12_x86_64 and core i7 920.

I successfully installedifort11.1.064following the guide.

http://software.intel.com/en-us/articles/using-intelr-compilers-for-linux-under-fedora/

But,

Compiling is failure when using -fast or -static option, although compiling is successful when no option and when using -m32, -m64, -O3, -ipo, -no-prec-div and -xHost option.

How can Iuse static option or fast option?(Is it impossible to link some libraries statically?)

best regards.

# ifort -fast hello.f90
ipo: remark #11001: performing single-file optimizations
ipo: remark #11005: generating object file /tmp/ipo_ifort63ayt2.o
ld: cannot find -lm

--------------------------------------

# cat hello.f90

program hello

print *,'hello'

end

--------------------------------------
# ldd /opt/intel/Compiler/11.1/064/bin/intel64/fortcom
linux-vdso.so.1 => (0x00007fffd1dff000)
libm.so.6 => /lib64/libm.so.6 (0x00000032eec00000)
libstdc++.so.5 => /usr/lib64/libstdc++.so.5 (0x00007fa6ffc20000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00000032f9000000)
libc.so.6 => /lib64/libc.so.6 (0x00000032ee000000)
libdl.so.2 => /lib64/libdl.so.2 (0x00000032ee800000)
/lib64/ld-linux-x86-64.so.2 (0x00000032edc00000)
# ifort -static -v hello.f90
Version 11.1
/opt/intel/Compiler/11.1/064/bin/intel64/fortcom -D__INTEL_COMPILER=1110 -D_MT -D__ELF__ -D__INTEL_COMPILER_BUILD_DATE=20091130 -D__unix__ -D__unix -D__linux__ -D__linux -D__gnu_linux__ -Dunix -Dlinux -D__x86_64 -D__x86_64__ -mGLOB_pack_sort_init_list -I. -I/opt/intel/Compiler/11.1/064/include/intel64 -I/opt/intel/Compiler/11.1/064/mkl/include -I/opt/intel/Compiler/11.1/064/include/intel64 -I/opt/intel/Compiler/11.1/064/include -I/usr/local/include -I/usr/include -I/usr/lib/gcc/x86_64-redhat-linux/4.4.2/include -O2 -mP1OPT_version=11.1-intel64 -mGLOB_diag_file=/tmp/ifortypbVsV.diag -mGLOB_source_language=GLOB_SOURCE_LANGUAGE_F90 -mGLOB_tune_for_fort -mGLOB_use_fort_dope_vector -mP2OPT_static_promotion -mP1OPT_print_version=FALSE -mP3OPT_use_mspp_call_convention -mCG_use_gas_got_workaround=F -mP2OPT_align_option_used=TRUE "-mGLOB_options_string=-static -v" -mGLOB_cxx_limited_range=FALSE -mGLOB_as_output_backup_file_name=/tmp/ifortqYlIfvas_.s -mIPOPT_activate -mIPOPT_lite -mGLOB_machine_model=GLOB_MACHINE_MODEL_EFI2 -mGLOB_extended_instructions=0x8 -mP2OPT_subs_out_of_bound=FALSE -mGLOB_ansi_alias -mIPOPT_args_in_regs=0 -mPGOPTI_value_profile_use=T -mP2OPT_hlo_level=2 -mP2OPT_hlo -mIPOPT_obj_output_file_name=/tmp/ifortypbVsV.o "-mGLOB_linker_version=2.19.51.0.14-34.fc12 20090722" -mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS -mGLOB_obj_output_file=/tmp/ifortypbVsV.o -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_FORTRAN -mP1OPT_source_file_name=hello.f90 hello.f90
ld /usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.4.2/crtbeginT.o -static -o a.out /opt/intel/Compiler/11.1/064/lib/intel64/for_main.o /tmp/ifortypbVsV.o -L/opt/intel/Compiler/11.1/064/lib/intel64 -L/opt/intel/Compiler/11.1/064/mkl/lib/em64t -L/opt/intel/Compiler/11.1/064/lib/intel64 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/opt/intel/Compiler/11.1/064/lib/intel64 -L/opt/intel/Compiler/11.1/064/mkl/lib/em64t -L/usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../.. -L/lib64 -L/lib -L/usr/lib64 -L/usr/lib -lifport -lifcore -limf -lsvml -lm -lipgo -lirc -u __pthread_once -lpthread -lc -lgcc -lgcc_eh -lirc_s -ldl -lc /usr/lib/gcc/x86_64-redhat-linux/4.4.2/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../../../lib64/crtn.o
ld: cannot find -lm

0 Kudos
3 Replies
Ron_Green
Moderator
857 Views

THis is probably a good time to mention that FC12 is NOT supported. The instructions I give only show how one could install the compiler - this does not imply we test or support FC12. In fact, we don't test against FC12. It is best to stay with a Linux distro listed in the ReleaseNotes.

Well, this one sure surprised me. It seems Fedora doesn't want you to statically link! How about that.

The instructions listed only seem to install the capability for dynamic linking. You can get the 64bit static libc libraries with YUM

as root

yum install glibc-static.x86_64

I am trying to find a 32bit version of glibc static libraries, but so far no luck.

-fast includes -static. What was happening is that the linker was trying to find a static version of libm, libm.a.

You may want to statically link the Intel libraries with -static-intel and leave the system libraries dynamic. I would like to know if someone can find the 32bit version of glibc-static from any of the Fedora yum archives.

Notice that without the 32bit version of glibc-static you will NOT be able to create static 32bit executables - we need to find and install the 32bit version of libm.a in order to get static linking to work for ia32 32bit binaries.

I thought Fedora was better than this.

ron

0 Kudos
Ron_Green
Moderator
857 Views

using rpmfind, I can find the 32bit version of glibc-static:

http://www.rpmfind.net/linux/rpm2html/search.php?query=glibc-static

And you can download and install glibc-static-2.11.1-1.i686 to get the 32bit libraries.

WHat is interesting is the warning on using static linking from this rpmfind page:

"The glibc-static package contains the C library static libraries for -static linking. You don t need these, unless you link statically, which is highly discouraged.f"

There has been ongoing debate in the community about static linking versus dynamic linking for years. Personally, I think a programmer should have choice. However, increasingly static linking is being discouraged, especially on Windows OS. I understand the pros and cons of both sides of this argument. However, it is clear that Fedora is taking a stand on the side of making it difficult to link statically. I will have to check the newest distros of Ubuntu, OpenSUSE also to see if this is true of them as well.

ron

0 Kudos
hiroyuki_maruyama
857 Views

I thanks Mr Green very much. Your advise is very useful.

I think, although there is noguarantee, if there is information for solution of problem and working well like this forum, some customer will upgrade or buy new one.


0 Kudos
Reply