On Tue, Mar 10, 2020 at 06:35:04PM +0100, Jeremie Courreges-Anglas wrote:
> On Mon, Mar 09 2020, Stuart Henderson <s...@spacehopper.org> wrote:
> > On 2020/03/09 10:42, Theo Buehler wrote:
> >> On Mon, Jan 13, 2020 at 12:50:32PM +0000, Stuart Henderson wrote:
> >> > 2/3 through a bulk build and I see that this breaks scipy (missing 
> >> > symbols,
> >> > blas/cblas-related) so needs a bit more work, but I think it's generally
> >> > along the right lines.
> >> 
> >> Not sure if this provides any useful clue, but py-numpy doesn't build at
> >> all on sparc64 with this diff, also due to missing blas/cblas symbols:
> >
> > You'll probably see the same on amd64 with USE_LLD=no.
> 
> I managed to build scipy with no changes on amd64, so I'm not sure what
> the problem is on this arch (did not try with USE_LLD=No).
> 
> However I took a look at the issue reported by tb on sparc64.
> 
> --8<--
> creating /tmp/tmpKcZ0cd/tmp
> creating /tmp/tmpKcZ0cd/tmp/tmpKcZ0cd
> compile options: '-I/usr/local/include -I/usr/include -c'
> cc: /tmp/tmpKcZ0cd/source.c
> cc /tmp/tmpKcZ0cd/tmp/tmpKcZ0cd/source.o -L/usr/local/lib -lcblas -o 
> /tmp/tmpKcZ0cd/a.out
> /usr/local/lib/libcblas.so.1.0: undefined reference to `ztbsv_'
> /usr/local/lib/libcblas.so.1.0: undefined reference to `dasum_'
> 
> [...]
> 
> /usr/local/lib/libcblas.so.1.0: undefined reference to `zsymm_'
> /usr/local/lib/libcblas.so.1.0: undefined reference to `ztrsm_'
> /usr/local/lib/libcblas.so.1.0: undefined reference to `sswap_'
> collect2: error: ld returned 1 exit status
> cc /tmp/tmpKcZ0cd/tmp/tmpKcZ0cd/source.o -L/usr/local/lib -lblas -o 
> /tmp/tmpKcZ0cd/a.out
> /tmp/tmpKcZ0cd/tmp/tmpKcZ0cd/source.o: In function `main':
> source.c:(.text.startup+0xdc): undefined reference to `cblas_ddot'
> collect2: error: ld returned 1 exit status
> -->8--
> 
> libcblas.so doesn't depend on libblas.so so missing symbols are to be
> expected if one links with -lcblas instead of -lcblas -lblas.  The
> second linking test fails because libblas.so doesn't provide cblas
> symbols.

Thanks, this makes sense. But why does this work with ld.lld?

> 
> I think the way forward is to make libcblas.so depend on libblas.so
> (this is what you get eg on Debian).  It would probably make sense to do
> the same with lapack.
> 
> With the following cblas diff I can build py-numpy-1.16.5 on amd64 and
> sparc64.  cc'ing Steven.
> 
> ok?
> 
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/math/cblas/Makefile,v
> retrieving revision 1.20
> diff -u -p -r1.20 Makefile
> --- Makefile  12 Jul 2019 20:47:40 -0000      1.20
> +++ Makefile  10 Mar 2020 16:53:46 -0000
> @@ -5,8 +5,8 @@ COMMENT=      C interface to the BLAS library
>  VERSION=     1.0
>  DISTNAME=    cblas
>  PKGNAME=     ${DISTNAME}-${VERSION}
> -REVISION=    6
> -SHARED_LIBS= cblas   1.0
> +REVISION=    7
> +SHARED_LIBS= cblas   1.1
>  
>  CATEGORIES=  math
>  
> Index: files/Makefile
> ===================================================================
> RCS file: /cvs/ports/math/cblas/files/Makefile,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 Makefile
> --- files/Makefile    2 Oct 2006 21:58:25 -0000       1.1.1.1
> +++ files/Makefile    10 Mar 2020 16:53:46 -0000
> @@ -42,5 +42,6 @@ cblas_dgemm.c       cblas_sdsdot.c      
>  cblas_dgemv.c       cblas_sgbmv.c       cblas_zhemv.c \
>  cblas_dger.c        cblas_sgemm.c       cblas_zher.c \
>  cblas_dnrm2.c       cblas_sgemv.c       cblas_zher2.c
> +LDADD=-lblas -lgfortran
>  
>  .include <bsd.lib.mk>
> Index: pkg/PLIST
> ===================================================================
> RCS file: /cvs/ports/math/cblas/pkg/PLIST,v
> retrieving revision 1.4
> diff -u -p -r1.4 PLIST
> --- pkg/PLIST 16 Mar 2015 18:07:49 -0000      1.4
> +++ pkg/PLIST 10 Mar 2020 16:53:46 -0000
> @@ -1,6 +1,6 @@
>  @comment $OpenBSD: PLIST,v 1.4 2015/03/16 18:07:49 naddy Exp $
>  include/cblas.h
>  include/cblas_f77.h
> -lib/libcblas.a
> +@static-lib lib/libcblas.a
>  @lib lib/libcblas.so.${LIBcblas_VERSION}
> -lib/libcblas_p.a
> +@static-lib lib/libcblas_p.a
> 
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 

Reply via email to