Current-Users archive

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

Re: build fails with libblacklist



Hi,

On 2016/01/01 21:27, Matthias Scheler wrote:
(But why the absence of libpthread cannot be detected by DPADD macro?)

The problem is that "LIBPTHREAD" is documented in "bsd.README" but is
not set to anything as far as I can tell:

tron@lyssa:/usr/src/external/bsd/blacklist/lib>cvs diff -u
cvs diff: Diffing .
Index: Makefile
===================================================================
RCS file: /cvsroot/src/external/bsd/blacklist/lib/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- Makefile    30 Dec 2015 17:57:20 -0000      1.5
+++ Makefile    1 Jan 2016 12:25:37 -0000
@@ -16,3 +16,8 @@
  MLINKS+=libblacklist.3 blacklist_sa_r.3

  .include <bsd.lib.mk>
+
+print-stuff:
+       @echo "1:${DPADD}"
+       @echo "2:${LIBPTHREAD}"
+
tron@lyssa:/usr/src/external/bsd/blacklist/lib>make print-stuff
1: /usr/src/external/bsd/blacklist/lib/shlib_version
2:

christos@ added LIBPTHREAD variable to bsd.hostprog.mk, but it doesn't
work as expected; output of "make print-stuff" does not change. LIBXXX
variables, that are described in bsd.README, are set in a for-loop in
bsd.prog.mk, and thus cannot be used for libraries. We have to use
LIBDPLIBS macro instead of using LDADD/DPADD directly:

  % pwd
  /var/build/src/external/bsd/blacklist/lib
  % diff -u Makefile.orig Makefile
  --- Makefile.orig       2016-01-04 20:07:40.000000000 +0900
  +++ Makefile    2016-01-04 21:38:18.000000000 +0900
  @@ -3,8 +3,7 @@
   USE_SHLIBDIR=   yes
CPPFLAGS+=-D_REENTRANT
  -DPADD+=${LIBPTHREAD}
  -LDADD+=-lpthread
  +LIBDPLIBS+=pthread ${NETBSDSRCDIR}/lib/libpthread
   LIB=blacklist
   SRCS=bl.c blacklist.c
   MAN=libblacklist.3
  @@ -16,3 +15,7 @@
   MLINKS+=libblacklist.3 blacklist_sa_r.3
.include <bsd.lib.mk>
  +
  +print-stuff:
  +       @echo "LDADD=${LDADD}"
  +       @echo "DPADD=${DPADD}"
  % make print-stuff
  LDADD=-L/var/build/src/lib/libpthread/obj -lpthread
  DPADD=/var/build/src/lib/libpthread/obj/libpthread.so /var/build/src/external/bsd/blacklist/lib/shlib_version
  %

I'm still investigating why it is not set. The problem is however not
specific to "external/bsd/blacklist". This variable isn't set anywhere
as far as I can tell:

tron@lyssa:/usr/src/external/gpl3/gcc/lib/libtsan>cvs diff -u
cvs diff: Diffing .
Index: Makefile
===================================================================
RCS file: /cvsroot/src/external/gpl3/gcc/lib/libtsan/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- Makefile    7 Jan 2015 03:49:13 -0000       1.2
+++ Makefile    1 Jan 2016 12:27:12 -0000
@@ -65,3 +65,7 @@
  DPADD+= ${LIBSTDCXX} ${LIBPTHREAD}

  .include <bsd.lib.mk>
+
+print-stuff:
+       @echo "1:${DPADD}"
+       @echo "2:${LIBPTHREAD}"
tron@lyssa:/usr/src/external/gpl3/gcc/lib/libtsan>make print-stuff
1:  /usr/src/external/gpl3/gcc/lib/libtsan/shlib_version
2:

This library is just the only place where this causes a build problem
due to the ordering.

This is also resolved by using LIBDPLIBS macro:

  % pwd
  /var/build/src/external/gpl3/gcc/lib/libtsan
  % diff -u Makefile.orig Makefile
  --- Makefile.orig       2016-01-04 20:07:48.000000000 +0900
  +++ Makefile    2016-01-04 21:40:06.000000000 +0900
  @@ -61,7 +61,11 @@
   SRCS=  ${TSAN_SRCS} ${INTERCEPTION_SRCS} ${SANITIZER_SRCS}
   CPPFLAGS+=-I${TSAN}/include -I${TSAN}
-LDADD+= -lstdc++ -lpthread
  -DPADD+= ${LIBSTDCXX} ${LIBPTHREAD}
  +LIBDPLIBS+=    stdc++  ${.CURDIR}/../libstdc++-v3 \
  +               pthread ${NETBSDSRCDIR}/lib/libpthread
.include <bsd.lib.mk>
  +
  +print-stuff:
  +       @echo "LDADD=${LDADD}"
  +       @echo "DPADD=${DPADD}"
  % make print-stuff
  LDADD=-L/var/build/src/external/gpl3/gcc/lib/libstdc++-v3 -lstdc++ -L/var/build/src/lib/libpthread/obj -lpthread
  DPADD=/var/build/src/external/gpl3/gcc/lib/libstdc++-v3/libstdc++.so /var/build/src/lib/libpthread/obj/libpthread.so /var/build/src/external/gpl3/gcc/lib/libtsan/shlib_version
  %

