diff --git a/0001-build-put-l-specifiers-into-LIBADD-not-LDFLAGS.patch b/0001-build-put-l-specifiers-into-LIBADD-not-LDFLAGS.patch new file mode 100644 index 0000000..6bdb98f --- /dev/null +++ b/0001-build-put-l-specifiers-into-LIBADD-not-LDFLAGS.patch @@ -0,0 +1,162 @@ +From 50d7dc0102751808823640321ec1da5d34811978 Mon Sep 17 00:00:00 2001 +From: Jan Engelhardt +Date: Wed, 3 May 2023 00:48:14 +0200 +Subject: [PATCH 1/2] build: put -l specifiers into LIBADD, not LDFLAGS +References: https://github.com/vmware/open-vm-tools/pull/664 + +Linking order matters. +LDFLAGS is the *totally* *wrong* place for -l. +Replace by LDLIBS / xxx_LDADD / xxx_LIBADD. +--- + open-vm-tools/libDeployPkg/Makefile.am | 3 +-- + open-vm-tools/libappmonitor/Makefile.am | 6 ++---- + open-vm-tools/libguestStoreClient/Makefile.am | 2 +- + open-vm-tools/libguestlib/Makefile.am | 6 ++---- + open-vm-tools/libhgfs/Makefile.am | 2 +- + open-vm-tools/libvmtools/Makefile.am | 2 +- + open-vm-tools/services/plugins/containerInfo/Makefile.am | 6 +++--- + open-vm-tools/tests/testVmblock/Makefile.am | 4 ++-- + open-vm-tools/vgauth/lib/Makefile.am | 2 +- + 9 files changed, 14 insertions(+), 19 deletions(-) + +diff --git a/open-vm-tools/libDeployPkg/Makefile.am b/open-vm-tools/libDeployPkg/Makefile.am +index 15728126..5f080744 100644 +--- a/open-vm-tools/libDeployPkg/Makefile.am ++++ b/open-vm-tools/libDeployPkg/Makefile.am +@@ -36,10 +36,9 @@ libDeployPkg_la_SOURCES += processPosix.c + libDeployPkg_la_SOURCES += linuxDeploymentUtilities.c + libDeployPkg_la_SOURCES += linuxDeploymentUtilities.h + +-libDeployPkg_la_LDFLAGS = + # We require GCC, so we're fine passing compiler-specific flags. + # Needed for OS's that don't link shared libraries against libc by default, e.g. FreeBSD +-libDeployPkg_la_LDFLAGS += -Wl,-lc ++libDeployPkg_la_LIBADD += -lc + + libDeployPkg_includedir = $(includedir)/libDeployPkg + +diff --git a/open-vm-tools/libappmonitor/Makefile.am b/open-vm-tools/libappmonitor/Makefile.am +index 2681eb79..be6b6a30 100644 +--- a/open-vm-tools/libappmonitor/Makefile.am ++++ b/open-vm-tools/libappmonitor/Makefile.am +@@ -48,12 +48,10 @@ libappmonitor_la_SOURCES += $(libappmonitor_rpcchanneldir)/vsockChannel.c + libappmonitor_la_SOURCES += $(libappmonitor_rpcchanneldir)/simpleSocket.c + endif + +-libappmonitor_la_LDFLAGS = +-libappmonitor_la_LDFLAGS += -Wl,-ldl +-libappmonitor_la_LDFLAGS += -Wl,-lrt ++libappmonitor_la_LIBADD += -ldl -lrt + # We require GCC, so we're fine passing compiler-specific flags. + # Needed for OS's that don't link shared libraries against libc by default, e.g. FreeBSD +-libappmonitor_la_LDFLAGS += -Wl,-lc ++libappmonitor_la_LIBADD += -lc + + libappmonitor_includedir = $(includedir)/libappmonitor + +diff --git a/open-vm-tools/libguestStoreClient/Makefile.am b/open-vm-tools/libguestStoreClient/Makefile.am +index adf69309..2dee8e7b 100644 +--- a/open-vm-tools/libguestStoreClient/Makefile.am ++++ b/open-vm-tools/libguestStoreClient/Makefile.am +@@ -33,4 +33,4 @@ libguestStoreClient_la_LDFLAGS = + libguestStoreClient_la_LDFLAGS += -Wl,-z,defs + # Needed for OS's that don't link shared libraries against libc by + #default, e.g. FreeBSD +-libguestStoreClient_la_LDFLAGS += -Wl,-lc ++libguestStoreClient_la_LIBADD += -lc +diff --git a/open-vm-tools/libguestlib/Makefile.am b/open-vm-tools/libguestlib/Makefile.am +index d2cfb80a..5175b442 100644 +--- a/open-vm-tools/libguestlib/Makefile.am ++++ b/open-vm-tools/libguestlib/Makefile.am +@@ -50,12 +50,10 @@ libguestlib_la_SOURCES += $(libguestlib_rpcchanneldir)/vsockChannel.c + libguestlib_la_SOURCES += $(libguestlib_rpcchanneldir)/simpleSocket.c + endif + +-libguestlib_la_LDFLAGS = +-libguestlib_la_LDFLAGS += -Wl,-ldl +-libguestlib_la_LDFLAGS += -Wl,-lrt ++libguestlib_la_LIBADD += -ldl -lrt + # We require GCC, so we're fine passing compiler-specific flags. + # Needed for OS's that don't link shared libraries against libc by default, e.g. FreeBSD +-libguestlib_la_LDFLAGS += -Wl,-lc ++libguestlib_la_LIBADD += -lc + + libguestlib_includedir = $(includedir)/vmGuestLib + +diff --git a/open-vm-tools/libhgfs/Makefile.am b/open-vm-tools/libhgfs/Makefile.am +index 76091452..c388da75 100644 +--- a/open-vm-tools/libhgfs/Makefile.am ++++ b/open-vm-tools/libhgfs/Makefile.am +@@ -41,5 +41,5 @@ libhgfs_la_LDFLAGS = + libhgfs_la_LDFLAGS += -Wl,-z,defs + # Needed for OS's that don't link shared libraries against libc by + #default, e.g. FreeBSD +-libhgfs_la_LDFLAGS += -Wl,-lc ++libhgfs_la_LIBADD += -lc + +diff --git a/open-vm-tools/libvmtools/Makefile.am b/open-vm-tools/libvmtools/Makefile.am +index 6da97362..a2f9a241 100644 +--- a/open-vm-tools/libvmtools/Makefile.am ++++ b/open-vm-tools/libvmtools/Makefile.am +@@ -89,5 +89,5 @@ libvmtools_la_LDFLAGS = + libvmtools_la_LDFLAGS += -Wl,-z,defs + # Needed for OS's that don't link shared libraries against libc by + #default, e.g. FreeBSD +-libvmtools_la_LDFLAGS += -Wl,-lc ++libvmtools_la_LIBADD += -lc + +diff --git a/open-vm-tools/services/plugins/containerInfo/Makefile.am b/open-vm-tools/services/plugins/containerInfo/Makefile.am +index 488e35aa..10b4dfae 100644 +--- a/open-vm-tools/services/plugins/containerInfo/Makefile.am ++++ b/open-vm-tools/services/plugins/containerInfo/Makefile.am +@@ -36,7 +36,7 @@ libcontainerInfo_la_SOURCES += containerInfoInt.h + libcontainerInfo_la_SOURCES += containerInfo.c + + libcontainerInfo_la_SOURCES += containerInfo_docker.c +-libcontainerInfo_la_LDFLAGS += -lcurl ++libcontainerInfo_la_LIBADD += -lcurl + libcontainerInfo_la_CPPFLAGS += @CURL_CPPFLAGS@ + libcontainerInfo_la_LIBADD += ../../../lib/jsmn/libJsmn.la + +@@ -61,8 +61,8 @@ libcontainerInfo_la_SOURCES += containers.grpc.pb.cc + libcontainerInfo_la_SOURCES += containerInfo_grpc.cc + + libcontainerInfo_la_CPPFLAGS += @GRPC_CPPFLAGS@ +-libcontainerInfo_la_LDFLAGS += -lprotobuf +-libcontainerInfo_la_LDFLAGS += -lgrpc++ ++libcontainerInfo_la_LIBADD += -lprotobuf ++libcontainerInfo_la_LIBADD += -lgrpc++ + + tasks.grpc.pb.cc containers.grpc.pb.cc: %.grpc.pb.cc : %.proto %.pb.cc + $(PROTOC) -I. -I$(GOGO_PROTOPATH) \ +diff --git a/open-vm-tools/tests/testVmblock/Makefile.am b/open-vm-tools/tests/testVmblock/Makefile.am +index 1fd469d5..ae6c79fe 100644 +--- a/open-vm-tools/tests/testVmblock/Makefile.am ++++ b/open-vm-tools/tests/testVmblock/Makefile.am +@@ -29,8 +29,8 @@ AM_CFLAGS = + AM_CFLAGS += -DVMX86_DEVEL + AM_CFLAGS += -DVMX86_DEBUG + +-AM_LDFLAGS = +-AM_LDFLAGS += -lpthread ++LDLIBS = ++LDLIBS += -lpthread + + vmware_testvmblock_fuse_CFLAGS = $(AM_CFLAGS) -Dvmblock_fuse + vmware_testvmblock_fuse_SOURCES = vmblocktest.c +diff --git a/open-vm-tools/vgauth/lib/Makefile.am b/open-vm-tools/vgauth/lib/Makefile.am +index bce97aac..88944f19 100644 +--- a/open-vm-tools/vgauth/lib/Makefile.am ++++ b/open-vm-tools/vgauth/lib/Makefile.am +@@ -59,7 +59,7 @@ libvgauth_la_LDFLAGS = + libvgauth_la_LDFLAGS += -Wl,-z,defs + # Needed for OS's that don't link shared libraries against libc by + #default, e.g. FreeBSD +-libvgauth_la_LDFLAGS += -Wl,-lc ++libvgauth_la_LIBADD += -lc + + # Message catalogs. + install-data-hook: +-- +2.40.1 + diff --git a/0002-build-use-grpc-pkgconfig-to-retrieve-flags-libraries.patch b/0002-build-use-grpc-pkgconfig-to-retrieve-flags-libraries.patch new file mode 100644 index 0000000..d6e2f16 --- /dev/null +++ b/0002-build-use-grpc-pkgconfig-to-retrieve-flags-libraries.patch @@ -0,0 +1,49 @@ +From 7f97b8ac1df51da902c2db05e488e52bb3068149 Mon Sep 17 00:00:00 2001 +From: Jan Engelhardt +Date: Wed, 3 May 2023 00:48:56 +0200 +Subject: [PATCH 2/2] build: use grpc++ pkgconfig to retrieve flags/libraries +References: https://github.com/vmware/open-vm-tools/pull/664 + +When a .pc file exists, it should be used. Fixes obvious linking problems like + +ld: .libs/libcontainerInfo_la-containers.grpc.pb.o: in function `grpc::ByteBuffer::~ByteBuffer()': +/usr/include/grpcpp/support/byte_buffer.h:99: undefined reference to `grpc_byte_buffer_destroy' +collect2: error: ld returned 1 exit status +make[4]: *** [Makefile:649: libcontainerInfo.la] Error 1 +--- + open-vm-tools/configure.ac | 2 ++ + open-vm-tools/services/plugins/containerInfo/Makefile.am | 4 ++-- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac +index 5f9a1937..fd8c2db0 100644 +--- a/open-vm-tools/configure.ac ++++ b/open-vm-tools/configure.ac +@@ -723,6 +723,8 @@ AC_DEFUN([AC_VMW_CONTAINERINFO_MSG],[ + [], + [AC_VMW_CONTAINERINFO_MSG(["grpc++ >= 1.3.2"])]) + ++PKG_CHECK_MODULES([grpcxx], [grpc++ >= 1.3.2]) ++ + # + # proto files needed by containerd grpc client. + # +diff --git a/open-vm-tools/services/plugins/containerInfo/Makefile.am b/open-vm-tools/services/plugins/containerInfo/Makefile.am +index 10b4dfae..74d9c8f0 100644 +--- a/open-vm-tools/services/plugins/containerInfo/Makefile.am ++++ b/open-vm-tools/services/plugins/containerInfo/Makefile.am +@@ -60,9 +60,9 @@ libcontainerInfo_la_SOURCES += containers.grpc.pb.h + libcontainerInfo_la_SOURCES += containers.grpc.pb.cc + libcontainerInfo_la_SOURCES += containerInfo_grpc.cc + +-libcontainerInfo_la_CPPFLAGS += @GRPC_CPPFLAGS@ ++libcontainerInfo_la_CPPFLAGS += ${grpcxx_CFLAGS} + libcontainerInfo_la_LIBADD += -lprotobuf +-libcontainerInfo_la_LIBADD += -lgrpc++ ++libcontainerInfo_la_LIBADD += ${grpcxx_LIBS} + + tasks.grpc.pb.cc containers.grpc.pb.cc: %.grpc.pb.cc : %.proto %.pb.cc + $(PROTOC) -I. -I$(GOGO_PROTOPATH) \ +-- +2.40.1 + diff --git a/open-vm-tools.changes b/open-vm-tools.changes index 4478e64..3b295f7 100644 --- a/open-vm-tools.changes +++ b/open-vm-tools.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue May 2 20:40:18 UTC 2023 - Jan Engelhardt + +- Add 0001-build-put-l-specifiers-into-LIBADD-not-LDFLAGS.patch, + 0002-build-use-grpc-pkgconfig-to-retrieve-flags-libraries.patch + [boo#1210695] +- Reduce generated script size by coalescing multiple %service_* + ------------------------------------------------------------------- Tue Apr 4 15:03:28 UTC 2023 - Kirk Allan diff --git a/open-vm-tools.spec b/open-vm-tools.spec index 6f780fe..75ef8db 100644 --- a/open-vm-tools.spec +++ b/open-vm-tools.spec @@ -53,7 +53,6 @@ Source6: open-vm-tools-modprobe.conf Source7: tools.conf Source8: vgauthd.service Source9: vmblock-fuse.service -BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: gcc-c++ # don't use pkgconfig(gtk+-2.0) so we can build on SLE BuildRequires: autoconf @@ -154,6 +153,8 @@ Obsoletes: open-vm-tools-deploypkg <= 10.0.5 Supplements: modalias(pci:v000015ADd*sv*sd*bc*sc*i*) ExclusiveArch: %ix86 x86_64 aarch64 #Upstream patches +Patch2: 0001-build-put-l-specifiers-into-LIBADD-not-LDFLAGS.patch +Patch3: 0002-build-use-grpc-pkgconfig-to-retrieve-flags-libraries.patch #SUSE specific patches Patch0: pam-vmtoolsd.patch @@ -256,10 +257,13 @@ This package interfaces with the container runtime to retrieve a list of contain # fix for an rpmlint warning regarding wrong line feeds sed -i -e "s/\r//" README #Upstream patches +%patch2 -p2 +%patch3 -p2 #SUSE specific patches %patch0 -p2 %patch1 -p2 +autoreconf -fi %build %if %{with_X} @@ -386,9 +390,7 @@ done %post /sbin/ldconfig -%service_add_post vmtoolsd.service -%service_add_post vgauthd.service -%service_add_post vmblock-fuse.service +%service_add_post vmtoolsd.service vgauthd.service vmblock-fuse.service %if %{with_X} @@ -460,7 +462,6 @@ systemctl try-restart vmtoolsd.service || : %endif %files -%defattr(-, root, root) %if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 0120300 %license COPYING %doc AUTHORS ChangeLog NEWS README @@ -537,7 +538,6 @@ systemctl try-restart vmtoolsd.service || : %if %{with_X} %files desktop -%defattr(-, root, root) %config %{_sysconfdir}/xdg/autostart/vmware-user-autostart.desktop %verify(not mode) %attr(0755, root, root) %{_bindir}/vmware-user-suid-wrapper %{_libdir}/%{name}/plugins/vmusr/ @@ -569,7 +569,6 @@ systemctl try-restart vmtoolsd.service || : %{_libdir}/%{name}/serviceDiscovery/scripts/get-versions.sh %files -n libvmtools0 -%defattr(-, root, root) %{_libdir}/libvmtools.so.* %{_libdir}/libguestlib.so.* %{_libdir}/libhgfs.so.* @@ -580,7 +579,6 @@ systemctl try-restart vmtoolsd.service || : %endif %files -n libvmtools-devel -%defattr(-,root,root) %doc docs/api/build/* %{_includedir}/vmGuestLib %{_libdir}/*.so