Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Nov 2015 20:07:59 -0800
From:      Mark Millard <markmi@dsl-only.net>
To:        FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org>
Subject:   More 11.0-CURRENT: without adding -lmd linking various programs are getting undefined references
Message-ID:  <8AF435C1-9F0B-4466-9210-A54D7210B30C@dsl-only.net>
In-Reply-To: <E507F9AF-2818-4E6D-9538-A8670B079C8A@dsl-only.net>
References:  <01BA3FF2-F362-48FA-B9E2-112E05CC00ED@dsl-only.net> <6AA244B9-DE60-4D8B-A08E-AADD73F9D856@dsl-only.net> <106D9CB0-D9AE-4463-A03E-3AB16583CDA7@dsl-only.net> <E507F9AF-2818-4E6D-9538-A8670B079C8A@dsl-only.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Without the following explicit references to (lib)md or -lmd for =
programs (possibly indirectly) using libmd I get link failures during =
the build, such as:

/usr/obj/usr/src/tmp/usr/lib/./libulog.so: undefined reference to =
`_libmd_SHA1_Init'
/usr/obj/usr/src/tmp/usr/lib/./libulog.so: undefined reference to =
`_libmd_SHA1_Update'
/usr/obj/usr/src/tmp/usr/lib/./libulog.so: undefined reference to =
`_libmd_SHA1_Final'
. . .
/usr/obj/usr/src/tmp/usr/lib/./libzfs.so: undefined reference to =
`_libmd_SHA256_Update'
/usr/obj/usr/src/tmp/usr/lib/./libzfs.so: undefined reference to =
`_libmd_SHA256_Final'
/usr/obj/usr/src/tmp/usr/lib/./libzfs.so: undefined reference to =
`_libmd_SHA256_Init'
. . .

I am attempting to build for updating an 2015-Apr-18 vintage =
11.0-CURRENT, so it starts from a context back from before the renames =
to use the __libdm_ prefixes on the names. So for me no implicit =
bindings are being provided.

Some of my temporary(?) workarounds for this are:


Index: /usr/src/libexec/ulog-helper/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- /usr/src/libexec/ulog-helper/Makefile       (revision 291443)
+++ /usr/src/libexec/ulog-helper/Makefile       (working copy)
@@ -5,6 +5,6 @@
 BINMODE=3D4555
 MAN=3D
=20
-LIBADD=3D        ulog
+LIBADD=3D        ulog md

Index: /usr/src/cddl/sbin/zfs/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- /usr/src/cddl/sbin/zfs/Makefile     (revision 291443)
+++ /usr/src/cddl/sbin/zfs/Makefile     (working copy)
@@ -24,6 +24,6 @@
=20
 DPADD=3D ${LIBGEOM} ${LIBJAIL} ${LIBNVPAIR} ${LIBUMEM} \
        ${LIBUTIL} ${LIBUUTIL} ${LIBZFS_CORE} ${LIBZFS}
-LDADD=3D -lgeom -ljail -lnvpair -lumem -lutil -luutil -lzfs_core -lzfs
+LDADD=3D -lmd -lgeom -ljail -lnvpair -lumem -lutil -luutil -lzfs_core =
-lzfs
=20
 .include <bsd.prog.mk>

Index: /usr/src/cddl/sbin/zpool/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- /usr/src/cddl/sbin/zpool/Makefile   (revision 291443)
+++ /usr/src/cddl/sbin/zpool/Makefile   (working copy)
@@ -29,6 +29,6 @@
=20
 DPADD=3D ${LIBAVL} ${LIBGEOM} ${LIBNVPAIR} \
        ${LIBUMEM} ${LIBUTIL} ${LIBUUTIL} ${LIBZFS_CORE} ${LIBZFS}