I also found some other inappropriate usages of LDADD/DPADD macros.
I attached the patch to address these problems. I'll send-pr if it
is preferable.

Thanks,
Rin
==========
--- ./src/external/bsd/blacklist/lib/Makefile.orig	2016-01-04 19:18:13.000000000 +0900
+++ ./src/external/bsd/blacklist/lib/Makefile	2016-01-04 19:19:26.000000000 +0900
@@ -3,8 +3,7 @@
 USE_SHLIBDIR=   yes
CPPFLAGS+=-D_REENTRANT
-DPADD+=${LIBPTHREAD}
-LDADD+=-lpthread
+LIBDPLIBS+=pthread ${NETBSDSRCDIR}/lib/libpthread
 LIB=blacklist
 SRCS=bl.c blacklist.c
 MAN=libblacklist.3
--- ./src/external/bsd/elftoolchain/lib/libdwarf/Makefile.orig	2016-01-04 19:18:13.000000000 +0900
+++ ./src/external/bsd/elftoolchain/lib/libdwarf/Makefile	2016-01-04 19:20:39.000000000 +0900
@@ -84,8 +84,7 @@
 CLEANFILES=	${GENSRCS}
 CPPFLAGS+=	-I. -I${SRCDIR} -I${TOP}/common -I${TOP}/libelf
-LDADD+= -lelf
-DPADD+=		${LIBELF}
+LIBDPLIBS+=	elf ${.CURDIR}/../libelf
SHLIB_MAJOR= 1
 SHLIB_MINOR=	0
@@ -332,4 +331,3 @@
 .SUFFIXES:	.m4 .c
 .m4.c:
 	${TOOL_M4} -D SRCDIR=${SRCDIR} ${M4FLAGS} ${.IMPSRC} > ${.TARGET}
-
--- ./src/external/bsd/fetch/lib/Makefile.orig	2016-01-04 19:21:12.000000000 +0900
+++ ./src/external/bsd/fetch/lib/Makefile	2016-01-04 19:21:30.000000000 +0900
@@ -18,8 +18,6 @@
 .if (${MKCRYPTO} != "no")
 CPPFLAGS+=	-DWITH_SSL
-LDADD= -lssl -lcrypto
-
 LIBDPLIBS+=	ssl	${NETBSDSRCDIR}/crypto/external/bsd/openssl/lib/libssl \
 		crypto	${NETBSDSRCDIR}/crypto/external/bsd/openssl/lib/libcrypto
 .endif
--- ./src/external/bsd/libc++/lib/Makefile.orig	2016-01-04 19:56:05.000000000 +0900
+++ ./src/external/bsd/libc++/lib/Makefile	2016-01-04 20:01:20.000000000 +0900
@@ -44,6 +44,6 @@
 CWARNFLAGS.clang+=	-Wno-error=missing-field-initializers -Wno-error=switch
 CWARNFLAGS.clang+=	-Wno-error=implicit-exception-spec-mismatch
-LDADD+= -Wl,-z,defs
+LDFLAGS+=	-Wl,-z,defs
.include <bsd.lib.mk>
--- ./src/external/gpl2/lvm2/lib/liblvm/Makefile.orig	2016-01-04 19:25:46.000000000 +0900
+++ ./src/external/gpl2/lvm2/lib/liblvm/Makefile	2016-01-04 19:32:56.000000000 +0900
@@ -43,8 +43,6 @@
 		filter_netbsd.c snapshot.c mirrored.c dev_manager.c fs.c dev.c \
 		lvm-globals.c
-LDADD+= -lprop
-
 .PATH:	${LVM2_DISTDIR}/lib/
 .PATH:	${LVM2_DISTDIR}/lib/activate
 .PATH:	${LVM2_DISTDIR}/lib/cache
--- ./src/external/gpl3/gcc/lib/libtsan/Makefile.orig	2016-01-04 19:18:20.000000000 +0900
+++ ./src/external/gpl3/gcc/lib/libtsan/Makefile	2016-01-04 19:34:12.000000000 +0900
@@ -61,7 +61,7 @@
 SRCS=	${TSAN_SRCS} ${INTERCEPTION_SRCS} ${SANITIZER_SRCS}
 CPPFLAGS+=-I${TSAN}/include -I${TSAN}
-LDADD+= -lstdc++ -lpthread
-DPADD+= ${LIBSTDCXX} ${LIBPTHREAD}
+LIBDPLIBS+=	stdc++	${.CURDIR}/../libstdc++-v3 \
+		pthread	${NETBSDSRCDIR}/lib/libpthread
.include <bsd.lib.mk>
--- ./src/external/gpl3/gcc.old/lib/libtsan/Makefile.orig	2016-01-04 19:18:22.000000000 +0900
+++ ./src/external/gpl3/gcc.old/lib/libtsan/Makefile	2016-01-04 19:55:22.000000000 +0900
@@ -61,7 +61,7 @@
 SRCS=	${TSAN_SRCS} ${INTERCEPTION_SRCS} ${SANITIZER_SRCS}
 CPPFLAGS+=-I${TSAN}/include -I${TSAN}
