Page 1 of 1

how to compile refblas as a shared library (dynamically ...

PostPosted: Thu Apr 05, 2007 4:00 pm
by neodreamer
how to compile the refblas as a shared library (dynamically linked library)

I tried the following method but failed, anyone knows why?
BTW, I successfully compiled lapack as a shared library use a similar

In, I added

In Makefile, I appended to the "all:..." (line 58)
all: $(BLASLIB)
and right below the part

$(RANLIB) $@

I added: $(ALLOBJ)
cc -shared -Wl,-soname, -o $(ALLOBJ)

but I got following error messages:

isamax.o: In function `isamax_':
isamax.f:(.text+0x0): multiple definition of `isamax_'
isamax.o:isamax.f:(.text+0x0): first defined here
sasum.o: In function `sasum_':
sasum.f:(.text+0x0): multiple definition of `sasum_'
sasum.o:sasum.f:(.text+0x0): first defined here
saxpy.o: In function `saxpy_':
saxpy.f:(.text+0x0): multiple definition of `saxpy_'
saxpy.o:saxpy.f:(.text+0x0): first defined here
scopy.o: In function `scopy_':
scopy.f:(.text+0x0): multiple definition of `scopy_'
scopy.o:scopy.f:(.text+0x0): first defined here
snrm2.o: In function `snrm2_':
snrm2.f:(.text+0x0): multiple definition of `snrm2_'
snrm2.o:snrm2.f:(.text+0x0): first defined here
sscal.o: In function `sscal_':
sscal.f:(.text+0x0): multiple definition of `sscal_'
sscal.o:sscal.f:(.text+0x0): first defined here
idamax.o: In function `idamax_':
idamax.f:(.text+0x0): multiple definition of `idamax_'
idamax.o:idamax.f:(.text+0x0): first defined here
dasum.o: In function `dasum_':
dasum.f:(.text+0x0): multiple definition of `dasum_'
dasum.o:dasum.f:(.text+0x0): first defined here
daxpy.o: In function `daxpy_':
daxpy.f:(.text+0x0): multiple definition of `daxpy_'
daxpy.o:daxpy.f:(.text+0x0): first defined here
dcopy.o: In function `dcopy_':
dcopy.f:(.text+0x0): multiple definition of `dcopy_'
dcopy.o:dcopy.f:(.text+0x0): first defined here
dnrm2.o: In function `dnrm2_':
dnrm2.f:(.text+0x0): multiple definition of `dnrm2_'
dnrm2.o:dnrm2.f:(.text+0x0): first defined here
dscal.o: In function `dscal_':
dscal.f:(.text+0x0): multiple definition of `dscal_'
dscal.o:dscal.f:(.text+0x0): first defined here
collect2: ld returned 1 exit status
make: *** [] Error 1

I hope get some hint here,
thanks in advance


PostPosted: Thu Apr 05, 2007 4:39 pm
by Julie
it works fine for me if you change
Code: Select all $(ALLOBJ)
cc -shared -Wl,-soname, -o $(ALLOBJ)

Code: Select all $(ALLOBJ)
cc -shared -Wl,-soname, -o *.o

I also added -fPIC also to OPTS.

You problem is that the ALLOBJ variable contains several times the same object. ALLOBJ is a composition of different variables that sometimes have a same object in commun. If you look into the Makefile, you see that isamax is in blas1 and in cbaux1.

When a static library is created, that does not cause any problem, but it does with a shared library.

Anyway you point out something that needs to be corrected.
Thank you

PostPosted: Fri Apr 06, 2007 1:34 pm
by neodreamer
I also added -fPIC to OPTS, but forget to write it in the above post.

I guess you are right,
the problem is caused by containing the same obj file multiple times.