[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compiling freebsd 5.1-RELEASE-p10 on 4.8-RELEASE



edelkind-debug@episec.com said this stuff:

> 'make buildworld' fails with the following error:
> 
> -------------------------------------------------------
> building shared library libkse.so.1
> thr_libc.So: In function `sigaction':
> thr_libc.So(.text+0x54): multiple definition of `_sigaction'
> thr_sigaction.So(.text+0x0): first defined here
> thr_libc.So: In function `sigprocmask':
> thr_libc.So(.text+0x34): multiple definition of `_sigprocmask'
> thr_sigprocmask.So(.text+0x0): first defined here
> *** Error code 1
> 
> Stop in /aux/cvsup/src/lib/libpthread.
> *** Error code 1
> -------------------------------------------------------
> 
> Target: FreeBSD 5.1-RELEASE-p10 (cvsup of RELENG_5_1, 2003/10/16)
> Origin: FreeBSD 4.8-RELEASE
> 

'make -d l' reveals the following:

    cc -nostdlib -L/usr/lib -o thr_libc.So -Wl,-x,-r thr_support.So -lc_pic

/usr/lib/libc_pic.a should not be linked with the new target -- it's
from 4.8-RELEASE, after all.  What buildworld really means to do is link
it with /usr/obj/usr/src/i386/usr/lib/libc_pic.a.

Unfortunately, /usr/obj/usr/src/i386/usr/lib/libc_pic.a doesn't exist,
because it wasn't installed when the build-requisite tree was populated.
It would seem that some lazy programmer "fixed" this by adding
-L/usr/lib instead of correcting it properly.  This problem may not show
up if 'make world' is used, but such an action is dangerous when
upgrading from 4.x to 5.x.

A test:

% cd /usr/obj/usr/src/lib/libpthread
% env PATH=../../i386/usr/bin cc -nostdlib -L../libc -o thr_libc.So \
	-Wl,-x,-r thr_support.So -lc_pic
% cd /usr/src
% make

This action successfully links libkse.so.1.


The proper solution:

Since we need to install lib/libc/libc_pic.a as an object prerequisite,
we need to add the directory to '_prebuild_libs' in the toplevel
Makefile.inc1 (i.e. /usr/src/...).  For example:

----------------------------------------------------[cut here]--
--- Makefile.inc1.orig  Thu Oct 16 20:11:47 2003
+++ Makefile.inc1       Thu Oct 16 20:12:50 2003
@@ -796,7 +796,7 @@
                lib/libncurses lib/libopie lib/libpam lib/libradius \
                lib/librpcsvc \
                lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
-               lib/libz lib/msun
+               lib/libz lib/msun lib/libc
 
 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
 lib/libypclnt__L: lib/librpcsvc__L
----------------------------------------------------[cut here]--

Then, of course, we must remove the erroneous '-L/usr/lib' from the
loader command line.

The offending option is in /usr/src/lib/libpthread/support/Makefile.inc:

----------------------------------------------------[cut here]--
--- Makefile.inc.orig   Thu Oct 16 20:20:56 2003
+++ Makefile.inc        Thu Oct 16 20:21:12 2003
@@ -6,5 +6,5 @@
 SOBJS+= thr_libc.So
 
 thr_libc.So: thr_support.So
-       ${CC} -nostdlib -L/usr/lib -o ${.TARGET} -Wl,-x,-r ${.ALLSRC} -lc_pic
+       ${CC} -nostdlib -o ${.TARGET} -Wl,-x,-r ${.ALLSRC} -lc_pic
 
----------------------------------------------------[cut here]--

And that should do it.

ari