static and dynamic linking

static and dynamic linking

hi group,

I am a PhD student, and in my project I have to modify some subroutines of codes that were written in fortran. I have a basic knowledge of fortran as I do not have a background of compouter science.

I have two different codes written in fortran. Both have scripts for compiling and linking provided by the suppliers.

For Code-1: I modify the subroutine compile and link by using the supplied script. In the script I see the options "-static" -lpthread - ldl etc. an executable is generated. it works fine. system being Mandrake LINUX 2.4.22, compiler: intel_fc_81. Code-1 does not require mkl.

on the same computer

For Code-2: the compilation works fine, but when I ask for linking with the option "-static" -lpthread -ldl etc. I get the errors that lpthread, ldl are missing (I can see them, they exist and work fine with Code-1). when I take out the option "-static" the executable is generated with an error:
liblcpack.a(IIRVmgr_init.o)(.text+0x717): In function `IIRVmgr_initOutOfCore':
: the use of `tmpnam' is dangerous, better use `mkstemp'

the the executable takes 4 hrs 49 mins to solve the problem which I can solve in 38 mins.

now we turn to another computer this computer has intel_fc8, mkl8, LINUX 2.4.22 here with -static -lsvml -lpthread -ldl .... I get the follwong (no executable is created)

liblcpack.a(IIRVmgr_init.o)(.text+0x717): In function `IIRVmgr_initOutOfCore':
: the use of `tmpnam' is dangerous, better use `mkstemp'
/usr/lib/libpthread.a(ptw-write.o)(.text+0x25): In function `write':
: undefined reference to `__syscall_error'
/usr/lib/libpthread.a(ptw-write.o)(.text+0x55): In function `write':
: undefined reference to `__syscall_error'
/usr/lib/libpthread.a(ptw-read.o)(.text+0x25): In function `read':
: undefined reference to `__syscall_error'
/usr/lib/libpthread.a(ptw-read.o)(.text+0x55): In function `read':
: undefined reference to `__syscall_error'
/usr/lib/libpthread.a(ptw-close.o)(.text+0x1f): In function `close':
: undefined reference to `__syscall_error'
/usr/lib/libpthread.a(ptw-close.o)(.text+0x4a): more undefined references to `__syscall_error' follow
/usr/lib/libpthread.a(pthread.o)(.text+0x6d4): In function `__pthread_reset_main_thread':
: undefined reference to `_res'
/usr/lib/libpthread.a(pthread.o)(.text+0x6de): In function `__pthread_reset_main_thread':
: undefined reference to `_errno'
/usr/lib/libpthread.a(pthread.o)(.text+0x6e8): In function `__pthread_reset_main_thread':
: undefined reference to `_h_errno'
/usr/lib/libpthread.a(pthread.o)(.text+0xad4): In function `pthread_initialize':
: undefined reference to `_res'
/usr/lib/libpthread.a(pthread.o)(.data+0x1b8): undefined reference to `_errno'
/usr/lib/libpthread.a(pthread.o)(.data+0x1c0): undefined reference to `_h_errno'
/usr/lib/libpthread.a(pthread.o)(.data+0x1c8): undefined reference to `_res'

does anyone have an idea where the problem might be. and what is the workaround for this.

thanks in advance

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