-
Notifications
You must be signed in to change notification settings - Fork 14
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
Unable to setup with python 3 #10
Comments
Hi @joshuakortje. I see a few issues in the output you've posted, but it's not immediately obvious what the solution is. The first error is this:
It appears that the directory The second error is a bit confusing, but we might be able to understand it. The syntax error is from your C compiler failing to parse lapack_complex_float lapack_make_complex_float( float re, float im ); That appears to fail because /* Complex type (single precision) */
#ifndef lapack_complex_float
#ifndef __cplusplus
#include <complex.h>
#else
#include <complex>
#endif
#define lapack_complex_float float _Complex
#endif Based on how you're building this, I expect that last There's one other potential problem I see. Im not sure it's causing this particular issue, but it appears you have two version of LAPACK installed: 3.12.0 and 3.8.0. The first invocation that fails is using 3.12.0, and the latter (with the parsing error) is using 3.8.0. Either of those should work fine, but you definitely want to make sure you're consistently using the same version throughout the whole build. For example, you want to make sure you compile and link with the same version, to avoid any kind of ABI issue. Finally, you may want to try to get a self-contained LAPACK C program compiled and linked. Something very simple, which you can just use to prove your toolchain and LAPACK installation are working as you expect. Then you can use the version information and install directories to help build this package. Hope that helps, but please reach out with other questions. |
My lapacke_mangling.h file is not in that directory and I don't see one actually. I did eventually come to the conclusion that LAPACK is not installed correctly and I'm having some trouble with that. I tried to install it by running the CMake GUI on the source code while specifying the Fortran compiler by following the instructions here: https://icl.utk.edu/lapack-for-windows/lapack/ under "Build Instructions for LAPACK 3.5.0 for Windows with Visual Studio". However, I keep running into an error where CMake says the Fortran compiler "is not able to compile a simple test program." I get the issue using ifx.exe and gfortran.exe with MinGW. Is there a better way to install LAPACK on Windows? |
I really don't know, sorry about that. I'm not a Windows user myself.
I might investigate this. If you can get more verbose output, it might show you how the Fortran compiler is failing. Is it missing some include files or other configuration? Is the compiler out-of-date, and just can't work with the version of LAPACK you're building? |
Ok. I think I have gotten LAPACK installed correctly now. I eventually figured out that I had to configure CMake to generate a makefile for MinGW instead of for Visual Studio (I'm not sure why it would not work for VS...). I was able to verify with the built in tests that everything seemed to be working (ie running However, I still get the other error about 'lapack_make_complex_float' not being defined. How do I check that |
That's great!
After a bit of reading, it seems like Visual Studio's support for C99's complex numeric types is quite weak. This article indicates that types like It seems possible that most folks using the LAPACK C-interface on Windows are actually writing C++ code, which defines a separate set of types and functions in the I wish there were better news for you on this front. Let me know if I can help more. |
Thank you for your continued support. I am trying to go the route of the Stack Overflow post that you linked, but that appears to still give errors. I think it is because in that user's application, he is compiling with C++ whereas I am using a C compiler. (not super familiar with C so kind of stumbling through this a bit) I added the middle section of the below code to my copy of
The errors I get in the compilation are:
These point to the same place in the header that the SO post had an issue with:
I suspect (although it is not very clear in the error) that the issue is due to |
If you'd like to try to define your own complex type, I would probably start by making a C struct that looks like this: typedef struct lapack_complex_float {
float real; // Real part
float imag; // Imaginary part
} lapack_complex_float; with a similar type for double-precision. I would then try to define the functions for constructing those like this: lapack_complex_float make_lapack_complex_float(float re, float im) {
lapack_complex_float out = { .real = re, .imag = im };
return out;
} I'm not entirely sure how one would direct LAPACK to use those definitions you provide, but I might look at where they are currently defined (not their declarations, the actual definitions), and see if you can I might first look at the Microsoft post I linked above in more detail. From my initial reading, that's exactly how the Visual Studio code implements the complex types, with structs that probably look similar to the one I wrote above. You might try to use those definitions yourself, rather than writing your own. I don't know how one would do that, though, since I have almost no Visual Studio experience myself. Let me know if that helps! |
That article makes it seem like I should actually be able to just replace
Now, This is the output from the compiler:
From what I can tell, the warnings look benign. However, the linking error is failing to find Note that I am having to install/build/make LAPACK with MinGW. Not sure if that makes a difference. I have not been able to get it to work with VS Code for the install. |
I'm not sure, I tend not to treat any warning like this as benign in C. This indicates we're implicitly casting between types that might not be wide enough, which loses precision. Could you show which lines those are in your modified version of the source file?
When passing libraries to a linker, the convention is to use arguments like I'm not very familiar with Visual Studio's linker, but I see something that's basically the same. There is a flag Also, to be clear, this library is pretty old at this point. When I wrote it, using |
Thanks for the source here. It is indeed intentionally casting from
Great! But that's annoying we're at a different problem. You can use the
Here, the file |
Ok. Maybe I can try to throw in a simple runtime check and when it is running we'll see if the types are compatible. I ran
I also trying running it on the dll file (since the make command outputted a Do I perhaps need a way of including the Also, I was able to install and test the LAPACK examples for windows that are referenced here. (search: Using LAPACKE subroutines in a Visual Studio C/C++ Project). They include a preinstalled version of lapack (not sure which version). I was able to build and run in VS just by opening the project and building it. However, I also tried using the setup.py to build it as well and it failed (unable to find
|
Doing a little more digging, I found this thread: https://stackoverflow.com/questions/6422478/linking-a-lib-and-def-files/6480464#6480464 I notice that for my case the |
Hello, I am trying to set up this wrapper, but am getting errors when I run the setup.py command. Below is my output.
I ran the command
the output was
and it continues with more of the same. It appears that the lapacke.h file is not being read in correctly, but I'm not sure.
Thanks for your help!
The text was updated successfully, but these errors were encountered: