OpenMathLib / OpenBLAS

OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
http://www.openblas.net
BSD 3-Clause "New" or "Revised" License
6.38k stars 1.5k forks source link

Error when compiling OpenBLAS with lapack 3.5.0 on Windows #325

Closed tuannhtn closed 10 years ago

tuannhtn commented 10 years ago

Hello, It is interesting to see OpenBLAS with update lapack 3.5.0. But I encoutered an error when compiling it on Windows 7 32 bit, msys 1.0: make[3]: execvp: ar: Bad file number. This error was not appeared with lapack 3.4.2. Could some one have solution for this problem? Thanks in advance.

xianyi commented 10 years ago

Could provide more information? Do you meet this error with compiling lapacke?

tuannhtn commented 10 years ago

Yes. After compiling the SRC folder of lapack (fortran source code files) (and create the libopenblas_penrynp-r0.2.8.a file), the compiler compiled the lapacke files (.c) and it generated .o file, but the last command to create the library issued that error.

carlkl commented 10 years ago

compiling with the help of msys2 shows this error:

ar -ru ../../../libopenblas-r0.2.8.a lapacke_cbbcsd.o ............ make[3]: execvp: ar: Argument list too long

I changed the Makefile to split the command into 4 parts (similar to lapaack-3.4.2):

$ cd lapack-netlib\lapacke\src\

$ diff -rupN Makefile_org Makefile

--- Makefile_org 2013-12-09 16:05:02.000000000 +0100 +++ Makefile 2013-12-11 12:48:11.163157300 +0100 @@ -34,7 +34,7 @@ # include ../../make.inc

-SRC_OBJ = \ +CSRC_OBJ = \ lapacke_cbbcsd.o \ lapacke_cbbcsd_work.o \ lapacke_cbdsqr.o \ @@ -532,7 +532,9 @@ lapacke_cunmtr_work.o \ lapacke_cupgtr.o \ lapacke_cupgtr_work.o \ lapacke_cupmtr.o \ -lapacke_cupmtr_work.o \ +lapacke_cupmtr_work.o + +DSRC_OBJ = \ lapacke_dbbcsd.o \ lapacke_dbbcsd_work.o \ lapacke_dbdsdc.o \ @@ -1022,7 +1024,9 @@ lapacke_dtrttf_work.o \ lapacke_dtrttp.o \ lapacke_dtrttp_work.o \ lapacke_dtzrzf.o \ -lapacke_dtzrzf_work.o \ +lapacke_dtzrzf_work.o + +SSRC_OBJ = \ lapacke_sbbcsd.o \ lapacke_sbbcsd_work.o \ lapacke_sbdsdc.o \ @@ -1506,7 +1510,9 @@ lapacke_strttf_work.o \ lapacke_strttp.o \ lapacke_strttp_work.o \ lapacke_stzrzf.o \ -lapacke_stzrzf_work.o \ +lapacke_stzrzf_work.o + +ZSRC_OBJ = \ lapacke_zbbcsd.o \ lapacke_zbbcsd_work.o \ lapacke_zbdsqr.o \ @@ -2061,13 +2067,18 @@ lapacke_slagsy_work.o \ lapacke_zlagsy.o \ lapacke_zlagsy_work.o

-ALLOBJ = $(SRC_OBJ) +COBJ_FILES := $(CSRC_OBJ) +SOBJ_FILES := $(SSRC_OBJ) +DOBJ_FILES := $(DSRC_OBJ) +ZOBJ_FILES := $(ZSRC_OBJ)

ifdef LAPACKE_TESTING -ALLOBJ += $(MATGEN_OBJ) +ZOBJ_FILES += $(MATGEN_OBJ) endif

+ALLOBJ = $(COBJ_FILES) $(DOBJ_FILES) $(SOBJ_FILES) $(ZOBJ_FILES) $(OBJ_FILES) + + ifdef USEXBLAS ALLXOBJ = $(SXLASRC) $(DXLASRC) $(CXLASRC) $(ZXLASRC) endif @@ -2078,7 +2089,11 @@ OBJ_FILES := $(C_FILES:.o=.o) all: ../../$(LAPACKELIB)

../../$(LAPACKELIB): $(ALLOBJ) $(ALLXOBJ)

tuannhtn commented 10 years ago

Thank you very much for your reply carlkl. But then I encoutered other errors from this command: ranlib ../libopenblas_penryn-r.0.2.8.a ... with many error messages like that: libopenblas.exp:fake(.edata+0x77a8): undefined reference to LAPACK_csyr_work. Do you have any suggestion?

carlkl commented 10 years ago

I copied my patched lapacke/src/Makefile to https://gist.github.com/carlkl/7924537 (my diff shows strange in github). At least building OpenBLAS worked for me with a mingw-build gcc-4.8.2 toolchain

tuannhtn commented 10 years ago

You are lucky carlkl. This solution did not work for me. I will updrade to gcc-4.8.2 to see if there is any chance. Thank you once again.

tuannhtn commented 10 years ago

The problem was solved. With carlkl's solution and clean version of OpenBLAS. After download the original version of OpenBLAS, I replace the makefile of lapacke\src in lapack-netlib folder and run the make command. The problem disappeared and I got the library. BTW, I used mingw with gcc-4.8.1.

xianyi commented 10 years ago

Thank you, @carlkl . Could you create a pull request?