Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group