libtools and shared libraries

View: New views
3 Messages — Rating Filter:   Alert me  

libtools and shared libraries

by Volker Braun :: Rate this Message:

| View Threaded | Show Only this Message

As a followup to the recent shared libraries discussion, I have been
using the following makefile to build dynamic libraries from the
static libraries. For simplicity, the libraries are just mapped 1:1.
The compilation is without libtools, so it is up to the user to pass
-fPIC or whatever compiler option is required for shared libraries. I
haven't tested it yet on other platforms.


======================================================
# Replace with the actual destination directory
DESTDIR=/home/vbraun/Code/ATLAS/local
VERSION=3:0:1

# You shouldn't have to customize anything from here on

INCINSTdir=$(DESTDIR)/include
LIBINSTdir=$(DESTDIR)/lib

LIBTOOL=libtool
INSTALL=install
#### "make" default values
# AR=ar
# F77=f77
# CC=cc
# RM=rm


LIBS=libatlas.la \
        libcblas.la libptcblas.la \
        libf77blas.la libptf77blas.la \
        liblapack.la libptlapack.la


all: build install


build: $(LIBS)


clean:
        $(RM) -r -f $(wildcard *.la) $(wildcard *-obj)


install:
        mkdir -p $(LIBINSTdir)
        $(LIBTOOL) --mode=install $(INSTALL) -c libatlas.la $(LIBINSTdir)/libatlas.la
        $(LIBTOOL) --mode=install $(INSTALL) -c libcblas.la $(LIBINSTdir)/libcblas.la
        $(LIBTOOL) --mode=install $(INSTALL) -c libptcblas.la
$(LIBINSTdir)/libptcblas.la
        $(LIBTOOL) --mode=install $(INSTALL) -c libf77blas.la
$(LIBINSTdir)/libf77blas.la
        $(LIBTOOL) --mode=install $(INSTALL) -c libptf77blas.la
$(LIBINSTdir)/libptf77blas.la
        $(LIBTOOL) --mode=install $(INSTALL) -c liblapack.la $(LIBINSTdir)/liblapack.la
        $(LIBTOOL) --mode=install $(INSTALL) -c libptlapack.la
$(LIBINSTdir)/libptlapack.la
        $(LIBTOOL) --finish $(LIBINSTdir)


