Topic: Problem using lapack

Hi Jeff,

I am a new user for Fortran language and Simply Fortran. I just installed lapack & blas from Simply Fortran package manager. However, compiling is still not successful.
Here is the building status of one of my projects:

==============================================================================
Generating Makefile... Okay
==============================================================================
Generating target.exe
build\main.o: In function `MAIN__':
C:\DEF\Fortran 90\simplify fortran\ggnewtry/./main.f90:40: undefined reference to `dsyev'
collect2.exe: error: ld returned 1 exit status
Error(E42): Last command making (target.exe) returned a bad status
Error(E02): Make execution terminated

* Failed *


The following link indicates that "dsyev" is indeed included in lapack  3.5.0 (which is the current version in SF package manager):
http://www.netlib.org/lapack/explore-ht … f42fed4044

So I guess the installation of blas and lapack is not successful.

Could you help me with this issue? I am kind of near dealine for the project...


Thank you so much in advance!

Best,
Jessie

Re: Problem using lapack

Jessie,

You'll still need to tell your project to use LAPACK and BLAS even though the've been installed. The quickest way to fix your problem is to follow these steps:

1.  Select Options from the Project menu to open the Project Options window.
2.  Select the Compiler Flags tab.
3.  In the box marked "Linker," enter the following:

-llapack -lblas

4. Click Ok in the Project Options window.
5. Select Build Now! in the Build menu.

You're seeing the error because the compiler didn't know it had to include the LAPACK and BLAS libraries in your project.  There is another way that isn't manual to do this (you may have noticed a button labeled "Package Flags" while on the Compiler Flags tab in the Project Options window), but I think the above is the quickest way to a solution in your case. 

Sorry for any confusion!

Jeff Armstrong
Approximatrix, LLC

Re: Problem using lapack

Thanks for your information Jeff! I've carried out your instructions, but unfortunately the same error message appears again...

Re: Problem using lapack

Jessie,

Could you post some of the code surrounding the call to DSYEV? It appears that the linker is looking for a function in the libraries called exactly "dysev."  However, Fortran compilers normally decorate procedures.  In this case, the actual function the compiler should be looking for is "dysev_" or "_dysev_" (I'm not sure exactly how it will appear in the error).  Is there an INTERFACE block that defines how DSYEV is called?

I checked the package itself, and it does indeed provide DSYEV, but in its properly decorated form, for both 32- and 64-bit versions of LAPACK.

Sorry for the trouble.  We'll figure this out.

Jeff Armstrong
Approximatrix, LLC

Re: Problem using lapack

Hi Jeff,

Thank you so much for the detailed answer! I tried your instruction and run the same code on another computer with which I registered for Simply Fortran Package Manager, and it works! It just does not work on this computer. Is it because the packages can only be installed at the computer that registered the account?

Thanks,
Jessie

Re: Problem using lapack

Jessie,

No, I don't think that should be the problem.  The package manager should work on either machine regardless of the registration status of Simply Fortran (as long as Simply Fortran is still within its trial period).

On the computer where compiling didn't work, could you try something quickly?  After starting the Simply Fortran Package Manager, click the Settings button.  Next, go to the Files tab.  What path is listed there?  I just want to make sure it's storing the libraries somewhere sensible.

You might also try uninstalling LAPACK and BLAS from the package manager and then reinstalling them.  There is a chance something went wrong.

Jeff Armstrong
Approximatrix, LLC

Re: Problem using lapack

Jeff,

The path is

C:\Users\Zhe\AppData\Local\\\sfpm

Thanks so much for your help! Now it's working:) But I am still a bit confused. On Friday I uninstalled lapack and blas, then installed lapack (blas should be automatically installed) again. It did not work. Then today I uninstalled both and installed both blas and lapack separately, then it works! No idea what happend...

But still many thanks for your help!!

Re: Problem using lapack

Jessie,

It sounds like an odd bug in the Package Manager.  I will investigate.  Thanks again for the report!

Jeff Armstrong
Approximatrix, LLC

Re: Problem using lapack

Thanks a lot for your help Jeff!