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

Open discussion regarding features, bugs, issues, vendors, etc.

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

Postby neodreamer » Thu Apr 05, 2007 4:00 pm

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
procedure

In make.inc, I added
NOOPT = -fPIC

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

$(BLASLIB): $(ALLOBJ)
$(ARCH) $(ARCHFLAGS) $@ $(ALLOBJ)
$(RANLIB) $@

I added:
libblas.so: $(ALLOBJ)
cc -shared -Wl,-soname,libblas.so -o libblas.so $(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: *** [libblas.so] Error 1

I hope get some hint here,
thanks in advance

Xiaoyong
neodreamer
 
Posts: 17
Joined: Thu Apr 05, 2007 3:52 pm

Postby Julie » Thu Apr 05, 2007 4:39 pm

Xiaoyong,
it works fine for me if you change
Code: Select all
libblas.so: $(ALLOBJ)
cc -shared -Wl,-soname,libblas.so -o libblas.so $(ALLOBJ)

in
Code: Select all
 libblas.so: $(ALLOBJ)
cc -shared -Wl,-soname,libblas.so -o libblas.so *.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
Julie
Julie
 
Posts: 299
Joined: Wed Feb 23, 2005 12:32 am
Location: ICL, Denver. Colorado

Postby neodreamer » Fri Apr 06, 2007 1:34 pm

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.

thanks
neodreamer
 
Posts: 17
Joined: Thu Apr 05, 2007 3:52 pm


Return to User Discussion

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests