Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to link Lapack on Windows? #1

Open
Beliavsky opened this issue Jul 20, 2023 · 2 comments
Open

How to link Lapack on Windows? #1

Beliavsky opened this issue Jul 20, 2023 · 2 comments
Assignees

Comments

@Beliavsky
Copy link

Thanks for your project. Trying it on Windows, I get the error below. How am I supposed to link with Lapack?

>cd foreig

c:\...\foreig
>fpm install --prefix .
 + mkdir build\dependencies
Initialized empty Git repository in C:/.../foreig/build/dependencies/kinds/.git/
From https://github.com/gha3mi/kinds
 * branch            HEAD       -> FETCH_HEAD
<ERROR> Project does not contain any installable targets
STOP 1

c:\...\foreig
>fpm build
[  0%]                      kinds.f90
[ 33%]                      kinds.f90  done.
[ 33%]                     foreig.f90
[ 66%]                     foreig.f90  done.
[ 66%]                    libforeig.a
[100%]                    libforeig.a  done.
[100%] Project compiled successfully.

c:\...\foreig
>fpm test
[  0%]                      test1.f90
[ 50%]                      test1.f90  done.
[ 50%]                      test1.exe
[100%]                      test1.exe  done.

c:/programs/gcc/bin/../lib/gcc/x86_64-w64-mingw32/13.0.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build\gfortran_50F62D7499E64B65\foreig\libforeig.a(src_foreig.f90.o): in function `dsyev_rel':
c:\...\foreig/././src/foreig.f90:69: undefined reference to `dsyev_'
c:/programs/gcc/bin/../lib/gcc/x86_64-w64-mingw32/13.0.0/../../../../x86_64-w64-mingw32/bin/ld.exe: c:\...\foreig/././src/foreig.f90:80: undefined reference to `dsyev_'
collect2.exe: error: ld returned 1 exit status
<ERROR> Compilation failed for object " test1.exe "
<ERROR> stopping due to failed compilation
STOP 1
@gha3mi gha3mi self-assigned this Jul 20, 2023
gha3mi added a commit that referenced this issue Jul 20, 2023
@gha3mi
Copy link
Owner

gha3mi commented Jul 20, 2023

@Beliavsky, thank you for your report.

I have updated the fpm.toml file in this branch https://github.com/gha3mi/foreig/tree/gha3mi/issue1:

[install]
library = true

I suggest you remove the build, lib, and include folders in the foreig project (if they exist), and then try to compile it again using fpm.

fpm install --prefix .

Alternatively, you can set the compiler and flags (for example as follows):

fpm install --compiler gfortran --flag "-llapack" --prefix .

I have tested this on my Linux system.

You can also use this module as an fpm dependency in your project without installing it:

[dependencies]
foreig = {git="https://github.com/gha3mi/foreig.git"}

Please let me know if you can run the test file using fpm:

fpm @gfortran

or

fpm @ifort

You can modify the compiler flags for this test in the response files gfortran.rsp and ifort.rsp.

@gha3mi
Copy link
Owner

gha3mi commented Jul 21, 2023

@Beliavsky, If you need to configure the paths, you can utilize the following command:

fpm test --compiler gfortran --flag "-LC:\\lib -llapack -lrefblas"

To set lapack and blas in the fpm.toml file, you can do so by adding the following lines. However, I'm not entirely sure how to set the path:

[build]
link = ["blas", "lapack"]

I hope that it can solve the problem on Windows. However, I do not have access to a Windows system to test it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants