flame / blis

BLAS-like Library Instantiation Software Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

clang: error: linker command failed with exit code 1

Hillard28 opened this issue · comments

Hi, I'm attempting to install blis on WIndows using mingw-w64, following the directions from the FAQ and BuildSystem docs. I've run the following code:
In git-bash:
git clone https://github.com/flame/blis
In MSYS2 MinGW 64-bit:
cd "C:\Users\rgilland\blis"

Then either:

export CC=clang CXX=clang++ AR=llvm-ar AS=llvm-as RANLIB=echo
./configure --disable-static --enable-shared auto

or:
CC=clang CXX=clang++ AR=llvm-ar AS=llvm-as RANLIB=echo ./configure --disable-static --enable-shared auto

I've also tried without --disable-static or --enable-shared, or without AR/AS/RANLIB specification.

The preceding commands appear to execute without issue and create the various haswell files. However, when I then run "make", I get the following:

Dynamically linking lib/haswell/libblis.lib
C:/msys64/mingw64/bin/ld: unrecognised option: -implib:lib/haswell/libblis.lib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:728: lib/haswell/libblis.lib] Error 1

From what I understand, Windows is technically unsupported, but any idea what may be causing this issue?

Versions:
llvm-ar/as: LLVM 14.0.4
ranlib: GNU Binutils 2.37
clang/clang++: clang version 14.0.4

Let me know what else might be helpful!

Did a fresh install of MSYS2, installed clang and llvm for MINGW-W64 and now while I appear to be compiling upon running make, I still get the original error at the end. I ran the following:
git clone https://github.com/flame/blis
CC=clang CXX=clang++ AR=llvm-ar AS=llvm-as RANLIB=echo ./configure auto or CC=clang CXX=clang++ AR=llvm-ar AS=llvm-as RANLIB=echo ./configure --disable-static --enable-shared auto
make

This time I downloaded the blis master within my msys64 install, and I attempted the above using the MINGW-W64 and CLANG64 environments.

When I check lib/haswell/, I see libblis.a, but not libblis.lib.

Current versions:
llvm-ar/as: LLVM 14.0.4
ranlib: GNU Binutils 2.38
clang/clang++: clang version 14.0.4

Can you try #639?

Hm, I can't be sure that issue is totally gone, but I'm now getting a different error!

Archiving lib/haswell/libblis.a
Dynamically linking lib/haswell/libblis.dll.a
lib/haswell/libblis.a
ld.lld: error: undefined symbol: pthread_create
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_create)

ld.lld: error: undefined symbol: pthread_join
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_join)

ld.lld: error: undefined symbol: pthread_mutex_init
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_mutex_init)

ld.lld: error: undefined symbol: pthread_mutex_destroy
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_mutex_destroy)

ld.lld: error: undefined symbol: pthread_mutex_lock
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_mutex_lock)
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_switch_on)
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_switch_off)

ld.lld: error: undefined symbol: pthread_mutex_trylock
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_mutex_trylock)

ld.lld: error: undefined symbol: pthread_mutex_unlock
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_mutex_unlock)
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_switch_on)
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_switch_off)

ld.lld: error: undefined symbol: pthread_cond_init
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_cond_init)

ld.lld: error: undefined symbol: pthread_cond_destroy
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_cond_destroy)

ld.lld: error: undefined symbol: pthread_cond_wait
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_cond_wait)

ld.lld: error: undefined symbol: pthread_cond_broadcast
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_cond_broadcast)

ld.lld: error: undefined symbol: pthread_once
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_once)

ld.lld: error: undefined symbol: pthread_barrier_init
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_barrier_init)

ld.lld: error: undefined symbol: pthread_barrier_destroy
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_barrier_destroy)

ld.lld: error: undefined symbol: pthread_barrier_wait
>>> referenced by obj/haswell/frame/thread/bli_pthread.o:(bli_pthread_barrier_wait)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:728: lib/haswell/libblis.dll.a] Error 1

I tried the following input sets:
CC=clang CXX=clang++ AR=llvm-ar AS=llvm-as RANLIB=echo ./configure -t openmp auto (with make -j8)
CC=clang CXX=clang++ AR=llvm-ar AS=llvm-as RANLIB=echo ./configure -t pthread auto (with make -j8)
CC=clang CXX=clang++ AR=llvm-ar AS=llvm-as RANLIB=echo ./configure auto (with make)

Can you try the new commit in the PR?

The commands I was using previously now appear to work! Thanks so much for all your help on that end. This is the final output from make -j8, with output just before being the various obj compiling:

Archiving lib/haswell/libblis.a
Dynamically linking lib/haswell/libblis.dll.a
lib/haswell/libblis.a

and here is the full output from make install

Installing libblis.a into /usr/local/lib/
Installing libblis.dll.a into /usr/local/lib/
Installing libblis.4.dll into /usr/local/lib/
Installing blis.h into /usr/local/include/blis/
Installing config.mk common.mk into /usr/local/share/blis/
Installing config/haswell/make_defs.mk into /usr/local/share/blis/config/haswell
mkdir -p /usr/local/share/pkgconfig
Installing blis.pc into /usr/local/share/pkgconfig/
install -c -m 0644 blis.pc /usr/local/share/pkgconfig

