Re: [PATCH] Add libraries to Makefiles.
On Wed, 2023-01-18 at 12:41 +0100, Samuel Thibault wrote: > I'm not talking about libz.so, but about libstore.so. Is that > libstore.so really a shared library that has libz in NEEDED? If so > there is really no need to add -lz to linking storeio. Unless you > actually send us the actual error message you get without an explicit > -lz, we can't know why you'd have to add -lz. > I compiled hurd-git natively, and no patches for zlib were needed. However cross-building errors out: /cross-tools/bin/i686-pc-gnu-gcc -shared -Wl,-soname=libstore.so.0.3 -o libstore.so.0.3 \ -L. -L../libfshelp/ -L../libihash/ -L../libiohelp/ -L../libpager/ -L../libports/ -L../libshouldbeinlibc/ -Wl,-rpath-link=../libfshelp/ - Wl,-rpath-link=../libihash/ -Wl,-rpath-link=../libiohelp/ -Wl,-rpath- link=../libpager/ -Wl,-rpath-link=../libports/ -Wl,-rpath- link=../libshouldbeinlibc/ -std=gnu99 -fgnu89-inline -Wall -g -O3 -fno- strict-aliasing -g -O2 -Wl,-verbose,-L/tools/lib \ '-Wl,-(' create_pic.o derive_pic.o make_pic.o rdwr_pic.o set_pic.o enc_pic.o encode_pic.o decode_pic.o clone_pic.o argp_pic.o kids_pic.o flags_pic.o open_pic.o xinl_pic.o typed_pic.o map_pic.o url_pic.o unknown_pic.o stripe_pic.o copy_pic.o device_pic.o file_pic.o memobj_pic.o module_pic.o mvol_pic.o nbd_pic.o remap_pic.o task_pic.o zero_pic.o gunzip_pic.o do-gunzip_pic.o util_pic.o ../libshouldbeinlibc/libshouldbeinlibc.so \ -ldl -lpthread -lz \ '-Wl,-)' libz.so needed by ../libstore/libstore.so ... /cross-tools/lib/gcc/i686-pc-gnu/12.2.0/../../../../i686-pc-gnu/bin/ld: warning: libz.so, needed by ../libstore/libstore.so, not found (try using -rpath or -rpath-link) Adding -Wl,-rpath-link,$TARGET_ROOT/lib to LDFLAGS fixes the problem. Thanks!
Re: [PATCH] Add libraries to Makefiles.
Svante Signell, le mer. 18 janv. 2023 12:36:55 +0100, a ecrit: > On Wed, 2023-01-18 at 11:54 +0100, Samuel Thibault wrote: > > > > Then you need to check that the linking of e.g. storeio does use the > > shared library and not the static library. For instance you can re-run > > the corresponding linking command and add -Wl,-verbose to check in the > > verbose output which precise libstore file it takes. > > > /cross-tools/bin/i686-pc-gnu-gcc -L. -L../libbpf/ -L../libcons/ - > L../libdiskfs/ -L../libfshelp/ -L../libftpconn/ -L../libhurdbugaddr/ - > L../libhurd-slab/ -L../libihash/ -L../libiohelp/ -L../libmachdev/ - > L../libnetfs/ -L../libpager/ -L../libpipe/ -L../libports/ -L../libps/ - > L../libshouldbeinlibc/ -L../libstore/ -L../libtrivfs/ -Wl,-rpath- > link=../libbpf/ -Wl,-rpath-link=../libcons/ -Wl,-rpath- > link=../libdiskfs/ -Wl,-rpath-link=../libfshelp/ -Wl,-rpath- > link=../libftpconn/ -Wl,-rpath-link=../libhurdbugaddr/ -Wl,-rpath- > link=../libhurd-slab/ -Wl,-rpath-link=../libihash/ -Wl,-rpath- > link=../libiohelp/ -Wl,-rpath-link=../libmachdev/ -Wl,-rpath- > link=../libnetfs/ -Wl,-rpath-link=../libpager/ -Wl,-rpath- > link=../libpipe/ -Wl,-rpath-link=../libports/ -Wl,-rpath-link=../libps/ > -Wl,-rpath-link=../libshouldbeinlibc/ -Wl,-rpath-link=../libstore/ - > Wl,-rpath-link=../libtrivfs/ -std=gnu99 -fgnu89-inline -Wall -g -O3 - > fno-strict-aliasing -g -O2 -Wl,-verbose,-L/tools/lib -lblkid -luuid - > lz -lncursesw -ltinfow -ldl -uargp_program_bug_address -o storeio \ > dev.o storeio.o open.o pager.o io.o \ > '-Wl,-(' ../libhurdbugaddr/libhurdbugaddr.so > ../libtrivfs/libtrivfs.so ../libpager/libpager.so > ../libfshelp/libfshelp.so ../libiohelp/libiohelp.so > ../libstore/libstore.so ../libports/libports.so ../libihash/libihash.so > ../libshouldbeinlibc/libshouldbeinlibc.so \ > -lpthread -lz \ > '-Wl,-)' > ... > > attempt to open /tools/lib/libz.so succeeded > /tools/lib/libz.so I'm not talking about libz.so, but about libstore.so. Is that libstore.so really a shared library that has libz in NEEDED? If so there is really no need to add -lz to linking storeio. Unless you actually send us the actual error message you get without an explicit -lz, we can't know why you'd have to add -lz. Samuel
Re: [PATCH] Add libraries to Makefiles.
On Wed, 2023-01-18 at 11:54 +0100, Samuel Thibault wrote: > > Then you need to check that the linking of e.g. storeio does use the > shared library and not the static library. For instance you can re-run > the corresponding linking command and add -Wl,-verbose to check in the > verbose output which precise libstore file it takes. /cross-tools/bin/i686-pc-gnu-gcc -L. -L../libbpf/ -L../libcons/ - L../libdiskfs/ -L../libfshelp/ -L../libftpconn/ -L../libhurdbugaddr/ - L../libhurd-slab/ -L../libihash/ -L../libiohelp/ -L../libmachdev/ - L../libnetfs/ -L../libpager/ -L../libpipe/ -L../libports/ -L../libps/ - L../libshouldbeinlibc/ -L../libstore/ -L../libtrivfs/ -Wl,-rpath- link=../libbpf/ -Wl,-rpath-link=../libcons/ -Wl,-rpath- link=../libdiskfs/ -Wl,-rpath-link=../libfshelp/ -Wl,-rpath- link=../libftpconn/ -Wl,-rpath-link=../libhurdbugaddr/ -Wl,-rpath- link=../libhurd-slab/ -Wl,-rpath-link=../libihash/ -Wl,-rpath- link=../libiohelp/ -Wl,-rpath-link=../libmachdev/ -Wl,-rpath- link=../libnetfs/ -Wl,-rpath-link=../libpager/ -Wl,-rpath- link=../libpipe/ -Wl,-rpath-link=../libports/ -Wl,-rpath-link=../libps/ -Wl,-rpath-link=../libshouldbeinlibc/ -Wl,-rpath-link=../libstore/ - Wl,-rpath-link=../libtrivfs/ -std=gnu99 -fgnu89-inline -Wall -g -O3 - fno-strict-aliasing -g -O2 -Wl,-verbose,-L/tools/lib -lblkid -luuid - lz -lncursesw -ltinfow -ldl -uargp_program_bug_address -o storeio \ dev.o storeio.o open.o pager.o io.o \ '-Wl,-(' ../libhurdbugaddr/libhurdbugaddr.so ../libtrivfs/libtrivfs.so ../libpager/libpager.so ../libfshelp/libfshelp.so ../libiohelp/libiohelp.so ../libstore/libstore.so ../libports/libports.so ../libihash/libihash.so ../libshouldbeinlibc/libshouldbeinlibc.so \ -lpthread -lz \ '-Wl,-)' ... attempt to open /tools/lib/libz.so succeeded /tools/lib/libz.so Same stuff when linking other executables, e.g. pflocal, pfinet, etc
Re: [PATCH] Add libraries to Makefiles.
Svante Signell, le mer. 18 janv. 2023 11:34:32 +0100, a ecrit: > On Wed, 2023-01-18 at 11:10 +0100, Samuel Thibault wrote: > > > > That's not enough information: I'm asking about your cross-toolchain. > > > > Do you actually get e.g. libstore/libstore.so for instance? > > If so, run objdump -x on it and check that libz is indeed in NEEDED. > > That's what is supposed to save having to add -lz everywhere. > > /tools/lib/libstore.so > /tools/lib/libstore.so.0.3 > objdump -x /tools/lib/libstore.so.0.3 | less > Dynamic Section: > NEEDED libblkid.so.1 > NEEDED libuuid.so.1 > NEEDED libz.so > NEEDED libncursesw.so.6 > NEEDED libtinfow.so.6 > NEEDED libshouldbeinlibc.so.0.3 > NEEDED libpthread.so.0.3 > NEEDED libc.so.0.3 > NEEDED libmachuser.so.1 > NEEDED libhurduser.so.0.3 > SONAME libstore.so.0.3 Then you need to check that the linking of e.g. storeio does use the shared library and not the static library. For instance you can re-run the corresponding linking command and add -Wl,-verbose to check in the verbose output which precise libstore file it takes. Samuel
Re: [PATCH] Add libraries to Makefiles.
On Wed, 2023-01-18 at 11:10 +0100, Samuel Thibault wrote: > > That's not enough information: I'm asking about your cross-toolchain. > > Do you actually get e.g. libstore/libstore.so for instance? > If so, run objdump -x on it and check that libz is indeed in NEEDED. > That's what is supposed to save having to add -lz everywhere. /tools/lib/libstore.so /tools/lib/libstore.so.0.3 objdump -x /tools/lib/libstore.so.0.3 | less Dynamic Section: NEEDED libblkid.so.1 NEEDED libuuid.so.1 NEEDED libz.so NEEDED libncursesw.so.6 NEEDED libtinfow.so.6 NEEDED libshouldbeinlibc.so.0.3 NEEDED libpthread.so.0.3 NEEDED libc.so.0.3 NEEDED libmachuser.so.1 NEEDED libhurduser.so.0.3 SONAME libstore.so.0.3 ...
Re: [PATCH] Add libraries to Makefiles.
Svante Signell, le mer. 18 janv. 2023 11:05:17 +0100, a ecrit: > On Wed, 2023-01-18 at 01:54 +0100, Samuel Thibault wrote: > > But none of these directories are actually using libz, so it doesn't > > make sense to make them use -lz. > > > > Are you sure that your cross-toolchain supports linking shared > > libraries? > > Here are the configure flags: That's not enough information: I'm asking about your cross-toolchain. Do you actually get e.g. libstore/libstore.so for instance? If so, run objdump -x on it and check that libz is indeed in NEEDED. That's what is supposed to save having to add -lz everywhere. Samuel
Re: [PATCH] Add libraries to Makefiles.
On Wed, 2023-01-18 at 01:54 +0100, Samuel Thibault wrote: > Hello, > > But none of these directories are actually using libz, so it doesn't > make sense to make them use -lz. > > Are you sure that your cross-toolchain supports linking shared > libraries? Here are the configure flags: CPPFLAGS="-I$TARGET_ROOT/include -fno-omit-frame-pointer" \ LDFLAGS="-L$TARGET_ROOT/lib -lblkid -luuid -lz -lncursesw -ltinfow - ldl" \ ../$HURD_SRC/configure \ --build="$HOST" \ --host="$TARGET" \ --prefix="$TARGET_ROOT" \ --without-parted \ --enable-static-progs=ext2fs,iso9660fs,pci-arbiter \ --with-ncursesw-include-dir="$TARGET_ROOT/include/ncursesw" \ --with-libgcrypt-prefix="$TARGET_ROOT" \ --with-libcrypt \ --with-libz \ --without-rump \ --without-acpica \ --without-libdaemon \ --without-libbz2 \ --without-rump \ --enable-ncursesw \ --disable-profile
Re: [PATCH] Add libraries to Makefiles.
Hello, Svante Signell, le mar. 17 janv. 2023 13:20:46 +0100, a ecrit: > The attached patch adds libraries needed when cross-building Hurd. Most > of them arise when enabling zlib with --with-libz. But none of these directories are actually using libz, so it doesn't make sense to make them use -lz. Are you sure that your cross-toolchain supports linking shared libraries? Samuel
[PATCH] Add libraries to Makefiles.
Hi, The attached patch adds libraries needed when cross-building Hurd. Most of them arise when enabling zlib with --with-libz. Applies nicely to hurd-0.9.git20221224 and latest git. Thanks! --- hurd/boot/Makefile 2022-11-30 11:14:21.08400 +0100 +++ hurd/boot/Makefile 2022-12-02 15:31:09.73600 +0100 @@ -28,6 +28,6 @@ MIGSFLAGS=-imacros $(srcdir)/mig-mutate.h -DHURD_DEFAULT_PAYLOAD_TO_PORT=1 io-MIGSFLAGS=-DREPLY_PORTS -DHURD_DEFAULT_PAYLOAD_TO_PORT=1 HURDLIBS = store shouldbeinlibc ihash -LDLIBS += -lpthread +LDLIBS += -lpthread $(and $(HAVE_LIBZ),-lz) include ../Makeconf --- hurd/storeio/Makefile 2022-11-30 11:14:21.18800 +0100 +++ hurd/storeio/Makefile 2022-11-30 12:27:44.26800 +0100 @@ -24,6 +24,6 @@ OBJS = $(SRCS:.c=.o) HURDLIBS = trivfs pager fshelp iohelp store ports ihash shouldbeinlibc -LDLIBS = -lpthread +LDLIBS = -lpthread $(and $(HAVE_LIBZ),-lz) include ../Makeconf --- hurd/sutils/Makefile 2022-11-30 11:14:21.19200 +0100 +++ hurd/sutils/Makefile 2022-12-02 15:51:54.06400 +0100 @@ -29,6 +29,7 @@ OBJS = $(progs:=.o) HURDLIBS = store shouldbeinlibc +LDLIBS += $(and $(HAVE_LIBZ),-lz) include ../Makeconf --- hurd/tmpfs/Makefile 2022-11-30 11:14:21.19200 +0100 +++ hurd/tmpfs/Makefile 2022-11-30 12:18:05.20400 +0100 @@ -24,6 +24,6 @@ OBJS = $(SRCS:.c=.o) default_pagerUser.o # XXX The shared libdiskfs requires libstore even though we don't use it here. HURDLIBS = diskfs pager iohelp fshelp store ports ihash shouldbeinlibc -LDLIBS = -lpthread +LDLIBS = -lpthread $(and $(HAVE_LIBZ),-lz) include ../Makeconf --- hurd/utils/Makefile 2022-11-30 11:14:21.19600 +0100 +++ hurd/utils/Makefile 2022-12-02 15:40:57.58400 +0100 @@ -35,7 +35,7 @@ OBJS = $(filter-out %.sh,$(SRCS:.c=.o)) HURDLIBS = ps ihash store fshelp ports ftpconn shouldbeinlibc -LDLIBS += -lpthread +LDLIBS += -lpthread $(and $(HAVE_LIBZ),-lz) login-LDLIBS = -lutil $(and $(HAVE_LIBCRYPT),-lcrypt) addauth-LDLIBS = $(and $(HAVE_LIBCRYPT),-lcrypt) setauth-LDLIBS = $(and $(HAVE_LIBCRYPT),-lcrypt) --- hurd-git/mach-defpager/Makefile 2022-12-03 16:44:52.84800 +0100 +++ hurd-git/mach-defpager/Makefile 2022-12-08 21:27:32.33600 +0100 @@ -30,7 +30,7 @@ default_pager_replyUser.o HURDLIBS:= ihash shouldbeinlibc -LDLIBS:= -lpthread +LDLIBS:= -lpthread -lhurduser include ../Makeconf --- hurd/trans/Makefile 2019-12-18 19:29:43.94000 +0100 +++ hurd/trans/Makefile 2019-12-22 00:37:06.65600 +0100 @@ -62,7 +62,7 @@ ifeq ($(HAVE_LIBGCRYPT),yes) SRCS += random.c targets += random - random-LDLIBS = -lgcrypt + random-LDLIBS = -lgcrypt -lgpg-error random: startup_notifyServer.o mach_debugUser.o ../libtrivfs/libtrivfs.a endif