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

Problem with linking against LAPACK - starting up the program fails

Arjen_Markus
Honored Contributor I
403 Views
Hello,

I have run into a strange problem with linking against a library (in this case: LAPACK). This came up
in exploring a problem with a large program, but I have been able to reproduce it with a trivial one.

The issue is this:
- I have built LAPACK, version 3.2.2, from sources, using the CMake build system that comes with the
source distribution. The only option I set for this build is the build type, Release, rather than Debug,
because the debug version gave the error message that MSVCRTD.DLL could not be found.
- I link the program below with the two resulting libraries using the command-line tools.
- The result is a runtime error R6034.

Here is the program:


! chklink.f90 --
! Check a problem with linking against LAPACK
!
program chklink
double precision value
value = dlamch( 'e' )
write(*,*) value
end

I compiled and linked with this statement:

ifort chklink.f lapack.lib blas.lib

This gave the following warning:

LINK: warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

But when I run the program I get two message boxes, with the following text:

R6034

An application has made an attempt to load the C rntime library incorrectly.

Please contact the application's support team for more information.

The application failed to initialize properly (0xc0000142). Click on OK to terminate the application.


How can I solve this?

Regards,

Arjen

0 Kudos
3 Replies
Jugoslav_Dujic
Valued Contributor II
403 Views
Try building lapack and blas with /libdir:noauto (Disable Default Library Search Rules), which I always recommend for building static libraries.

Why don't you use lapack from MKL, by the way?
0 Kudos
Arjen_Markus
Honored Contributor I
403 Views
Because I wanted to reproduce a numerical problem that a friend of mine reported. His colleague built the whole program (including LAPACK) from sources and found strange numerical results. When I was finally
able to build and run the program myself, the results were quite in agreement with the expectations, so there is still a riddle.

But in doing so, I stumbled on this one. And another - see my other thread.

Regards,

Arjen
0 Kudos
Arjen_Markus
Honored Contributor I
403 Views
Forget that other thread - that was shear stupidity/programmer's blindness/...

I invoked the compiler with the right commands (after editing the source file and removing the text that
led to the bizarrely seeming, but completely correct error messages):

ifort chklink.f lapack.lib blas.lib /link /nodefaultlib:msvcrt.lib

and then it worked without any problem.

Regards,

Arjen
0 Kudos
Reply