libatlas.la: libatlas.a
        -rm -r -f libatlas-obj
        mkdir libatlas-obj
        cd libatlas-obj && $(AR) x ../$<
        $(LIBTOOL) --tag=CC --mode=link $(CC) \
            -o $@ libatlas-obj/*.o \
            -lpthread -lm \
            -rpath $(LIBINSTdir) -version-info $(VERSION)


libcblas.la: libcblas.a libatlas.la
        -rm -r -f libcblas-obj
        mkdir libcblas-obj
        cd libcblas-obj && $(AR) x ../$<
        $(LIBTOOL) --tag=CC --mode=link $(CC) \
            -o $@ libcblas-obj/*.o \
            -latlas \
            -rpath $(LIBINSTdir) -version-info $(VERSION)


libptcblas.la: libptcblas.a libatlas.la
        -rm -r -f libptcblas-obj
        mkdir libptcblas-obj
        cd libptcblas-obj && $(AR) x ../$<
        $(LIBTOOL) --tag=CC --mode=link $(CC) \
            -o $@ libptcblas-obj/*.o \
            -lpthread -latlas \
            -rpath $(LIBINSTdir) -version-info $(VERSION)


libf77blas.la: libf77blas.a libatlas.la
        -rm -r -f libf77blas-obj
        mkdir libf77blas-obj
        cd libf77blas-obj && $(AR) x ../$<
        $(LIBTOOL) --tag=F77 --mode=link $(F77) \
            -o $@ libf77blas-obj/*.o \
            -latlas \
            -rpath $(LIBINSTdir) -version-info $(VERSION)

libptf77blas.la: libptf77blas.a libatlas.la
        -rm -r -f libptf77blas-obj
        mkdir libptf77blas-obj
        cd libptf77blas-obj && $(AR) x ../$<
        $(LIBTOOL) --tag=F77 --mode=link $(F77) \
            -o $@ libptf77blas-obj/*.o \
            -lpthread -latlas \
            -rpath $(LIBINSTdir) -version-info $(VERSION)

libf77refblas.la: libf77refblas.a
        -rm -r -f libf77refblas-obj
        mkdir libf77refblas-obj
        cd libf77refblas-obj && $(AR) x ../$<
        $(LIBTOOL) --tag=F77 --mode=link $(F77) \
            -o $@ libf77refblas-obj/*.o \
            -latlas \
            -rpath $(LIBINSTdir) -version-info $(VERSION)

liblapack.la: liblapack.a libatlas.la libcblas.la libf77blas.la
        -rm -r -f liblapack-obj
        mkdir liblapack-obj
        cd liblapack-obj && $(AR) x ../$<
        $(LIBTOOL) --tag=F77 --mode=link $(F77) \
            -o $@ liblapack-obj/*.o \
            -latlas -lcblas -lf77blas -lm \
            -rpath $(LIBINSTdir) -version-info $(VERSION)

libptlapack.la: libptlapack.a libatlas.la libptcblas.la libptf77blas.la
        -rm -r -f libptlapack-obj
        mkdir libptlapack-obj
        cd libptlapack-obj && $(AR) x ../$<
        $(LIBTOOL) --tag=F77 --mode=link $(F77) \
            -o $@ libptlapack-obj/*.o \
            -lpthread -latlas -lptcblas -lptf77blas -lm \
            -rpath $(LIBINSTdir) -version-info $(VERSION)


.PHONY: all build install clean

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Math-atlas-devel mailing list
Math-atlas-devel@...
https://lists.sourceforge.net/lists/listinfo/math-atlas-devel

Re: libtools and shared libraries

by whaley-8 :: Rate this Message:

| View Threaded | Show Only this Message

Volker,

Thanks for the code.  Can you explain what it is doing for you that the
normal build process doesn't?

Thanks,
Clint

>From math-atlas-devel-bounces@...  Sat Jun 23 14:40:32 2012
Return-Path: <math-atlas-devel-bounces@...>
X-Original-To: whaley@...
Delivered-To: whaley@...
Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of gmail.com
        designates 209.85.217.175 as permitted sender)
        client-ip=209.85.217.175; envelope-from=vbraun.name@...;
        helo=mail-lb0-f175.google.com;
Date: Sat, 23 Jun 2012 20:41:39 +0100
From: Volker Braun <vbraun.name@...>
To: math-atlas-devel@...
X-Headers-End: 1SiWDK-0002Je-Jt
Subject: [atlas-devel] libtools and shared libraries
X-BeenThere: math-atlas-devel@...
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: "List for developer discussion,
        NOT SUPPORT." <math-atlas-devel@...>
List-Id: "List for developer discussion,
        NOT SUPPORT." <math-atlas-devel.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/math-atlas-devel>,
        <mailto:math-atlas-devel-request@...?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=math-atlas-devel>
List-Post: <mailto:math-atlas-devel@...>
List-Help: <mailto:math-atlas-devel-request@...?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/math-atlas-devel>,
        <mailto:math-atlas-devel-request@...?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Errors-To: math-atlas-devel-bounces@...
X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on mail0.cs.utsa.edu
X-Spam-Level:
X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RCVD_BY_IP
        autolearn=ham version=3.0.2
Status: RO

As a followup to the recent shared libraries discussion, I have been
using the following makefile to build dynamic libraries from the
static libraries. For simplicity, the libraries are just mapped 1:1.
The compilation is without libtools, so it is up to the user to pass
-fPIC or whatever compiler option is required for shared libraries. I
haven't tested it yet on other platforms.


======================================================
# Replace with the actual destination directory
DESTDIR=/home/vbraun/Code/ATLAS/local
VERSION=3:0:1

# You shouldn't have to customize anything from here on

INCINSTdir=$(DESTDIR)/include
LIBINSTdir=$(DESTDIR)/lib

LIBTOOL=libtool
INSTALL=install
#### "make" default values
# AR=ar
# F77=f77
# CC=cc
# RM=rm


LIBS=libatlas.la \
        libcblas.la libptcblas.la \
        libf77blas.la libptf77blas.la \
        liblapack.la libptlapack.la


all: build install


build: $(LIBS)


clean:
        $(RM) -r -f $(wildcard *.la) $(wildcard *-obj)


install:
        mkdir -p $(LIBINSTdir)
        $(LIBTOOL) --mode=install $(INSTALL) -c libatlas.la $(LIBINSTdir)/libatlas.la
        $(LIBTOOL) --mode=install $(INSTALL) -c libcblas.la $(LIBINSTdir)/libcblas.la
        $(LIBTOOL) --mode=install $(INSTALL) -c libptcblas.la
$(LIBINSTdir)/libptcblas.la
        $(LIBTOOL) --mode=install $(INSTALL) -c libf77blas.la
$(LIBINSTdir)/libf77blas.la
        $(LIBTOOL) --mode=install $(INSTALL) -c libptf77blas.la
$(LIBINSTdir)/libptf77blas.la
        $(LIBTOOL) --mode=install $(INSTALL) -c liblapack.la $(LIBINSTdir)/liblapack.la
        $(LIBTOOL) --mode=install $(INSTALL) -c libptlapack.la
$(LIBINSTdir)/libptlapack.la
        $(LIBTOOL) --finish $(LIBINSTdir)


libatlas.la: libatlas.a
        -rm -r -f libatlas-obj
        mkdir libatlas-obj
        cd libatlas-obj && $(AR) x ../$<
        $(LIBTOOL) --tag=CC --mode=link $(CC) \
            -o $@ libatlas-obj/*.o \
            -lpthread -lm \
            -rpath $(LIBINSTdir) -version-info $(VERSION)


libcblas.la: libcblas.a libatlas.la
        -rm -r -f libcblas-obj
        mkdir libcblas-obj
        cd libcblas-obj && $(AR) x ../$<
        $(LIBTOOL) --tag=CC --mode=link $(CC) \
            -o $@ libcblas-obj/*.o \
            -latlas \
            -rpath $(LIBINSTdir) -version-info $(VERSION)


libptcblas.la: libptcblas.a libatlas.la
        -rm -r -f libptcblas-obj
        mkdir libptcblas-obj
        cd libptcblas-obj && $(AR) x ../$<
        $(LIBTOOL) --tag=CC --mode=link $(CC) \
            -o $@ libptcblas-obj/*.o \
            -lpthread -latlas \
            -rpath $(LIBINSTdir) -version-info $(VERSION)


libf77blas.la: libf77blas.a libatlas.la
        -rm -r -f libf77blas-obj
        mkdir libf77blas-obj
        cd libf77blas-obj && $(AR) x ../$<
        $(LIBTOOL) --tag=F77 --mode=link $(F77) \
            -o $@ libf77blas-obj/*.o \
            -latlas \
            -rpath $(LIBINSTdir) -version-info $(VERSION)

libptf77blas.la: libptf77blas.a libatlas.la
        -rm -r -f libptf77blas-obj
        mkdir libptf77blas-obj
        cd libptf77blas-obj && $(AR) x ../$<
        $(LIBTOOL) --tag=F77 --mode=link $(F77) \
            -o $@ libptf77blas-obj/*.o \
            -lpthread -latlas \
            -rpath $(LIBINSTdir) -version-info $(VERSION)

libf77refblas.la: libf77refblas.a
        -rm -r -f libf77refblas-obj
        mkdir libf77refblas-obj
        cd libf77refblas-obj && $(AR) x ../$<
        $(LIBTOOL) --tag=F77 --mode=link $(F77) \
            -o $@ libf77refblas-obj/*.o \
            -latlas \
            -rpath $(LIBINSTdir) -version-info $(VERSION)

liblapack.la: liblapack.a libatlas.la libcblas.la libf77blas.la
        -rm -r -f liblapack-obj
        mkdir liblapack-obj
        cd liblapack-obj && $(AR) x ../$<
        $(LIBTOOL) --tag=F77 --mode=link $(F77) \
            -o $@ liblapack-obj/*.o \
            -latlas -lcblas -lf77blas -lm \
            -rpath $(LIBINSTdir) -version-info $(VERSION)

libptlapack.la: libptlapack.a libatlas.la libptcblas.la libptf77blas.la
        -rm -r -f libptlapack-obj
        mkdir libptlapack-obj
        cd libptlapack-obj && $(AR) x ../$<
        $(LIBTOOL) --tag=F77 --mode=link $(F77) \
            -o $@ libptlapack-obj/*.o \
            -lpthread -latlas -lptcblas -lptf77blas -lm \
            -rpath $(LIBINSTdir) -version-info $(VERSION)


.PHONY: all build install clean

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Math-atlas-devel mailing list
Math-atlas-devel@...
https://lists.sourceforge.net/lists/listinfo/math-atlas-devel


**************************************************************************
** R. Clint Whaley, PhD ** Assist Prof, UTSA ** www.cs.utsa.edu/~whaley **
**************************************************************************

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Math-atlas-devel mailing list
Math-atlas-devel@...
https://lists.sourceforge.net/lists/listinfo/math-atlas-devel

Re: libtools and shared libraries

by Volker Braun :: Rate this Message:

| View Threaded | Show Only this Message

Some points that are important to Sage:

1) since Sage includes lots of upstream code we need shared libraries
that 1:1 map to the static libraries. There is no reason for 3rd party
code to know whether they are going to link static or dynamically.

2) Your manual $BUILD/lib/Makefile don't support gcc + Sun/Oracle ld,
which is the preferred way to build Sage on SPARC Solaris.

3) You also get the .la files, so it integrates better into the usual
autotools/libtools build process for code that wants to link to atlas

The Makefile that I posted was just some attempt to fix these. Its not
entirely finished since we also need to create a libtools script on
the build system, probably using a stub autoconf project.

Best,
Volker


On Wed, Jun 27, 2012 at 11:02 PM, Clint Whaley <whaley@...> wrote:
> Volker,
>
> Thanks for the code.  Can you explain what it is doing for you that the
> normal build process doesn't?
>
> Thanks,
> Clint

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Math-atlas-devel mailing list
Math-atlas-devel@...
https://lists.sourceforge.net/lists/listinfo/math-atlas-devel