Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1037185: bpftrace: Fix FTBFS on armhf

7 views
Skip to first unread message

Danilo Egea Gondolfo

unread,
Jun 7, 2023, 6:10:05 AM6/7/23
to
Package: bpftrace
Version: 0.17.0-2
Severity: normal
Tags: patch
User: ubuntu...@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

Danilo Egea Gondolfo

unread,
Jun 13, 2023, 4:30:04 AM6/13/23
to
On 07/06/2023 22:09, Vincent Bernat wrote:

> On 2023-06-07 12:07, Danilo Egea Gondolfo wrote:
>
>> * 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).
>
> Shouldn't all this be fixed upstream?

Hi,

I've started a discussion here https://github.com/iovisor/bpftrace/pull/2360

It appears to be a bug in GCC. One of the developers replied with a nice
explanation on why this code is required and suggested that building the
entire package using the ARM ISA could be a good solution.

Danilo Egea Gondolfo

unread,
Jul 12, 2023, 1:50:04 PM7/12/23
to
On 07/06/2023 22:09, Vincent Bernat wrote:

> On 2023-06-07 12:07, Danilo Egea Gondolfo wrote:
>
>> * 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).
>
> Shouldn't all this be fixed upstream?
Both problems were fixed upstream
https://github.com/iovisor/bpftrace/issues/2654
0 new messages