-LDADD=3D -lavl -lgeom -lnvpair -lumem -lutil -luutil -lzfs_core -lzfs
+LDADD=3D -lmd -lavl -lgeom -lnvpair -lumem -lutil -luutil -lzfs_core =
-lzfs
=20
 .include <bsd.prog.mk>


Without those the results were:

--- ulog-helper.full ---
/usr/local/bin/powerpc64-portbld-freebsd11.0-gcc -O2 -pipe -isystem =
/usr/obj/usr/src/tmp/usr/include/. -L/usr/obj/usr/src/tmp/usr/lib/. =
-L/usr/obj/usr/src/tmp/li
b/. -g -std=3Dgnu99 -fstack-protector-strong -Wsystem-headers -Wall =
-Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes =
-Wmissing-prototypes -Wpointer-ari
th -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow =
-Wunused-parameter -Wcast-align -Wchar-subscripts -Winline =
-Wnested-externs -Wredundant-decls -Wol
d-style-definition -Wno-pointer-sign -Wformat=3D2 -Wno-format-extra-args =
 -L/usr/obj/usr/src/tmp/usr/lib/. -L/usr/obj/usr/src/tmp/lib/. =
-L/usr/obj/usr/src/lib/libc
++/. -L/usr/lib/. -o ulog-helper.full ulog-helper.o   -lulog
. . .
--- all_subdir_libexec ---
/usr/obj/usr/src/tmp/usr/lib/./libulog.so: undefined reference to =
`_libmd_SHA1_Init'
/usr/obj/usr/src/tmp/usr/lib/./libulog.so: undefined reference to =
`_libmd_SHA1_Update'
/usr/obj/usr/src/tmp/usr/lib/./libulog.so: undefined reference to =
`_libmd_SHA1_Final'
collect2: error: ld returned 1 exit status


. . .

--- all_subdir_cddl ---
/usr/local/bin/powerpc64-portbld-freebsd11.0-gcc -O2 -pipe -isystem =
/usr/obj/usr/src/tmp/usr/include/. -L/usr/obj/usr/src/tmp/usr/lib/. =
-L/usr/obj/usr/src/tmp/li
b/. =
-I/usr/src/cddl/sbin/zfs/../../../cddl/contrib/opensolaris/lib/libzpool/co=
mmon -I/usr/src/cddl/sbin/zfs/../../../cddl/compat/opensolaris/include =
-I/usr/src/c
ddl/sbin/zfs/../../../cddl/compat/opensolaris/lib/libumem =
-I/usr/src/cddl/sbin/zfs/../../../sys/cddl/compat/opensolaris =
-I/usr/src/cddl/sbin/zfs/../../../cddl/co
ntrib/opensolaris/head =
-I/usr/src/cddl/sbin/zfs/../../../cddl/contrib/opensolaris/lib/libuutil/co=
mmon -I/usr/src/cddl/sbin/zfs/../../../cddl/contrib/opensolaris/
lib/libzfs/common =
-I/usr/src/cddl/sbin/zfs/../../../cddl/contrib/opensolaris/lib/libzfs_core=
/common -I/usr/src/cddl/sbin/zfs/../../../cddl/contrib/opensolaris/li
b/libumem/common =
-I/usr/src/cddl/sbin/zfs/../../../cddl/contrib/opensolaris/lib/libnvpair =
-I/usr/src/cddl/sbin/zfs/../../../sys/cddl/contrib/opensolaris/uts/comm
on =
-I/usr/src/cddl/sbin/zfs/../../../sys/cddl/contrib/opensolaris/uts/common/=
fs/zfs =
-I/usr/src/cddl/sbin/zfs/../../../sys/cddl/contrib/opensolaris/uts/common/=
sys
 =
-I/usr/src/cddl/sbin/zfs/../../../sys/cddl/contrib/opensolaris/common/zfs =
-DNEED_SOLARIS_BOOLEAN -g -std=3Dgnu99 -fstack-protector-strong =
-Wno-pointer-sign -Wno-u
nknown-pragmas  -L/usr/obj/usr/src/tmp/usr/lib/. =
-L/usr/obj/usr/src/tmp/lib/. -L/usr/obj/usr/src/lib/libc++/. =
-L/usr/lib/. -o zfs.full zfs_main.o zfs_iter.o  -lg
eom -ljail -lnvpair -lumem -lutil -luutil -lzfs_core -lzfs
. . .
--- all_subdir_cddl ---
/usr/obj/usr/src/tmp/usr/lib/./libzfs.so: undefined reference to =
`_libmd_SHA256_Update'
/usr/obj/usr/src/tmp/usr/lib/./libzfs.so: undefined reference to =
`_libmd_SHA256_Final'
/usr/obj/usr/src/tmp/usr/lib/./libzfs.so: undefined reference to =
`_libmd_SHA256_Init'
collect2: error: ld returned 1 exit status
*** [zfs.full] Error code 1

. . .

--- all_subdir_sbin ---
../sys/cddl/contrib/opensolaris/uts/common =
-I/usr/src/cddl/sbin/zpool/../../../sys/cddl/contrib/opensolaris/uts/commo=
n/fs/zfs -I/usr/src/cddl/sbin/zpool/../../..
/sys/cddl/contrib/opensolaris/uts/common/sys =
-I/usr/src/cddl/sbin/zpool/../../../cddl/contrib/opensolaris/lib/libzpool/=
common -I/usr/src/cddl/sbin/zpool/../../..
/cddl/contrib/opensolaris/cmd/stat/common -DNEED_SOLARIS_BOOLEAN -g =
-std=3Dgnu99 -fstack-protector-strong -Wno-pointer-sign =
-Wno-unknown-pragmas  -L/usr/obj/usr/sr
c/tmp/usr/lib/. -L/usr/obj/usr/src/tmp/lib/. =
-L/usr/obj/usr/src/lib/libc++/. -L/usr/lib/. -o zpool.full zpool_main.o =
zpool_vdev.o zpool_iter.o zpool_util.o zfs_c
omutil.o timestamp.o  -lavl -lgeom -lnvpair -lumem -lutil -luutil =
-lzfs_core -lzfs
. . .
--- all_subdir_cddl ---
/usr/obj/usr/src/tmp/usr/lib/./libzfs.so: undefined reference to =
`_libmd_SHA256_Update'
/usr/obj/usr/src/tmp/usr/lib/./libzfs.so: undefined reference to =
`_libmd_SHA256_Final'
/usr/obj/usr/src/tmp/usr/lib/./libzfs.so: undefined reference to =
`_libmd_SHA256_Init'
collect2: error: ld returned 1 exit status
*** [zpool.full] Error code 1


The -L's ending with /.'s are from my /etc/src.conf . They are =
associated with trying to self-build on a powerpc64 PowerMac using only =
powerpc64-xtoolchain-gcc's powerpc64-gcc and with WITH_LIBCPLUSPLUS: =
powerpc64-gcc is acting as both the host toolchain and the =
CROSS_TOOLCHAIN. No 4.2.1 gcc is present. I know this is not a usual way =
of doing things. There may be better ways. But if I manage to expose =
some missing dependency tracking some good came of it.


Another example is zinject. I'm still going through them.


The make commands were:

> make -j 6 -DNO_CLEAN WITH_FAST_DEPEND=3D CROSS_TOOLCHAIN=3Dpowerpc64-gcc=
 WITH_LIBCPLUSPLUS=3D WITHOUT_CLANG_BOOTSTRAP=3D WITH_CLANG=3D =
WITH_CLANG_IS_CC=3D WITH_LLDB=3D WITHOUT_GCC_BOOTSTRAP=3D WITHOUT_GCC=3D =
WITHOUT_GNUCXX=3D WITHOUT_BOOT=3D WITHOUT_LIB32=3D buildworld =
buildkernel KERNCONF=3DGENERIC64vtsc-NODEBUG TARGET=3Dpowerpc =
TARGET_ARCH=3Dpowerpc64

(The NO_CLEAN is from after the first build problem and is to avoid long =
rebuild times to get back to the same point.)

Context details if you care:

> # freebsd-version -ku; uname -aKU
> 11.0-CURRENT
> 11.0-CURRENT
> FreeBSD FBSDG5C0 11.0-CURRENT FreeBSD 11.0-CURRENT #12 r281630M: Sat =
Apr 18 01:15:13 PDT 2015     =
root@FBSDG5C0:/usr/obj/usr/src/sys/GENERIC64vtsc-NODEBUG  powerpc =
1100070 1100070

I am attempting an update after having been away from the PowerMacs for =
months.

> # svnlite info /usr/src
> Path: /usr/src
> Working Copy Root Path: /usr/src
> URL: https://svn0.us-west.freebsd.org/base/head
> Relative URL: ^/head
> Repository Root: https://svn0.us-west.freebsd.org/base
> Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
> Revision: 291443
> Node Kind: directory
> Schedule: normal
> Last Changed Author: nwhitehorn
> Last Changed Rev: 291442
> Last Changed Date: 2015-11-28 23:16:08 -0800 (Sat, 28 Nov 2015)

> # more /etc/src.conf
> NO_WERROR=3D
> WITH_DEBUG=3D
> WITH_DEBUG_FILES=3D
> MALLOC_PRODUCTION=3D
> CC=3D/usr/local/bin/powerpc64-portbld-freebsd11.0-gcc
> CXX=3D/usr/local/bin/powerpc64-portbld-freebsd11.0-g++
> CPP=3D/usr/local/bin/powerpc64-portbld-freebsd11.0-cpp
> CROSS_BINUTILS_PREFIX=3D/usr/local/powerpc64-freebsd/bin/
> X_COMPILER_TYPE=3Dgcc
> DEPFLAGS+=3D-isystem /usr/obj/usr/src/tmp/usr/include/. =
-I/usr/obj/usr/src/tmp/usr/include/c++/v1/. -I/usr/include/c++/v1/.
> L/usr/obj/usr/src/tmp/usr/lib/lib32/.
> CFLAGS+=3D-isystem /usr/obj/usr/src/tmp/usr/include/. =
-L/usr/obj/usr/src/tmp/usr/lib/. -L/usr/obj/usr/src/tmp/lib/.
> LDFLAGS+=3D-L/usr/obj/usr/src/tmp/usr/lib/. =
-L/usr/obj/usr/src/tmp/lib/.
> CXXFLAGS+=3D-isystem /usr/obj/usr/src/tmp/usr/include/. =
-I/usr/obj/usr/src/tmp/usr/include/c++/v1/. -std=3Dgnu++11 =
-L/usr/obj/usr/src/lib/libc++/.
> LDFLAGS+=3D-L/usr/obj/usr/src/lib/libc++/.
> CXXFLAGS+=3D-I/usr/include/c++/v1/. -std=3Dgnu++11 -L/usr/lib/.
> LDFLAGS+=3D-L/usr/lib/.

> # svnlite info /usr/ports/
> Path: /usr/ports
> Working Copy Root Path: /usr/ports
> URL: https://svn0.us-west.freebsd.org/ports/head
> Relative URL: ^/head
> Repository Root: https://svn0.us-west.freebsd.org/ports
> Repository UUID: 35697150-7ecd-e111-bb59-0022644237b5
> Revision: 402562
> Node Kind: directory
> Schedule: normal
> Last Changed Author: rene
> Last Changed Rev: 402562
> Last Changed Date: 2015-11-28 15:08:03 -0800 (Sat, 28 Nov 2015)

=3D=3D=3D
Mark Millard
markmi at dsl-only.net






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8AF435C1-9F0B-4466-9210-A54D7210B30C>