Re: [HACKERS] linux, bsd, i386-solaris and univel shared libraries.

From: Alen Zekulic <azekulic(at)fesb(dot)hr>
To: Michael Meskes <meskes(at)topsystem(dot)de>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] linux, bsd, i386-solaris and univel shared libraries.
Date: 1998-04-24 11:28:10
Message-ID: 19980424132810.A801@fesb.hr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Apr 24, 1998 at 11:18:27 +0200, Michael Meskes wrote:

> Darren King writes:
> >
> > For the linux, bsd, i386-solaris and univel ports, ...
> >
> > If I were to try to make foo$(DLSUFFIX) from bar.c and bah.c, I would
> > think the general sequence of events would be:
> >
> > 1. $(CC) $(CFLAGS_SL) -o bar.o bar.c
> > 2. $(CC) $(CFLAGS_SL) -o bah.o bah.c
> > 3. $(LD) $(LDFLAGS_SL) -r -o foo.o bar.o bah.o
> > 4. $(LD) $(LDFLAGS_SL) -o foo$(DLSUFFIX) foo.o
> >
> > Could someone for each port tell me what $(CFLAGS_SL) and $(LDFLAGS_SL)
> > are needed for each of these steps?
>
> Linux:
>
> CFLAGS_SL: -fpic
^^^^
The shared library must be compiled with `-fPIC', and the static version
must not be. In other words, each `*.c' file is compiled twice.

> LDFLAGS_SL: -shared -soname foo$(DLSUFFIX_WITH_MAJOR_VERSION_NUMBER)
>
> I hope I didn't miss anything.

Take a look at the debian policy manual :-)).

Here is the patch against the `ecpg/lib/Makefile.in'.

======================Makefile.in.patch===============================
--- Makefile.in.old Wed Apr 22 13:36:00 1998
+++ Makefile.in Fri Apr 24 12:59:34 1998
@@ -22,3 +22,2 @@
LDFLAGS_SL = -shared -soname libecpg.so.$(SO_MAJOR_VERSION)
- CFLAGS += $(CFLAGS_SL)
endif
@@ -48,4 +47,4 @@

-$(shlib): ecpglib.o typename.o
- $(LD) $(LDFLAGS_SL) -o $@ ecpglib.o typename.o
+$(shlib): ecpglib.sho typename.sho
+ $(LD) $(LDFLAGS_SL) -o $@ ecpglib.sho typename.sho
ln -sf $@ libecpg.so
@@ -53,3 +52,3 @@
clean:
- rm -f *.o *.a core a.out *~ $(shlib) libecpg.so
+ rm -f *.o *.sho *.a core a.out *~ $(shlib) libecpg.so

@@ -71,4 +70,9 @@
ecpglib.o : ecpglib.c ../include/ecpglib.h ../include/ecpgtype.h
- $(CC) $(CFLAGS) -I../include $(PQ_INCLUDE) -c ecpglib.c
+ $(CC) $(CFLAGS) -I../include $(PQ_INCLUDE) -c $< -o $@
typename.o : typename.c ../include/ecpgtype.h
- $(CC) $(CFLAGS) -I../include $(PQ_INCLUDE) -c typename.c
+ $(CC) $(CFLAGS) -I../include $(PQ_INCLUDE) -c $< -o $@
+
+ecpglib.sho : ecpglib.c ../include/ecpglib.h ../include/ecpgtype.h
+ $(CC) $(CFLAGS) $(CFLAGS_SL) -I../include $(PQ_INCLUDE) -c $< -o $@
+typename.sho : typename.c ../include/ecpgtype.h
+ $(CC) $(CFLAGS) $(CFLAGS_SL) -I../include $(PQ_INCLUDE) -c $< -o $@
======================Makefile.in.patch===============================

Regards,

-- Alen

----------------------------------------------------------------------
Alen Zekulic <azekulic(at)debian(dot)org>
Key fingerprint = 47 82 56 37 1D 94 94 F8 16 C1 D8 33 1D 9D 61 73

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Meskes 1998-04-24 11:33:05 Re: [HACKERS] linux, bsd, i386-solaris and univel shared libraries.
Previous Message Zeugswetter Andreas SARZ 1998-04-24 10:28:54 Re: [HACKERS] linux, bsd, i386-solaris and univel shared librarie s.