Where I'm now hitting issues is in running make check. Including full output below but not sure if this warrants a new issue being raised?

$ CC=clang CXX=clang++ AR=llvm-ar AS=llvm-as RANLIB=echo ./configure -t openmp auto
$ make -j8
$ make install
$ make check

Compiling obj/haswell/testsuite/test_addm.o
Compiling obj/haswell/testsuite/test_addv.o
Compiling obj/haswell/testsuite/test_amaxv.o
Compiling obj/haswell/testsuite/test_axpbyv.o
Compiling obj/haswell/testsuite/test_axpy2v.o
Compiling obj/haswell/testsuite/test_axpyf.o
Compiling obj/haswell/testsuite/test_axpym.o
Compiling obj/haswell/testsuite/test_axpyv.o
Compiling obj/haswell/testsuite/test_copym.o
Compiling obj/haswell/testsuite/test_copyv.o
Compiling obj/haswell/testsuite/test_dotaxpyv.o
Compiling obj/haswell/testsuite/test_dotv.o
Compiling obj/haswell/testsuite/test_dotxaxpyf.o
Compiling obj/haswell/testsuite/test_dotxf.o
Compiling obj/haswell/testsuite/test_dotxv.o
Compiling obj/haswell/testsuite/test_gemm.o
Compiling obj/haswell/testsuite/test_gemm_ukr.o
Compiling obj/haswell/testsuite/test_gemmt.o
Compiling obj/haswell/testsuite/test_gemmtrsm_ukr.o
Compiling obj/haswell/testsuite/test_gemv.o
Compiling obj/haswell/testsuite/test_ger.o
Compiling obj/haswell/testsuite/test_hemm.o
Compiling obj/haswell/testsuite/test_hemv.o
Compiling obj/haswell/testsuite/test_her.o
Compiling obj/haswell/testsuite/test_her2.o
Compiling obj/haswell/testsuite/test_her2k.o
Compiling obj/haswell/testsuite/test_herk.o
Compiling obj/haswell/testsuite/test_libblis.o
Compiling obj/haswell/testsuite/test_normfm.o
Compiling obj/haswell/testsuite/test_normfv.o
Compiling obj/haswell/testsuite/test_randm.o
Compiling obj/haswell/testsuite/test_randv.o
Compiling obj/haswell/testsuite/test_scal2m.o
Compiling obj/haswell/testsuite/test_scal2v.o
Compiling obj/haswell/testsuite/test_scalm.o
Compiling obj/haswell/testsuite/test_scalv.o
Compiling obj/haswell/testsuite/test_setm.o
Compiling obj/haswell/testsuite/test_setv.o
Compiling obj/haswell/testsuite/test_subm.o
Compiling obj/haswell/testsuite/test_subv.o
Compiling obj/haswell/testsuite/test_symm.o
Compiling obj/haswell/testsuite/test_symv.o
Compiling obj/haswell/testsuite/test_syr.o
Compiling obj/haswell/testsuite/test_syr2.o
Compiling obj/haswell/testsuite/test_syr2k.o
Compiling obj/haswell/testsuite/test_syrk.o
Compiling obj/haswell/testsuite/test_trmm.o
Compiling obj/haswell/testsuite/test_trmm3.o
Compiling obj/haswell/testsuite/test_trmv.o
Compiling obj/haswell/testsuite/test_trsm.o
Compiling obj/haswell/testsuite/test_trsm_ukr.o
Compiling obj/haswell/testsuite/test_trsv.o
Compiling obj/haswell/testsuite/test_xpbym.o
Compiling obj/haswell/testsuite/test_xpbyv.o
Linking test_libblis.x against 'lib/haswell/libblis.dll.a  -lm -fopenmp'
Running test_libblis.x (fast) with output redirected to 'output.testsuite'
C:/msys64/home/rgilland/blis/test_libblis.x: error while loading shared libraries: libblis.4.dll: cannot open shared object file: No such file or directory

For the record, libblis.4.dll, libblis.dll.a, and libblis.a are all present in the blis/lib/haswell folder. I also tried

$ CC=clang CXX=clang++ AR=llvm-ar AS=llvm-as RANLIB=echo ./configure -t openmp --disable-static --enable-shared auto
$ make -j8
$ make check

and got the same error. The examples also appear to compile, albeit with warnings.

You might have to add the directory of libblis.4.dll to PATH env variable.
However, running the test suite on windows with the shared library is not supported atm. You'll have to use the static library for testing.

Got it, so to be clear this issue isn't really indicative of any issue with my configuration?

Alright, glad to hear it! Thanks so much for your help, Isuru!

For completeness sake on this issue report, I'm able to compile and run all examples when the lib/haswell/ dlls are placed in the same folder.