Issue: make check : #define BCM2835_HAVE_LIBCAP

188 views
Skip to first unread message

John L. Males

unread,
Sep 9, 2020, 8:01:49 AM9/9/20
to bcm...@googlegroups.com
Hello,

I found some code I want to use as base for extensive
enhancements I want to effect for my unique needs and I see
various bug fixes that the code needs.

So far the code I have used on a Raspberry Pi has used
wiringpi. This is my first time with code that uses bcm2835.

The tar -x, ./configure, make, make check, make install all
worked fine. The application would segfault. I did an strace
and guessed from this that maybe try to run the app with sudo.
The app worked, but will not work as user.

I discovered on the bcm2835 Web Page "Running as root" section.

This is on a Raspberry Pi 3B using Raspberry Pi OS (Buster) that
is up to date. I did do:

You also need to do these steps on the host once, to support
libcap and not-root read/write access to /dev/mem:

Install libcap support
sudo apt-get install libcap2 libcap-dev
2. Add current user to kmem group
\code
sudo adduser $USER kmem
Allow write access to /dev/mem by members of kmem group
echo 'SUBSYSTEM=="mem", KERNEL=="mem", GROUP="kmem",
MODE="0660"' | sudo tee /etc/udev/rules.d/98-mem.rules sudo
reboot

Then after the reboot I did a make clean, then ran ./configure
again, then make. To this point all is fine. When I did the
make check I had the following issue(s) I cannot resolve:

