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

Windows build with cmake intel fortran broken #583

Closed
1 task
billhoffman opened this issue Jun 15, 2021 · 5 comments · Fixed by #584
Closed
1 task

Windows build with cmake intel fortran broken #583

billhoffman opened this issue Jun 15, 2021 · 5 comments · Fixed by #584

Comments

@billhoffman
Copy link

Description
When building on Windows with cmake or perhaps any OS, the file LAPACKE/include/lapacke_mangling.h is picked up by the compiler. Insead of the cmake generated version of that found in the build tree in ./include/lapacke_mangling.h. This gets the incorrect name mangling and you get linker errors when building LAPACKE as a shared library.

To reproduce do this:

cmake -GNinja -DLAPACKE=ON -DBUILD_SHARED_LIBS=ON ..
ninja

I am not sure how you want to fix it. I guess you could move LAPACKE/include/lapacke_mangling.h to a directory that is only referenced in the Makefile.

Checklist

  • [x ] I've included a minimal example to reproduce the issue
  • I'd be willing to make a PR to solve this issue
@weslleyspereira
Copy link
Collaborator

Hi @billhoffman,

I didn't get link errors in my Ubuntu using GNU compilers, GCC version 7.5.0. Can you post the error message here?
I will try to reproduce it on Windows.

Thanks,
Weslley

@billhoffman
Copy link
Author

billhoffman commented Jun 15, 2021

Likely because that file works with the gnu linking conventions. The error you get is when it links lapacke all of the fortran symbols are missing.

Creating library lib\lapacke.lib and object lib\lapacke.exp
lapacke_ilaver.c.obj : error LNK2019: unresolved external symbol ilaver_ referenced in function LAPACKE_ilaver
lapacke_sbbcsd_work.c.obj : error LNK2019: unresolved external symbol sbbcsd_ referenced in function LAPACKE_sbbcsd_work
....

That should be ILAVER and SBBCSD and not lower case with an _.

If I remove LAPACKE/include/lapacke_mangling.h it builds and links without error.

@weslleyspereira
Copy link
Collaborator

If I remove LAPACKE/include/lapacke_mangling.h it builds and links without error.

I think this is the correct solution, thanks @billhoffman!

The header LAPACKE/include/lapacke_mangling.h should be generated at compile time. The Makefile build has a rule to automatically generate LAPACKE/include/lapacke_mangling.h from lapacke_mangling_with_flags.h.in:

lapack/LAPACKE/Makefile

Lines 53 to 55 in 34c8291

include/lapacke_mangling.h: include/lapacke_mangling_with_flags.h.in
cp include/lapacke_mangling_with_flags.h.in $@

I will propose a PR very soon.

@weslleyspereira
Copy link
Collaborator

Please, see #584.

@billhoffman
Copy link
Author

Thanks, LGTM.

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

Successfully merging a pull request may close this issue.

2 participants