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 binary package missing openblas .lib file #805

Closed
hholst80 opened this issue Mar 15, 2016 · 17 comments
Closed

Windows binary package missing openblas .lib file #805

hholst80 opened this issue Mar 15, 2016 · 17 comments
Labels

Comments

@hholst80
Copy link

The instructions to build a ".lib" file requires a ".def" file. The def file requires the user to download the source and have (among many other things) a working Perl installation and more. It would be very convenient for the users if the lib file was shipped together with the dll and header files.

EDIT: This used to be the case, as in OpenBLAS v0.2.8 from 2013 which included:

libopenblas.a
libopenblas.def
libopenblas.dll
libopenblas.exp
libopenblas.lib
@xianyi xianyi added the Support label Mar 15, 2016
@xianyi
Copy link
Collaborator

xianyi commented Mar 15, 2016

Thank you for the suggestion.

@mihaiconstantin
Copy link

mihaiconstantin commented Jul 25, 2019

I am trying to get get the binary package from NuGet (i.e., https://www.nuget.org/packages/OpenBLAS). However, only a libopenblas.dll.a is provided. I need the .lib file in the linking process. Any clue if and where I might be able to find it? I don't have a toolchain setup to build from source... Thanks.

@martin-frbg martin-frbg pinned this issue Jul 25, 2019
@martin-frbg martin-frbg unpinned this issue Jul 25, 2019
@martin-frbg
Copy link
Collaborator

That binary on NuGet is seriously outdated, could you please try if the attached package works for you ? (it is not exactly current either, this happens to be the result of a cross-compilation test
that I did on a Linux system a while ago, and already had the .def file that is needed by lib.exe to
create the .lib. If this works, I'll see if I can get the OpenBLAS uploads to sf.net updated again)
openblas035.zip

@mihaiconstantin
Copy link

Hei Martin, thank you very much for taking the time to answer and for the binaries. I can confirm that I can link them with Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26730 for x86. Do you happen to also have the x64 binary?

By the way, it would be great if you could update the https://sf.net repository with more recent binaries. Sorry for asking this if you, but I personally don't have the technical knowledge to compile it myself from source. However, I rely heavily on this project for my research and I appreciate the amazing work you guys are doing!

@martin-frbg
Copy link
Collaborator

Sorry, actually did not realize that it was a 32bit lib I had lying around. Will update my cross-compilation to x64 and upload a 64bit of 0.3.6 later today or tomorrow...

@mihaiconstantin
Copy link

Many thanks! I look forward to it!

@martin-frbg
Copy link
Collaborator

OK, next attempt. Hope this is actually usable:
openblas036-win64.zip

@mihaiconstantin
Copy link

mihaiconstantin commented Jul 28, 2019

It worked very well! I used the Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26730 for x64. Thank you again! Very much appreciated!

@martin-frbg
Copy link
Collaborator

I have uploaded the win64 build of 0.3.7 and a rebuilt package of 0.3.6 to the github releases page now, will ask xianyi to upload them to his openblas project account on sf.net as well.
(I decided to rebuild 0.3.6 as my previous attempt had Haswell as minimum target by mistake. Both new packages are still DYNAMIC_ARCH and now use TARGET=CORE2 for the common functions)

@martin-frbg
Copy link
Collaborator

Closing as the new 0.3.6 and 0.3.7 packages are now on the sourceforge page as well.

@realbabilu
Copy link

That binary on NuGet is seriously outdated, could you please try if the attached package works for you ? (it is not exactly current either, this happens to be the result of a cross-compilation test
that I did on a Linux system a while ago, and already had the .def file that is needed by lib.exe to
create the .lib. If this works, I'll see if I can get the OpenBLAS uploads to sf.net updated again)
openblas035.zip

This is perfect runs.
It is using MingW or native for produce it.
i did the native only producing openblas.lib , and cannot linked.

@martin-frbg
Copy link
Collaborator

@realbabilu the dll and def were produced using MingW (in the form of MXE) on Linux, the .lib was created on Windows using lib.exe /def:libopenblas.def /machine:x64 /out:libopenblas.lib from a VisualStudio2015 developer prompt.

@realbabilu
Copy link

realbabilu commented Jan 31, 2020

Can i opened a new issue ?
Question 1 : Can you describe in easy way step by step?
Question 2 : Could you pointed what wrong what i do, in below ?
Question 3 : In Xianyi precompiled installation packages:
https://github.com/xianyi/OpenBLAS/wiki/Precompiled-installation-packages
a. The windows at sourceforge cannot be linked with VS.
It need libgfortran-3.dll that not included (that is from mingW32 right?
its not available on mingw-64?
got the file. forrtl: severe (157): Program Exception - access violation

Comment 1: The best precompiled package openBlas is here for Windows VS:
Using VS GUI: just add "libopenblas.lib" into source
Using command line: ifort source.f90 libopenblas.dll.a /O3 /QxCORE-AVX2
where the libopenblas.dll should be needed for run the compiled one.

                  For WSL 10, or  Windows Subsystem Linux, Ubuntu on Windows is 
                 sudo apt-get install libopenblas-dev
                 gfortran -Ofast -ffast-math -funroll-loops  -march=core-avx2  -fopenmp any.f90 -lopenblas -o out.x 
                it is version 0.20 however the speed is the same with the compiled linux own version that compiled :    
                gfortran -pthread -test_fpu3.f90 libopenblas_haswellp-r0.3.8.dev.a libopenblas.a  -O3 -ffast-math -funroll-loops  -march=core-avx2 -o TESlinux.x                     

Attachment for Question 2:
I followed the https://github.com/xianyi/OpenBLAS/wiki/How-to-use-OpenBLAS-in-Microsoft-Visual-Studio for create the lib for VS2019 x64 community.
A. Native

  1. install miniconda3 x64
  2. Anaconda prompt >
    conda config --add channels conda-forge
    conda install -y cmake flang clangdev perl libflang
    conda install -y -c isuruf kitware-ninja
  3. run vcvarsallx64.bat (this is on the new command prompt or anaconda; pressumed anaconda),
    checked with link.exe (ok)
  4. run (pressumed anaconda prompt also)
    set "LIB=%CONDA_INSTALL_LOCN%\Library\lib;%LIB%"
    set "CPATH=%CONDA_INSTALL_LOCN%\Library\include;%CPATH%" (it need " on last)
    mkdir build
    cd build
    cmake .. -G "Ninja" -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_Fortran_COMPILER=flang -DBUILD_WITHOUT_LAPACK=no -DNOFORTRAN=0 -DDYNAMIC_ARCH=ON -DCMAKE_BUILD_TYPE=Release
  5. cmake --build . --config Release
  6. got the openblas.lib on build/release
  7. install cmake.exe on windows (pressumed cmake.exe on path wheninstall)
  8. next...getting lost here. # do this from powershell so cmake can find visual studio
    anaconda powershell or windows powershell ? pressumed windows powershell
    since anaconda already got cmake itself, so the installed cmake for windows not anaconda.
    cmake -G "Visual Studio 14 Win64" -DCMAKE_BUILD_TYPE=Release .
    this is run on openblas source folder ?? looks cant run. i mad another folder, build2
    cmake .. -G "Visual Studio 15 Win64"
    at folder build 2. then got some VS2017 project.
  9. When i run the openblas workplace got the openblas.lib also. this a static ?
    i cant link with my source for testing inverse matrix: test_fpu3.f90
    test_fpu3.f90 https://www.mediafire.com/file/oi966842pbdemt9/test_fpu3.f90/file
    that calls Lapack Blas3 DGETRI; DGFTRF,ILAENV
    ifort test_fpu2.f90 /O3 /OxCORE-AVX2 openblas.lib /link /stack:64000000
    it fails to call the Lapack.

B. MingW-64
B.I MingW-64 Version

  1. Install MingW-w64-install.exe
  2. in bin folder
    it has mingw32-make.exe copy to make.exe (maybe unnecessary)
    copy ar.exe x86_64-w64-mingw32-ar.
    copy ranlib.exe to x86_64-w64-mingw32-ranlib.
    in folder openblas, m
  3. compile
    make HOSTCC=gcc CC=/mnt/d/linux/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/x86_64-w64-mingw32-gcc.exe FC=/mnt/d/linux/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/x86_64-w64-mingw32-gfortran.exe BINARY=64
  4. use the dll.a
    ifort /I"D:\win\test_fpu\Openblas2" test_fpu2.f90 libopenblas.dll.a /link /stack:64000000
  5. Got error
    forrtl: severe (157): Program Exception - access violation
    Image PC Routine Line Source
    libopenblas.dll 000000006DA5F594 Unknown Unknown Unknown

B.II Msys2 MingW-64

  1. Install msys2
  2. missing the developtment tool --> The installationtool for repo broken use
    on terminal msys
    pacman -Syu , then close windows
    pacman -S base-devel
    pacman -S gfortran-gcc
    pacman -S mingw-w64-x86_64-crt-git (for installing the git)
  3. make TARGET=Haswell num_threads=12
  4. it goterror ln: failed to create symbolic link 'cygopenblas.a': No such file or directory
    but got files:
    cygopenblas.dll
    libopenblas.dll.a
    cygopenblas_haswellp-r0.3.8.dev.a
  5. ifort source.f90 libopenblas.dll.a cygopenblas_haswellp-r0.3.8.dev.a
    output produced but hang on call blas lapack.

@martin-frbg
Copy link
Collaborator

Probably best to open a new issue for this. Unfortunately I am not building on Windows myself (hence the crossbuild from Linux), so I have to rely on reports and suggestions by others. The missing libgfortran-3.dll is probably this one from mxe libgfortran-3.txt (the issue tracker accepts only .txt for uploads, you need to rename this back to .dll).

@realbabilu
Copy link

Since you building using mingw from linux. I have linux ubuntu also as WSL. this will be adding mingw64-gcc. how it told to use mingw-gcc instead original linux gcc.

@martin-frbg
Copy link
Collaborator

Should be sufficient to use make HOSTCC=gcc CC=/path/to/your/mingw-gcc FC=/path/to/your/mingw-gfortran

@realbabilu
Copy link

Got error forrtl: severe (157): Program Exception - access violation when run the app with libopenblas.dll.a produced. both from linux gcc-mingw-w64-gcc and mingw64 souceforge gcc-mingw-w64-gcc
ifort /I"D:\win\test_fpu\Openblas2" test_fpu2.f90 libopenblas.dll.a /link /stack:64000000

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

No branches or pull requests

5 participants