2020-09-06 12:15:32.495577983 +0000 UTC : 1599394532
pi@RaspberryPiOS-Base32 tty0 /mnt/RAMDisk/bcm2835-1.68 $ make
check Making check in src make[1]: Entering directory
'/mnt/RAMDisk/bcm2835-1.68/src' make test
make[2]: Entering directory '/mnt/RAMDisk/bcm2835-1.68/src'
gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT test.o -MD -MP
-MF .deps/test.Tpo -c -o test.o test.c mv
-f .deps/test.Tpo .deps/test.Po gcc -g -O2 -o test
test.o ./libbcm2835.a
-lrt /usr/bin/ld: ./libbcm2835.a(bcm2835.o): in function
`bcm2835_has_capability': /mnt/RAMDisk/bcm2835-1.68/src/bcm2835.c:
132: undefined reference to
`cap_get_proc' /usr/bin/ld: /mnt/RAMDisk/bcm2835-1.68/src/bcm2835.c:
136: undefined reference to
`cap_get_flag' /usr/bin/ld: /mnt/RAMDisk/bcm2835-1.68/src/bcm2835.c:
138: undefined reference to
`cap_free' /usr/bin/ld: /mnt/RAMDisk/bcm2835-1.68/src/bcm2835.c:
138: undefined reference to `cap_free' collect2: error: ld
returned 1 exit status make[2]: *** [Makefile:549: test] Error
1 make[2]: Leaving directory '/mnt/RAMDisk/bcm2835-1.68/src'
make[1]: *** [Makefile:850: check-am] Error 2 make[1]: Leaving
directory '/mnt/RAMDisk/bcm2835-1.68/src' make: *** [Makefile:
365: check-recursive] Error 1 2020-09-06 12:15:36.495577983
+0000 UTC : 1599394536 pi@RaspberryPiOS-Base32
tty0 /mnt/RAMDisk/bcm2835-1.68 $

I have searched high and low in the internet to see if I can
find out what I assume I am doing incorrectly or missed in the
instructions to accomplish running the application that uses
bcm2835. I am assuming I am doing something wrong or missed
doing to enable to application to run as normal user.

I do not want to run the application as matter of routine as
root application for obvious reasons.

If there is other information needed please advise. This is my
first time with bcm2835. The wiringpi based applications I
have used always run as normal user and have never presented
any issue. So from my point of view I know nothing about
wiringpi nor bcm2835. I have used Linux for over 20 years
and until a year ago was also my desktop OS.

I have many systems for personal hobby interests that run
24/7/365 with Linux and I create my own custom Linux based
Live images to support these x86_64 low power 24/7/365 systems.
I want to move a few of these 24/7/365 systems to Raspberry Pi
to use even less power than the existing low power x86_64
systems and improve my UPS solutions that are more efficient
than classic UPS approach.

I have had one Pi 24/7/365 system running for about 4 years now
I will move from the 1B to 3B. I have 5 applications to create
code for that are on a mix of uCs and I2C, and 1Wire based
devices/systems.

The code for this bcm2835 matter is for a different Pi, a Pi
3B, and will be a new 24/7/365 system and application.


John L. Males
Toronto, Ontario
Canada
09 September 2020 08:01 -0400 EDT


================================================================

2020-09-09 11:21:06+0000-UTC Time: 1599650466 PC/System time

9 Sep 11:21:06 ntpdate[67371]: ntpdate 4.2.8p12-a (1)

9 Sep 11:21:22 ntpdate[67668]: step time server 68.69.221.61
offset -0.014477 sec

FreeBSD 11.3-RELEASE-p13 FreeBSD 11.3-RELEASE-p13 #0: Tue Sep
1 06:56:51 UTC 2020
ro...@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC

(Work in progress alternative to Linux Kernel of its own right,
Debian, and
other Linux based Kernel distributions determined.)

Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz
Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz (1396.86-MHz K8-class
CPU) Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz (1396.86-MHz
K8-class CPU) Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz
(1396.86-MHz K8-class CPU) Intel(R) Core(TM) i3-2367M CPU @
1.40GHz (1396.86-MHz K8-class CPU) Intel(R) Core(TM) i3-2367M
CPU @ 1.40GHz (1396.86-MHz K8-class CPU)

dev.cpu.0.temperature: 84.0C
dev.cpu.1.temperature: 84.0C
dev.cpu.2.temperature: 80.0C
dev.cpu.3.temperature: 80.0C
hw.acpi.thermal.tz0.temperature: 85.1C

vmstat -s:

1166474213 cpu context switches
15373903 device interrupts
3665401 software interrupts
263232891 traps
2659638302 system calls
27 kernel threads created
696521 fork() calls
16738 vfork() calls
0 rfork() calls
2077 swap pager pageins
10371 swap pager pages paged in
1877 swap pager pageouts
19025 swap pager pages paged out
8802 vnode pager pageins
94909 vnode pager pages paged in
101 vnode pager pageouts
120 vnode pager pages paged out
90 page daemon wakeups
137664158 pages examined by the page daemon
0 clean page reclamation shortfalls
1886076 pages reactivated by the page daemon
27535388 copy-on-write faults
127727 copy-on-write optimized faults
187337421 zero fill pages zeroed
11694 zero fill pages prezeroed
2175 intransit blocking page faults
275591704 total VM faults taken
10741 page faults requiring I/O
0 pages affected by kernel thread creation
24556662 pages affected by fork()
585402 pages affected by vfork()
0 pages affected by rfork()
259192269 pages freed
5210599 pages freed by daemon
80281678 pages freed by exiting processes
872001 pages active
1687676 pages inactive
672553 pages in the laundry queue
685475 pages wired down
135061 pages free
4096 bytes per page
34300440 total name lookups
cache hits (86% pos + 4% neg) system 0% per-directory
deletions 0%, falsehits 0%, toolong 0%

Boot time : 1599539919

procs memory page disks
faults cpu0 cpu1 cpu2 cpu3 r b w avm
fre flt re pi po fr sr ad0 pa0 in sy cs us sy
id us sy id us sy id us sy id 1 0 0 24946936 540184 2493 17
0 0 2344 1245 0 0 139 24055 10550 48 6 46 49 6 45 49
6 45 49 6 45

memory info:

real memory = 17179869184 (16384 MB)
avail memory = 16495013888 (15730 MB)

last pid: 68896; load averages: 2.40, 2.71, 2.82 up
1+06:42:44 11:21:23 79 processes: 3 running, 75 sleeping, 1
zombie

Mem: 3407M Active, 6593M Inact, 2627M Laundry, 2678M Wired,
1554M Buf, 527M Free Swap: 48G Total, 66M Used, 48G Free

hw.physmem: 17053859840
hw.usermem: 14245982208
hw.realmem: 17179869184

total used free shared
buffers cached Mem: 16210872 8920060
7290812 0 0 0 Swap:
50331644 67784 50263860

swapinfo:

Device 1K-blocks Used Avail Capacity
/dev/ada0s1b 50331644 67784 50263860 0%

vmstat:

procs memory page disks
faults cpu r b w avm fre flt re pi po
fr sr ad0 pa0 in sy cs us sy id 2 0 0 24946936
540180 2493 17 0 0 2344 1245 0 0 139 24056 10550 49
6 45

Reply all
Reply to author
Forward
0 new messages