build: install sdt*.h in /usr/lib64/dtrace/include/sys
PATCH v2 1/2 build: install sdt*.h in /usr/lib64/dtrace/include/sys
This moves it out of the way of SystemTap's rather different sdt.h, and lets us remove the barely-working kludgery in the specfile to work around it. Right now, the new location is nailed into every user (since sdt.h required no special cpp flags before now), but this is hardly a good long-term
solution: a better one will be forthcoming soon.
With this change, we no longer confict with any systemtap packages!
--- GNUmakefile | 2 ++ dtrace.spec | 18 ------------------ runtest.sh | 10 +++++----- test/unittest/pid/tst.provregex3.sh | 6 +++--- test/unittest/pid/tst.provregex4.sh | 10 +++++----- test/unittest/usdt/tst.allargs.sh | 4 ++-- test/unittest/usdt/tst.entryreturn.sh | 4 ++-- test/unittest/usdt/tst.linkpriv.sh | 4 ++-- test/unittest/usdt/tst.linkunpriv.sh | 4 ++-- test/unittest/usdt/tst.manyprobes.sh | 4 ++-- test/unittest/usdt/tst.reeval.sh | 4 ++-- test/unittest/usdt/tst.static.sh | 4 ++-- test/unittest/usdt/tst.static2.sh | 4 ++-- uts/Build | 16 ++++++++++++---- 14 files changed, 43 insertions(+), 51 deletions(-)
GNUmakefile +2 -0
@@ -86,6 +86,8 @@ BINDIR = $(prefix)/bin INSTBINDIR = $(DESTDIR)$(BINDIR) INCLUDEDIR = $(prefix)/include INSTINCLUDEDIR = $(DESTDIR)$(INCLUDEDIR) +SDTINCLUDEDIR = $(LIBDIR)/dtrace/include +INSTSDTINCLUDEDIR = $(DESTDIR)$(SDTINCLUDEDIR) SBINDIR = $(prefix)/sbin INSTSBINDIR = $(DESTDIR)$(SBINDIR) UDEVDIR = $(prefix)/lib/udev/rules.d
dtrace.spec +0 -18
@@ -86,8 +86,6 @@ BuildRequires: binutils-devel >= 2.30-58.0.8 Requires: libdtrace-ctf >= 1.1.0 BuildRequires: libdtrace-ctf-devel >= 1.1.0 %endif -Conflicts: systemtap-sdt-devel -Provides: systemtap-sdt-devel Summary: DTrace user interface. Version: 2.0.1 Release: 0%{?dist}
@@ -194,11 +192,6 @@ make DESTDIR=$RPM_BUILD_ROOT VERSION=%{version} \ sed -i '/^ProtectSystem=/d; /^ProtectControlGroups=/d; /^RuntimeDirectory/d;' $RPM_BUILD_ROOT/usr/lib/systemd/system/dtprobed.service %endif -# Because systemtap creates a sdt.h header file we have to rename -# ours and then shift theirs out of the way. -mv $RPM_BUILD_ROOT/usr/include/sys/sdt.h \ - $RPM_BUILD_ROOT/usr/include/sys/sdt-dtrace.h - %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT" rm -rf $RPM_BUILD_DIR/%{name}-%{version}
@@ -222,15 +215,6 @@ if [ $1 -ge 2 ] ; then %systemd_postun_with_restart dtprobed.service fi -# if sdt-systemtap.h doesn't exist then we can move the existing dtrace sdt.h -SYSINCDIR=/usr/include/sys -if [ -e $SYSINCDIR/sdt.h -a ! -e $SYSINCDIR/sdt-systemtap.h ]; then - mv $SYSINCDIR/sdt.h $SYSINCDIR/sdt-systemtap.h - ln -s $SYSINCDIR/sdt-dtrace.h $SYSINCDIR/sdt.h -elif [ ! -e $SYSINCDIR/sdt.h ]; then - ln -s $SYSINCDIR/sdt-dtrace.h $SYSINCDIR/sdt.h -fi - %preun %systemd_preun dtprobed.service
@@ -253,8 +237,6 @@ systemctl start dtprobed || : %{_sbindir}/dtrace %{_sbindir}/dtprobed %{_mandir}/man8/dtrace.8.gz -%{_includedir}/sys/sdt-dtrace.h -%{_includedir}/sys/sdt_internal.h %doc %{_docdir}/dtrace-%{version}/* %{_unitdir}/dtprobed.service %{_unitdir}/dtrace-usdt.target
runtest.sh +5 -5
@@ -559,7 +559,7 @@ if [[ -z $USE_INSTALLED ]]; then dtrace="$(pwd)/build*/dtrace" test_libdir="$(pwd)/build/dlibs" test_ldflags="-L$(pwd)/build" - test_incflags="-Iinclude -Iuts/common -Ibuild -Ilibdtrace -DARCH_$arch" + test_cppflags="-Iinclude -Iuts/common -Ibuild -Ilibdtrace -DARCH_$arch" helper_device="dtrace/test-$$" # Pre-existing directories from earlier tests are just fine! # dtprobed will clean things up.
@@ -579,7 +579,7 @@ else dtrace="/usr/sbin/dtrace" test_libdir="installed" test_ldflags="" - test_incflags="-DARCH_$arch" + test_cppflags="-DARCH_$arch -I/usr/lib64/dtrace/include" if [[ ! -x $dtrace ]]; then echo "$dtrace not available." >&2
@@ -587,6 +587,7 @@ else fi fi export dtrace +export test_cppflags # Figure out if the preprocessor supports -fno-diagnostics-show-option: if it # does, add a bunch of options designed to make GCC output look like it used
@@ -594,7 +595,6 @@ export dtrace # Regardless, turn off display of column numbers, if possible: they vary # between GCC releases. -test_cppflags= if ! /usr/bin/cpp -x c -fno-diagnostics-show-caret - /dev/null < /dev/null 2>&1 | \ grep -q 'unrecognized command line option'; then export DTRACE_OPT_CPPARGS="-fno-diagnostics-show-caret -fdiagnostics-color=never -fno-diagnostics-show-option -fno-show-column"
@@ -1129,7 +1129,7 @@ for dt in $dtrace; do # Default and substitute in flags. The raw_dt_flags apply even to a # sh invocation. - raw_dt_flags="$test_incflags" + raw_dt_flags="$test_cppflags" expected_tag= if [[ $testonly =~ ^err\.D_ ]]; then
@@ -1204,7 +1204,7 @@ for dt in $dtrace; do CC="${CC:-gcc}" CCline="$CC -std=gnu99 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64" - CCline="$CCline $test_incflags $CFLAGS $test_ldflags $LDFLAGS" + CCline="$CCline $test_cppflags $CFLAGS $test_ldflags $LDFLAGS" CCline="$CCline -o $tmpdir/$(basename $base) $_test $link" log "Compiling $CCline\n" if ! $CCline >/dev/null 2>$tmpdir/cc.err; then
test/unittest/pid/tst.provregex3.sh +3 -3
@@ -1,7 +1,7 @@ #!/bin/bash # # Oracle Linux DTrace. -# Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. # Licensed under the Universal Permissive License v 1.0 as shown at # http://oss.oracle.com/licenses/upl. #
@@ -23,10 +23,10 @@ cat > $DIR/Makefile <<EOF all: main main: main.o prov.o - cc -o main main.o prov.o + cc $test_cppflags -o main main.o prov.o main.o: main.c prov.h - cc -c main.c + cc $test_cppflags -c main.c prov.h: prov.d $dtrace -h -s prov.d
test/unittest/pid/tst.provregex4.sh +5 -5
@@ -1,7 +1,7 @@ #!/bin/bash # # Oracle Linux DTrace. -# Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. # Licensed under the Universal Permissive License v 1.0 as shown at # http://oss.oracle.com/licenses/upl. #
@@ -25,10 +25,10 @@ cat > $DIR/Makefile <<EOF all: main altlib.so main: main.o provmain.o - cc -o main main.o provmain.o -ldl + cc $test_cppflags -o main main.o provmain.o -ldl main.o: main.c prov.h - cc -c main.c + cc $test_cppflags -c main.c prov.h: prov.d $dtrace -h -s prov.d
@@ -37,10 +37,10 @@ provmain.o: prov.d main.o $dtrace -G -o provmain.o -s prov.d main.o altlib.so: altlib.o provalt.o - cc -z defs --shared -o altlib.so altlib.o provalt.o + cc $test_cppflags -z defs --shared -o altlib.so altlib.o provalt.o altlib.o: altlib.c prov.h - cc -c altlib.c + cc $test_cppflags -c altlib.c provalt.o: prov.d altlib.o $dtrace -G -o provalt.o -s prov.d altlib.o
test/unittest/usdt/tst.allargs.sh +2 -2
@@ -1,7 +1,7 @@ #!/bin/bash # # Oracle Linux DTrace. -# Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. # Licensed under the Universal Permissive License v 1.0 as shown at # http://oss.oracle.com/licenses/upl.
@@ -16,7 +16,7 @@ fi dtrace=$1 CC=/usr/bin/gcc -CFLAGS="-std=gnu89 -I${PWD}/uts/common" +CFLAGS="-std=gnu89 $test_cppflags" DIRNAME="$tmpdir/usdt-allargs.$$.$RANDOM" mkdir -p $DIRNAME
test/unittest/usdt/tst.entryreturn.sh +2 -2
@@ -1,7 +1,7 @@ #!/bin/bash # # Oracle Linux DTrace. -# Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. # Licensed under the Universal Permissive License v 1.0 as shown at # http://oss.oracle.com/licenses/upl. #
@@ -14,7 +14,7 @@ fi dtrace=$1 CC=/usr/bin/gcc -CFLAGS="-I${PWD}/uts/common" +CFLAGS="$test_cppflags" DIRNAME="$tmpdir/usdt-entryreturn.$$.$RANDOM" mkdir -p $DIRNAME
test/unittest/usdt/tst.linkpriv.sh +2 -2
@@ -1,7 +1,7 @@ #!/bin/bash # # Oracle Linux DTrace. -# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. # Licensed under the Universal Permissive License v 1.0 as shown at # http://oss.oracle.com/licenses/upl. #
@@ -12,7 +12,7 @@ fi dtrace=$1 CC=/usr/bin/gcc -CFLAGS="-std=gnu99 -I${PWD}/uts/common" +CFLAGS="-std=gnu99 $test_cppflags" DIRNAME="$tmpdir/usdt-linkpriv.$$.$RANDOM" mkdir -p $DIRNAME
test/unittest/usdt/tst.linkunpriv.sh +2 -2
@@ -1,7 +1,7 @@ #!/bin/bash # # Oracle Linux DTrace. -# Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. # Licensed under the Universal Permissive License v 1.0 as shown at # http://oss.oracle.com/licenses/upl. #
@@ -14,7 +14,7 @@ fi dtrace=$1 CC=/usr/bin/gcc -CFLAGS="-I${PWD}/uts/common" +CFLAGS="$test_cppflags" DIRNAME="$tmpdir/usdt-linkunpriv.$$.$RANDOM" mkdir -p $DIRNAME
test/unittest/usdt/tst.manyprobes.sh +2 -2
@@ -1,7 +1,7 @@ #!/bin/bash # # Oracle Linux DTrace. -# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. # Licensed under the Universal Permissive License v 1.0 as shown at # http://oss.oracle.com/licenses/upl. #
@@ -12,7 +12,7 @@ fi dtrace=$1 CC=/usr/bin/gcc -CFLAGS="-I${PWD}/uts/common" +CFLAGS="$test_cppflags" DIRNAME="$tmpdir/usdt-manyprobes.$$.$RANDOM" mkdir -p $DIRNAME cd $DIRNAME
test/unittest/usdt/tst.reeval.sh +2 -2
@@ -1,7 +1,7 @@ #!/bin/bash # # Oracle Linux DTrace. -# Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. # Licensed under the Universal Permissive License v 1.0 as shown at # http://oss.oracle.com/licenses/upl. #
@@ -13,7 +13,7 @@ fi dtrace=$1 CC=/usr/bin/gcc -CFLAGS="-I${PWD}/uts/common" +CFLAGS="$test_cppflags" DIRNAME="$tmpdir/usdt-reeval.$$.$RANDOM" mkdir -p $DIRNAME
test/unittest/usdt/tst.static.sh +2 -2
@@ -1,7 +1,7 @@ #!/bin/bash # # Oracle Linux DTrace. -# Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. # Licensed under the Universal Permissive License v 1.0 as shown at # http://oss.oracle.com/licenses/upl. #
@@ -12,7 +12,7 @@ fi dtrace=$1 CC=/usr/bin/gcc -CFLAGS="-I${PWD}/uts/common" +CFLAGS="$test_cppflags" DIRNAME="$tmpdir/usdt-static.$$.$RANDOM" mkdir -p $DIRNAME
test/unittest/usdt/tst.static2.sh +2 -2
@@ -1,7 +1,7 @@ #!/bin/bash # # Oracle Linux DTrace. -# Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. # Licensed under the Universal Permissive License v 1.0 as shown at # http://oss.oracle.com/licenses/upl. #
@@ -16,7 +16,7 @@ fi dtrace=$1 CC=/usr/bin/gcc -CFLAGS="-I${PWD}/uts/common" +CFLAGS="$test_cppflags" DIRNAME="$tmpdir/usdt-static2.$$.$RANDOM" mkdir -p $DIRNAME
uts/Build +12 -4
@@ -1,6 +1,6 @@ # # Oracle Linux DTrace. -# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # Licensed under the Universal Permissive License v 1.0 as shown at # http://oss.oracle.com/licenses/upl.
@@ -10,11 +10,19 @@ uts_DIR := $(current-dir) # provide the userspace versions of types defined distincty by the kernel. SYS_HEADERS_INSTALL := common/sys/dtrace.h \ - common/sys/dtrace_types.h \ - common/sys/sdt.h \ - common/sys/sdt_internal.h + common/sys/dtrace_types.h + +# sdt*.h are used by programs that contain USDT probes that want to define +# probes by hand rather than using dtrace -h. SystemTap has another header +# with the same name, so we install these out of the way. + +PROBE_HEADERS_INSTALL := common/sys/sdt.h \ + common/sys/sdt_internal.h install:: mkdir -p $(INSTINCLUDEDIR)/sys $(call describe-install-target,$(INSTINCLUDEDIR)/sys,$(notdir $(SYS_HEADERS_INSTALL))) cd $(uts_DIR) && install -m 644 $(SYS_HEADERS_INSTALL) $(INSTINCLUDEDIR)/sys + mkdir -p $(INSTSDTINCLUDEDIR)/sys + $(call describe-install-target,$(INSTSDTINCLUDEDIR)/sys,$(notdir $(PROBE_HEADERS_INSTALL))) + cd $(uts_DIR) && install -m 644 $(PROBE_HEADERS_INSTALL) $(INSTSDTINCLUDEDIR)/sys
base-commit: 0f499300c150a3a8878361e31f3ba167f7d5b851
Signature · 1 line
2.45.1.275.g567cb0950c
PATCH v2 2/2 build: initial pkg-config support
This initial pkg-config file, dtrace_sdt.pc, points at the location of the sdt.h include file. We immediately use it in make check in the installed testsuite, compensating for any install-time changes in the location of the dtrace libdir.
Further changes will be forthcoming to properly support relocatable installation.
--- GNUmakefile | 2 ++ configure | 2 ++ dtrace.spec | 1 + runtest.sh | 2 +- uts/Build | 14 +++++++++++++- uts/dtrace_sdt.pc.in | 6 ++++++ 6 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 uts/dtrace_sdt.pc.in
GNUmakefile +2 -0
@@ -100,6 +100,8 @@ DOCDIR = $(prefix)/share/doc/dtrace-$(VERSION) INSTDOCDIR = $(DESTDIR)$(DOCDIR) MANDIR = $(prefix)/share/man/man8 INSTMANDIR = $(DESTDIR)$(MANDIR) +PKGCONFIGDIR = $(prefix)/share/pkgconfig +INSTPKGCONFIGDIR = $(DESTDIR)$(PKGCONFIGDIR) TESTDIR = $(prefix)/lib$(BITNESS)/dtrace/testsuite INSTTESTDIR = $(DESTDIR)$(TESTDIR) TARGETS =
configure +2 -0
@@ -60,6 +60,7 @@ Installation paths: --sbindir=PREFIX/sbin Alias for --bindir --includedir=PREFIX/include #include directory --mandir=PREFIX/share/man/man8 Manpage directory +--pkg-config-dir=PREFIX/share/pkgconfig Pkg-config directory --udevdir=PREFIX/lib/udev/rules.d udev rules directory --systemd-unit-dir=PREFIX/lib/systemd/system systemd unit directory --docdir=PREFIX/share/doc/dtrace Documentation directory
@@ -130,6 +131,7 @@ for option in "$@"; do --systemd-unit-dir=*) write_make_var SYSTEMDUNITDIR "$option";; --docdir=*) write_make_var DOCDIR "$option";; --mandir=*) write_make_var MANDIR "$option";; + --pkg-config-dir=*) write_make_var PKGCONFIGDIR "$option";; --testdir=*) write_make_var TESTDIR "$option";; CC=*) write_make_var CC "$option";; CPP=*) write_make_var PREPROCESS "$option";;
dtrace.spec +1 -0
@@ -236,6 +236,7 @@ systemctl start dtprobed || : %{_libdir}/libdtrace.so.* %{_sbindir}/dtrace %{_sbindir}/dtprobed +%{_datadir}/pkgconfig/dtrace_sdt.pc %{_mandir}/man8/dtrace.8.gz %doc %{_docdir}/dtrace-%{version}/* %{_unitdir}/dtprobed.service
runtest.sh +1 -1
@@ -579,7 +579,7 @@ else dtrace="/usr/sbin/dtrace" test_libdir="installed" test_ldflags="" - test_cppflags="-DARCH_$arch -I/usr/lib64/dtrace/include" + test_cppflags="-DARCH_$arch $(pkg-config --cflags dtrace_sdt)" if [[ ! -x $dtrace ]]; then echo "$dtrace not available." >&2
uts/Build +13 -1
@@ -14,11 +14,16 @@ SYS_HEADERS_INSTALL := common/sys/dtrace.h \ # sdt*.h are used by programs that contain USDT probes that want to define # probes by hand rather than using dtrace -h. SystemTap has another header -# with the same name, so we install these out of the way. +# with the same name, so we install these out of the way and provide a +# pkg-config file to pull them in. PROBE_HEADERS_INSTALL := common/sys/sdt.h \ common/sys/sdt_internal.h +# The pkg-config files undergo a few translations with sed before installation. + +SHARE_PKG_CONFIG_INSTALL := dtrace_sdt.pc + install:: mkdir -p $(INSTINCLUDEDIR)/sys $(call describe-install-target,$(INSTINCLUDEDIR)/sys,$(notdir $(SYS_HEADERS_INSTALL)))
@@ -26,3 +31,10 @@ install:: mkdir -p $(INSTSDTINCLUDEDIR)/sys $(call describe-install-target,$(INSTSDTINCLUDEDIR)/sys,$(notdir $(PROBE_HEADERS_INSTALL))) cd $(uts_DIR) && install -m 644 $(PROBE_HEADERS_INSTALL) $(INSTSDTINCLUDEDIR)/sys + mkdir -p $(INSTPKGCONFIGDIR) + $(call describe-install-target,$(INSTPKGCONFIGDIR),$(SHARE_PKG_CONFIG_INSTALL)) + for name in $(SHARE_PKG_CONFIG_INSTALL); do \ + cd $(uts_DIR) && \ + sed 's,@SDTINCLUDEDIR@,$(SDTINCLUDEDIR),g; s,@VERSION@,$(VERSION),g' < \ + $${name}.in > $(INSTPKGCONFIGDIR)/$$name; \ + done
uts/dtrace_sdt.pc.in new file +6 -0
@@ -0,0 +1,6 @@ +sdtincludedir = @SDTINCLUDEDIR@ + +Name: DTrace SDT +Description: DTrace raw SDT headers +Version: @VERSION@ +Cflags: -I${sdtincludedir}
Signature · 1 line
2.45.1.275.g567cb0950c
On 23 May 2024, Nick Alcock told this:
Quoted 5 lines
This moves it out of the way of SystemTap's rather different
sdt.h, and lets us remove the barely-working kludgery in the specfile to work around it. Right now, the new location is nailed into every user (sincesdt.hrequired no special cpp flags before now), but this is hardly a good long-term
solution: a better one will be forthcoming soon.
Tests of this now completed: no new fails anywhere I've tried: RPMs, "make install test-install" and direct source tree testing all works, with no sign of inability to find sdt.h anywhere in the logs.
Signature · 1 line
NULL && (void)