-LDADD+= -lstdc++ -lpthread
-DPADD+= ${LIBSTDCXX} ${LIBPTHREAD}
+LIBDPLIBS+=	stdc++	${.CURDIR}/../libstdc++-v3 \
+		pthread	${NETBSDSRCDIR}/lib/libpthread
.include <bsd.lib.mk>
--- ./src/external/mit/xorg/lib/libfontenc/Makefile.orig	2016-01-04 19:18:23.000000000 +0900
+++ ./src/external/mit/xorg/lib/libfontenc/Makefile	2016-01-04 19:59:21.000000000 +0900
@@ -15,8 +15,7 @@
 CPPFLAGS+=	-DFONT_ENCODINGS_DIRECTORY=\"${X11FONTDIR}/encodings/encodings.dir\"
 CPPFLAGS+=	-I${DESTDIR}${X11INCDIR}/X11/fonts
-LDADD+= -lz
-DPADD+=	${LIBZ}
+LIBDPLIBS+=	z ${NETBSDSRCDIR}/lib/libz
PKGCONFIG= fontenc --- ./src/external/mit/xorg/lib/libglut/Makefile.orig 2016-01-04 19:18:23.000000000 +0900
+++ ./src/external/mit/xorg/lib/libglut/Makefile	2016-01-04 19:35:19.000000000 +0900
@@ -69,8 +69,7 @@
 		GL	${.CURDIR}/../libGL \
 		GLU	${.CURDIR}/../libGLU
-LDADD+= -lm
-DPADD+=		${LIBM}
+LIBDPLIBS+=	m ${NETBSDSRCDIR}/lib/libm
PKGCONFIG= glut
 PKGDIST.glut=	${X11SRCDIR.MesaGLUT}/src/glut/glx
--- ./src/external/mit/xorg/lib/libpciaccess/Makefile.orig	2016-01-04 19:18:23.000000000 +0900
+++ ./src/external/mit/xorg/lib/libpciaccess/Makefile	2016-01-04 19:35:48.000000000 +0900
@@ -30,21 +30,19 @@
PKGDIST= ${LIB} -LDADD+= -lpci -lz
-DPADD+=	${LIBPCI} ${LIBZ}
+LIBDPLIBS+=	pci	${NETBSDSRCDIR}/lib/libpci \
+		z	${NETBSDSRCDIR}/lib/libz
.if ${XORG_MACHINE_ARCH} == "i386" || ${XORG_MACHINE_ARCH} == "x86_64"
 CPPFLAGS+=	-DHAVE_MTRR
 .endif
.if ${XORG_MACHINE_ARCH} == "i386"
-LDADD+=	-li386
-DPADD+=	${LIBI386}
+LIBDPLIBS+=	i386 ${NETBSDSRCDIR}/lib/libarch
 .endif
.if ${XORG_MACHINE_ARCH} == "x86_64"
-LDADD+=	-lx86_64
-DPADD+=	${LIBX86_64}
+LIBDPLIBS+=	x86_64 ${NETBSDSRCDIR}/lib/libarch
 .endif
.include <bsd.x11.mk>
--- ./src/external/public-domain/xz/lib/Makefile.orig	2016-01-04 19:18:23.000000000 +0900
+++ ./src/external/public-domain/xz/lib/Makefile	2016-01-04 20:00:30.000000000 +0900
@@ -85,7 +85,6 @@
CLEANFILES+= liblzma.pc -LDADD+= -lpthread
-DPADD+=	${LIBPTHREAD}
+LIBDPLIBS+=	pthread ${NETBSDSRCDIR}/lib/libpthread
.include <bsd.lib.mk>
--- ./src/lib/libnpf/Makefile.orig	2016-01-04 19:18:24.000000000 +0900
+++ ./src/lib/libnpf/Makefile	2016-01-04 19:38:10.000000000 +0900
@@ -13,8 +13,6 @@
 INCSDIR=	/usr/include
LIBDPLIBS+= prop ${.CURDIR}/../libprop
-LDADD+=		-lprop
-DPADD+=		${LIBPROP}
WARNS= 5
 NOLINT=		# disabled deliberately
--- ./src/sys/rump/kern/lib/libsljit/Makefile.orig	2016-01-04 19:40:53.000000000 +0900
+++ ./src/sys/rump/kern/lib/libsljit/Makefile	2016-01-04 19:41:47.000000000 +0900
@@ -33,7 +33,7 @@
 RUMPCOMP_USER_CPPFLAGS=-I${RUMPCOMP_INCS_DIR}
# Link to libarm to get arm_sync_icache(2)
-LDADD+=	-larm
+LIBDPLIBS+=	arm ${NETBSDSRCDIR}/lib/libarch
 .endif
.include <bsd.lib.mk>

Home | Main Index | Thread Index | Old Index