wimrijnders / V3DLib

C++ library for programming the VideoCore GPU on all Raspberry Pi's.
Other
116 stars 22 forks source link

Failed to build on Raspberry Pi4 #5

Open tvutonyguo opened 3 years ago

tvutonyguo commented 3 years ago

I tried to build V3DLib on my Raspberry Pi4 but I got error message as below. Can you please advise? Thanks.

make QPU=1 DEBUG=1 all

... make: *** No rule to make target '../CmdParameter/obj-debug/libCmdParameter.a', needed by 'obj/qpu-debug/bin/HeatMap'. Stop

Attached full building logs:

build_full_logs.txt .

scole02 commented 3 years ago

I ran into the same issue and had to manually run the script V3dLib/script/install.sh which installs the CmdParameter library and calls update_repo.sh.

anchung-chen commented 3 years ago

I ran into the same issue too, and found one solution is to unmark the make line in script/install.sh to make it compile without errors. Build on raspios-buster-arm64. Here is the modified script/install.sh

! /bin/bash

############################################################################### . "script/update_repo.sh"

update_repo CmdParameter "https://github.com/wimrijnders/CmdParameter.git" 0.4.1

Always build from scratch

make clean make DEBUG=1 all make DEBUG=0 all

make all

fadialzammar commented 2 years ago

I'm on a Pi3 and running into the same issue. Trying to run V3DLib/script/install.sh actually results in my terminal crashing, specifically from executing the line update_repo CmdParameter "https://github.com/wimrijnders/CmdParameter.git" 0.4.1.

makslevental commented 2 years ago

for anyone that gets here in 2022 (and later): you have to clone https://github.com/wimrijnders/CmdParameter.git adjacent to this repo, i.e.

pi@raspberrypi:~/dev_projects $ tree -L 1
.
├── CmdParameter
└── V3DLib

and then build CmdParameter using make DEBUG=0 all.

Only then can you run

make QPU=1 DEBUG=1 all 
make QPU=1 DEBUG=1 test

Note if you try to build this repo with DEBUG=0, then you'll get an error in Lib/v3d/KernelDriver.cpp:

Lib/v3d/KernelDriver.cpp: In function ‘void V3DLib::v3d::{anonymous}::_encode(const V3DLib::Instr::List&, V3DLib::v3d::Instructions&)’:
Lib/v3d/KernelDriver.cpp:735:11: error: ‘checkUniformAtTop’ was not declared in this scope
  735 |   assertq(checkUniformAtTop(instrs), "_encode(): checkUniformAtTop() failed (v3d)", true);
      |           ^~~~~~~~~~~~~~~~~
make: *** [Makefile:199: obj/qpu/Lib/v3d/KernelDriver.o] Error 1

You just need to fence a call to a debug helper around line 732:

--- a/Lib/v3d/KernelDriver.cpp
+++ b/Lib/v3d/KernelDriver.cpp
@@ -732,7 +732,9 @@ bool checkUniformAtTop(V3DLib::Instr::List const &instrs) {
  * Translate instructions from target to v3d
  */
 void _encode(V3DLib::Instr::List const &instrs, Instructions &instructions) {
+#ifdef DEBUG
   assertq(checkUniformAtTop(instrs), "_encode(): checkUniformAtTop() failed (v3d)", true);
+#endif
   bool prev_was_init_begin = false;

or just comment it out...

You might also need

sudo apt-get install libpthread-stubs0-dev

if you're getting linker errors about pthreads_once.

EDIT: if you get hands (something something timer expired), you probably need to

sudo usermod --append --groups video $USER

or

sudo setfacl -m u:$USER:rw /dev/dri/card*

or you need to reboot (I think I observed this failure mode when experimenting with https://github.com/Idein/py-videocore6)