package/uftrace: new package
PATCH 1/1 package/uftrace: new package
PATCH 1/1 package/uftrace: new package
Hello Giacomo,
Thanks for your contribution! See below for a number of comments and suggestions.
Quoted 7 lines · On Tue, 27 Oct 2020 00:14:14 +0100 Giacomo Longo <[email protected]> wrote:
From
57e136108b4ff900f3b7972f1f1c19a59ef9cf12Mon Sep 17 00:00:00 2001
From: Giacomo Longo <[email protected]>
Date: Mon, 26 Oct 2020 23:11:41 +0100
Subject: [PATCH 1/1] package/uftrace: new packageHello, first time trying to package something for BuildRoot and sending a patch via email.
Your patch should be sent using "git send-email". You can find at
https://git-send-email.io/ instructions on how to set up git send-email.
Quoted 13 lines
The package is a tracing utility similar to ltrace and strace that allows profiling of programs and their library calls.
I have performed a run of ./utils/check-package package/uftrace/* with the following result:
Quoted 2 lines
78 lines processed
0 warnings generatedI have performed a run of ./utils/test-pkg -d ../test-pkg -c
../uftrace.config-p uftrace -aQuoted 1 line
45 builds, 36 skipped, 0 build failed, 0 legal-info failed
Very good work!
Quoted 3 lines
The only architectures supported upstream are aarch64, arm and x86_64/i386. I could not build the program without glibc so it's marked as requiring a glibc toolchain.
What specific issues have you encountered with other C libraries ?
Quoted 2 lines
I am looking for some pointers on how to upstream my modification and feedback on the patch in its current state.
Read on for more comments :)
Quoted 7 lines
Signed-off-by Giacomo Longo <[email protected]>---
package/Config.in | 1 +
package/uftrace/Config.in | 41 ++++++++++++++++++++++++++++++++++++ package/uftrace/uftrace.hash | 3 +++package/uftrace/uftrace.mk| 34 ++++++++++++++++++++++++++++++4 files changed, 79 insertions(+)
Could you add an entry to the DEVELOPERS file for this package ?
Quoted 9 lines
package/uftrace/Config.in new file +3
-0@@ -0,0 +1,41 @@ +config BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS + bool + default y if BR2_aarch64
package/uftrace/Config.in line 13
Quoted 10 lines
package/uftrace/Config.in new file +10
-0+ default y if BR2_arm + default y if BR2_i386 + default y if BR2_x86_64 + +config BR2_PACKAGE_UFTRACE + bool "uftrace" + depends on BR2_TOOLCHAIN_USES_GLIBC + depends on BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS + depends on !BR2_STATIC_LIBS + select BR2_PACKAGE_ELFUTILS
When you "select" something, you must replicate its depends on. So here you must replicate:
depends on BR2_USE_WCHAR
depends on BR2_TOOLCHAIN_HAS_THREADS
package/uftrace/Config.in line 14
Quoted 1 line
package/uftrace/Config.in new file +1
-0+ select BR2_PACKAGE_UTIL_LINUX
You just need util-linux, and none of its sub-options ? This is quite odd, very often packages need libuuid, or libmount, etc.
package/uftrace/Config.in line 15
Quoted 1 line
package/uftrace/Config.in new file +1
-0+ select BR2_INSTALL_LIBSTDCPP
You cannot select this: it must be a "depends on".
Quoted 8 lines
package/uftrace/Config.in new file +7
-0+ help + Tool to trace and analyze execution of a program. + + https://uftrace.github.io/slide + +comment "uftrace needs a glibc toolchain w/ C++, dynamic library" + depends on !BR2_TOOLCHAIN_USES_GLIBC || BR2_STATIC_LIBS ||!BR2_INSTALL_LIBSTDCPP
You need to move this comment either before the BR2_PACKAGE_UFTRACE option, or at the end of file. Due to how kconfig works, if you have this comment between the BR2_PACKAGE_UFTRACE option and its sub-options, the sub-options will not properly be "indented" in menuconfig.
Also, you need to add a:
depends on BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS
so that the comment doesn't appear on architectures where uftrace is anyway not available.
package/uftrace/Config.in
Quoted 5 lines
package/uftrace/Config.in new file +5
-0+if BR2_PACKAGE_UFTRACE + +config BR2_PACKAGE_UFTRACE_LUAJIT + bool "luajit scripting support" + default n
default n is the default, so it's not needed.
Quoted 1 line
+ select
BR2_PACKAGE_LUAJIT
When you select, you need to replicate the "depends on" of the options you're selecting.
package/uftrace/Config.in
Quoted 6 lines
+ help
+ Enable luajit scripting supportpackage/uftrace/Config.in new file +4
-0+ +config BR2_PACKAGE_UFTRACE_TUI + bool "TUI support" + default n
Not needed.
Quoted 1 line
+ depends on
BR2_USE_WCHAR
ncurses doesn't depend on wchar, unless you needBR2_PACKAGE_NCURSES_WCHAR of course.
Quoted 3 lines
+ select
BR2_PACKAGE_NCURSES
+ help
+ Enable TUI support
Perhaps those two sub-options are not really needed, and you could simply enable luajit and ncurses support in the .mk file if the appropriate packages are enabled, like this:
ifeq ($(BR2_PACKAGE_LUAJIT),y)
... enable luajit support ...
else
... disable luajit support ...
endif
Quoted 7 lines
package/uftrace/uftrace.mk new file +1
-0@@ -0,0 +1,34 @@ +################################################################################
package/uftrace/uftrace.mk line 11
Quoted 10 lines
package/uftrace/uftrace.mk new file +10
-0+# +# uftrace +# +################################################################################ + +UFTRACE_VERSION = v0.9.4 +UFTRACE_SITE = $(call github,namhyung,uftrace,$(UFTRACE_VERSION)) +UFTRACE_LICENSE = GPL-2.0+ +UFTRACE_LICENSE_FILES = COPYING +UFTRACE_DEPENDENCIES = elfutils
You are selecting util-linux in the Config.in file, but you don't have any build dependency on it. Since you have tested with test-pkg, it seems like indeed util-linux is not a build dependency. Is it a runtime dependency ? If so, for what tool ?
package/uftrace/uftrace.mk line 14
Quoted 3 lines
package/uftrace/uftrace.mk new file +3
-0+ +ifeq ($(BR2_PACKAGE_UFTRACE_LUAJIT),y) +UFTRACE_DEPENDENCIES += luajit
There is no explicit ./configure option to enable/disable luajit support ?
package/uftrace/uftrace.mk line 18
Quoted 4 lines
package/uftrace/uftrace.mk new file +4
-0+endif + +ifeq ($(BR2_PACKAGE_UFTRACE_TUI),y) +UFTRACE_DEPENDENCIES += ncurses
Same question here.
Quoted 4 lines
package/uftrace/uftrace.mk new file +4
-0+endif + +ifeq ($(BR2_aarch64),y) +UFTRACE_CONF_OPTS = --arch=aarch64
package/uftrace/uftrace.mk line 32
Quoted 10 lines
package/uftrace/uftrace.mk new file +10
-0+else ifeq ($(BR2_arm),y) +UFTRACE_CONF_OPTS = --arch=arm +else ifeq ($(BR2_i386),y) +UFTRACE_CONF_OPTS = --arch=x86 +else ifeq ($(BR2_x86_64),y) +UFTRACE_CONF_OPTS = --arch=x86_64 +endif + +UFTRACE_CONF_OPTS += --without-libpython +UFTRACE_CONF_OPTS += --without-capstone
We generally prefer to have the unconditional options like this before the conditional ones, and written this way:
UFTRACE_CONF_OPTS = \ --without-libpython \ --without-capstone
Could you rework your patch to address those comments, and send a new iteration, preferably with git send-email ?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 1/1 package/uftrace: new package
First of all, thanks Thomas for your kind words and helping me finding my way around (this mail is my first git-send-patch).
I have tried to incorporate the feedback inside this second version of the patch.
Here's a list of the changes I've made:
I added myself to the DEVELOPERS file.
I decided to remove the configuration options concerning TUI and luajit, replacing them with an if inside the makefile. These are not core functionalities and probably are not worth of an extra configuration flag.
I removed the dependency on UTIL_LINUX that was not needed.
I have converted BR2_INSTALL_LIBSTDCPP from "selects" to "depends on".
The flags BR2_USE_WCHAR, BR2_TOOLCHAIN_HAS_THREADS coming from the selection of BR2_PACKAGE_ELFUTILS have been included as depends on.
Comment has been moved to the end of the file, and a dependency on the correct architecture has been added.
The makefile has been shuffled around:
- Standard configuration options are now at the top
- Architecture configuration follows
- Optional feature flags are at the bottom
Concerning the uClibc and musl incompatibility, build fails on non-glibc with this error:
uftrace-v0.9.4/cmds/record.c:2078:19: error: ?ADDR_NO_RANDOMIZE? undeclared (first use in this function)
if (personality(ADDR_NO_RANDOMIZE) < 0)
I have been able to find the symbol in musl at
https://git.musl-libc.org/cgit/musl/tree/include/sys/personality.h but apparently it does not work.
The patch as it is passes ./utils/test-pkg with 45 builds, 36 skipped, 0 build failed, 0 legal-info failed and ./utils/check-package package/uftrace/* with 62 lines processed and 0 warnings generated.
I have been able to test the package by assembling and running buildroot on QEMU system arm emulation (target arch Cortex A7).
Thanks again for your understanding, have a nice day.
PATCH v2 1/1 package/uftrace: new package
Hello Giaocomo,
Quoted 5 lines · On Tue, 27 Oct 2020 16:14:07 +0100 Giacomo Longo <[email protected]> wrote:
First of all, thanks Thomas for your kind words and helping me finding my way around (this mail is my first git-send-patch).
I have tried to incorporate the feedback inside this second version of the patch.
Thanks for your new iteration. I will reply directly on the patch itself for additional comments.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 package/uftrace: new package
In reply to Thomas Petazzoni--- DEVELOPERS | 3 +++ package/Config.in | 1 + package/uftrace/Config.in | 24 ++++++++++++++++++++++++ package/uftrace/uftrace.hash | 3 +++ package/uftrace/uftrace.mk | 35 +++++++++++++++++++++++++++++++++++ 5 files changed, 66 insertions(+) create mode 100644 package/uftrace/Config.in create mode 100644 package/uftrace/uftrace.hash create mode 100644 package/uftrace/uftrace.mk
DEVELOPERS +3 -0
@@ -980,6 +980,9 @@ N: Gerome Burlats <[email protected]> F: board/qemu/ F: configs/qemu_* +N: Giacomo Longo <[email protected]> +F: package/uftrace/ + N: Gilles Talis <[email protected]> F: board/freescale/imx8mmevk/ F: configs/freescale_imx8mmevk_defconfig
package/Config.in +1 -0
@@ -140,6 +140,7 @@ menu "Debugging, profiling and benchmark" source "package/trace-cmd/Config.in" source "package/trinity/Config.in" source "package/uclibc-ng-test/Config.in" + source "package/uftrace/Config.in" source "package/valgrind/Config.in" source "package/vmtouch/Config.in" source "package/whetstone/Config.in"
package/uftrace/Config.in new file +24 -0
@@ -0,0 +1,24 @@ +config BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS + bool + default y if BR2_aarch64 + default y if BR2_arm + default y if BR2_i386 + default y if BR2_x86_64 + +config BR2_PACKAGE_UFTRACE + bool "uftrace" + depends on BR2_TOOLCHAIN_USES_GLIBC + depends on BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS + depends on BR2_INSTALL_LIBSTDCPP + depends on !BR2_STATIC_LIBS + depends on BR2_USE_WCHAR # elfutils + depends on BR2_TOOLCHAIN_HAS_THREADS # elfutils + select BR2_PACKAGE_ELFUTILS + help + Tool to trace and analyze execution of a program. + + https://uftrace.github.io/slide + +comment "uftrace needs a glibc toolchain w/ C++, dynamic library, threads, wchar" + depends on BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS + depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP || BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR
package/uftrace/uftrace.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally computed: +sha512 f73ad4461051b9c61668161e077897d118ac556d234ff204e32bf14ecdc2c0df148da30ea5d5054641e79ea20b29261d6f637908f5047f5669207ef244865358 uftrace-v0.9.4.tar.gz +sha512 aee80b1f9f7f4a8a00dcf6e6ce6c41988dcaedc4de19d9d04460cbfb05d99829ffe8f9d038468eabbfba4d65b38e8dbef5ecf5eb8a1b891d9839cda6c48ee957 COPYING
package/uftrace/uftrace.mk new file +35 -0
@@ -0,0 +1,35 @@ +################################################################################ +# +# uftrace +# +################################################################################ + +UFTRACE_VERSION = v0.9.4 +UFTRACE_SITE = $(call github,namhyung,uftrace,$(UFTRACE_VERSION)) +UFTRACE_LICENSE = GPL-2.0+ +UFTRACE_LICENSE_FILES = COPYING +UFTRACE_DEPENDENCIES = elfutils + +UFTRACE_CONF_OPTS = \ + --without-capstone \ + --without-libpython + +ifeq ($(BR2_aarch64),y) +UFTRACE_CONF_OPTS += --arch=aarch64 +else ifeq ($(BR2_arm),y) +UFTRACE_CONF_OPTS += --arch=arm +else ifeq ($(BR2_i386),y) +UFTRACE_CONF_OPTS += --arch=i386 +else ifeq ($(BR2_x86_64),y) +UFTRACE_CONF_OPTS += --arch=x86_64 +endif + +ifeq ($(BR2_PACKAGE_LUAJIT),n) +UFTRACE_CONF_OPTS += --without-libluajit +endif + +ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),n) +UFTRACE_CONF_OPTS += --without-libncurses +endif + +$(eval $(autotools-package))
Signature · 1 line
2.28.0
PATCH 1/1 package/uftrace: new package
Hello,
Quoted 6 lines · On Tue, 27 Oct 2020 16:14:08 +0100 Giacomo Longo <[email protected]> wrote:
package/uftrace/Config.in new file +0
-0
package/uftrace/Config.in line 10
Quoted 10 lines
package/uftrace/Config.in new file +10
-0@@ -0,0 +1,24 @@ +config BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS + bool + default y if BR2_aarch64 + default y if BR2_arm + default y if BR2_i386 + default y if BR2_x86_64 + +config BR2_PACKAGE_UFTRACE + bool "uftrace" + depends on BR2_TOOLCHAIN_USES_GLIBC
In fact the reason why you can only use glibc is two-fold:
* You select elfutils, and elfutils does not build on musl.
* uftrace uses ADDR_NO_RANDOMIZE, which isn't supported in uClibc
So it would be good to write something like this:
# elfutils not available for musl, uClibc-ng does not # provide ADDR_NO_RANDOMIZE, so only glibc is supported depends on BR2_TOOLCHAIN_USES_GLIBC
package/uftrace/Config.in line 24
Quoted 3 lines
package/uftrace/Config.in new file +3
-0+comment "uftrace needs a glibc toolchain w/ C++, dynamic library, threads, wchar" + depends on BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS + depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP || BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR
Could you cut this line at ~80 characters, using a backslash ? See other packages.
package/uftrace/uftrace.hash line 3
Quoted 9 lines
package/uftrace/uftrace.hash new file +3
-0@@ -0,0 +1,3 @@ +# Locally computed: +sha512 f73ad4461051b9c61668161e077897d118ac556d234ff204e32bf14ecdc2c0df148da30ea5d5054641e79ea20b29261d6f637908f5047f5669207ef244865358 uftrace-v0.9.4.tar.gz +sha512 aee80b1f9f7f4a8a00dcf6e6ce6c41988dcaedc4de19d9d04460cbfb05d99829ffe8f9d038468eabbfba4d65b38e8dbef5ecf5eb8a1b891d9839cda6c48ee957 COPYING
Could you use sha256 hashes instead ?
package/uftrace/uftrace.hash
Quoted 2 lines
package/uftrace/uftrace.hash new file +2
-0+UFTRACE_VERSION = v0.9.4 +UFTRACE_SITE = $(call github,namhyung,uftrace,$(UFTRACE_VERSION))
Please don't encode the "v" in the version field. So please do:
UFTRACE_VERSION = 0.9.4UFTRACE_SITE = $(call github,namhyung,uftrace,v$(UFTRACE_VERSION))
Indeed, this will allow UFTRACE_VERSION to be used to check if new uftrace releases are available, using release-monitoring.org.
Quoted 9 lines
package/uftrace/uftrace.hash new file +9
-0+UFTRACE_LICENSE = GPL-2.0+ +UFTRACE_LICENSE_FILES = COPYING +UFTRACE_DEPENDENCIES = elfutils + +UFTRACE_CONF_OPTS = \ + --without-capstone \ + --without-libpython + +ifeq ($(BR2_aarch64),y)
package/uftrace/uftrace.hash
Quoted 10 lines
package/uftrace/uftrace.hash new file +10
-0+UFTRACE_CONF_OPTS += --arch=aarch64 +else ifeq ($(BR2_arm),y) +UFTRACE_CONF_OPTS += --arch=arm +else ifeq ($(BR2_i386),y) +UFTRACE_CONF_OPTS += --arch=i386 +else ifeq ($(BR2_x86_64),y) +UFTRACE_CONF_OPTS += --arch=x86_64 +endif + +ifeq ($(BR2_PACKAGE_LUAJIT),n)
BR2_PACKAGE_LUAJIT is never going to be "n", so this condition will never be true. Also, if luajit *is* there, you want luajit to be compiled before uftrace. So you want something like this:
# No --with-<option> available
ifeq ($(BR2_PACKAGE_LUAJIT),y)UFTRACE_DEPENDENCIES += luajit
elseUFTRACE_CONF_OPTS += --without-libluajit
endif
package/uftrace/uftrace.hash
Quoted 3 lines
package/uftrace/uftrace.hash new file +3
-0+ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),n) +UFTRACE_CONF_OPTS += --without-libncurses +endif
Same comment as above.
Quoted 1 line
+$(eval $(autotools-package))
This is not an autotools-based package: it uses a hand-written configure script, not one that is generated by autoconf. For example, this explains why it doesn't support --with-<foo>, but only --without-<foo>.
So, please use the generic-package infrastructure in this sort of cases. Using autotools-package should really only be done for packages that do use autoconf.
Could you adjust your package according to this ?
Thanks a lot!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v3 1/1 package/uftrace: new package
---
Hopefully this message will end into the email (formatted as per BR docs 21.5.5).
Following the helpful feedback from Thomas Petazzoni,
I have improved upon my v2 patchset and included the changelogs below for reference.
I have checked the patch as following:
$ ./utils/check-package ./package/uftrace/* 85 lines processed 0 warnings generated
$ ./utils/test-pkg -d ../test-pkg -c ../uftrace.config -p uftrace -a ... (omitted for brevity) 45 builds, 36 skipped, 0 build failed, 0 legal-info failed
The package has also been tested with a virtualized ARMv7 rootfs.
Changes v2 -> v3:
- added explainatation on why glibc is required
- splitted long lines in Config.in
- hashes are now calculated with sha256 instead of sha512
- package now leverages generic-package instead of autotools
- the prefix is now /usr instead of /usr/local to be more in line with other packages
- definitions of the build commands are placed near the bottom of the makefile
- added comments above the configuration options to explain why a check is needed
Changes v1 -> v2:
- added myself to DEVELOPERS
- removed configuration options that now are used in the makefile
- removed dependency on UTIL_LINUX that was not needed
- BR2_INSTALL_LIBSTDCPP is now "depends on" instead of "selects"
- comment in Config.in is now at the end of the file
- comment now will be shown only in the correct architecture
- makefile has been sorted:
- common configuration is at the top
- architecture configuration is in the middle
- feature flags are at the bottom
Changes v1:
- initial proposal
--- DEVELOPERS | 3 ++ package/Config.in | 1 + package/uftrace/Config.in | 28 +++++++++++++++++++ package/uftrace/uftrace.hash | 3 ++ package/uftrace/uftrace.mk | 54 ++++++++++++++++++++++++++++++++++++ 5 files changed, 89 insertions(+) create mode 100644 package/uftrace/Config.in create mode 100644 package/uftrace/uftrace.hash create mode 100644 package/uftrace/uftrace.mk
DEVELOPERS +3 -0
@@ -980,6 +980,9 @@ N: Gerome Burlats <[email protected]> F: board/qemu/ F: configs/qemu_* +N: Giacomo Longo <[email protected]> +F: package/uftrace/ + N: Gilles Talis <[email protected]> F: board/freescale/imx8mmevk/ F: configs/freescale_imx8mmevk_defconfig
package/Config.in +1 -0
@@ -140,6 +140,7 @@ menu "Debugging, profiling and benchmark" source "package/trace-cmd/Config.in" source "package/trinity/Config.in" source "package/uclibc-ng-test/Config.in" + source "package/uftrace/Config.in" source "package/valgrind/Config.in" source "package/vmtouch/Config.in" source "package/whetstone/Config.in"
package/uftrace/Config.in new file +28 -0
@@ -0,0 +1,28 @@ +config BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS + bool + default y if BR2_aarch64 + default y if BR2_arm + default y if BR2_i386 + default y if BR2_x86_64 + +config BR2_PACKAGE_UFTRACE + bool "uftrace" + # elfutils is not available on musl + # uClibc-ng does not support the ADDR_NO_RANDOMIZE personality + # so only glibc is supported + depends on BR2_TOOLCHAIN_USES_GLIBC + depends on BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS + depends on BR2_INSTALL_LIBSTDCPP + depends on !BR2_STATIC_LIBS + depends on BR2_USE_WCHAR # elfutils + depends on BR2_TOOLCHAIN_HAS_THREADS # elfutils + select BR2_PACKAGE_ELFUTILS + help + Tool to trace and analyze execution of a program. + + https://uftrace.github.io/slide + +comment "uftrace needs a glibc toolchain w/ C++, dynamic library, threads, wchar" + depends on BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS + depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP || \ + BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR
package/uftrace/uftrace.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally computed: +sha256 418d30c959d3b6d0dcafd55e588a5d414a9984b30f2522a5af004a268824a5a2 uftrace-0.9.4.tar.gz +sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 COPYING
package/uftrace/uftrace.mk new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
2.28.0