Package: bpftrace
Version: 0.17.0-2
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu mantic ubuntu-patch

Dear Maintainer,

* What led up to the situation?

The build is failing on armhf because cmake is not detecting the architecture correctly as we cross compile on arm64.

Also, after fixing the cmake part, the build will fail in src/triggers.h due to the attribute used when it build on arm 32-bit. It might be a bug on gcc but I'm not sure (clang++ doesn't throw the same error).

* What exactly did you do (or not do) that was effective (or ineffective)?

Patched debian/rules

* What was the outcome of this action?

The build is working on armhf and bpftrace works as expected.


*** /tmp/tmpyvgtuueq/bug_body

In Ubuntu, the attached patch was applied to achieve the following:


* Fix FTBFS on armhf.
As we cross compile bpftrace for armhf on arm64, cmake is not detecting
the architecture correctly.
It will also set the ISA explicitly to ARM to fix a problem in
src/triggers.h caused by the target("arm") attribute where the g++
compiler fails with "invalid conversion from ‘void (*)()’ to ‘void (*)()’"


Thanks for considering the patch.

*** /tmp/tmpyvgtuueq/bpftrace_0.17.0-2ubuntu1.debdiff
diff -Nru bpftrace-0.17.0/debian/rules bpftrace-0.17.0/debian/rules
--- bpftrace-0.17.0/debian/rules 2023-04-10 11:59:06.000000000 +0100
+++ bpftrace-0.17.0/debian/rules 2023-06-06 18:54:52.000000000 +0100
@@ -1,10 +1,20 @@
#!/usr/bin/make -f

+ifeq ($(DEB_HOST_ARCH), armhf)
+ # When cross compiling on arm64 for armhf, cmake will detect the architecture as armv8l. + # The CMAKE_SYSTEM_NAME appears to be required so cmake will actually use CMAKE_SYSTEM_PROCESSOR + # -marm is used so the build will not fail due to the __attribute__((target("arm")) in src/triggers.h
+ # when compiling with -mthumb. The g++ compiler will error out with:
+ # "invalid conversion from ‘void (*)()’ to ‘void (*)()’"
+ # See https://github.com/iovisor/bpftrace/commit/56106a650a8
+ ARMHF_FLAGS=-DCMAKE_SYSTEM_PROCESSOR:STRING="armv7-a" -DCMAKE_SYSTEM_NAME:STRING=Linux -DCMAKE_CXX_FLAGS:STRING=-marm
+endif
+
%:
dh $@

override_dh_auto_configure:
- dh_auto_configure -- -DBUILD_TESTING:BOOL=OFF -DUSE_SYSTEM_BPF_BCC=1
+ dh_auto_configure -- ${ARMHF_FLAGS} -DBUILD_TESTING:BOOL=OFF -DUSE_SYSTEM_BPF_BCC=1

STRIP_CMD=strip --keep-symbol=BEGIN_trigger --keep-symbol=END_trigger --remove-section=.comment --remove-section=.note
override_dh_strip:


-- System Information:
Debian Release: bookworm/sid
APT prefers mantic
APT policy: (500, 'mantic'), (100, 'mantic-proposed')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.2.0-21-generic (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8), LANGUAGE=en_IE:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Reply via email to