[Solved]Compile Error: Permission denied with Ubuntu 16.04 PX4 V1.9

I have followed the instructions as px4_dev_env to install all the dependencies, all succeed.
some difference maybe: I installed FastCDR1.0.7 and FastRTPS-1.5.0
but when I tried to compile, the error was shown as below:
make px4_sitl_default
[13/22] Building C object src/systemcm…CMakeFiles/systemcmds__ver.dir/ver.c.o
FAILED: /usr/bin/ccache /usr/bin/cc -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=“ver” -DPX4_BOARD_NAME=“PX4_SITL” -DPX4_MAIN=ver_app_main -D__CUSTOM_FILE_IO__ -D__DF_LINUX -D__PX4_LINUX -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function=“attribute((noreturn))” -I…/…/boards/px4/sitl/src -I. -Isrc -Isrc/lib -Isrc/modules -I…/…/src -I…/…/src/include -I…/…/src/lib -I…/…/src/lib/DriverFramework/framework/include -I…/…/src/lib/matrix -I…/…/src/modules -I…/…/src/platforms -I…/…/src/platforms/common -I…/…/platforms/posix/include -Iexternal/Install/include -O2 -g -DNDEBUG -fPIC -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wformat-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-implicit-fallthrough -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fno-common -Wbad-function-cast -Wnested-externs -Wstrict-prototypes -std=gnu11 -MMD -MT src/systemcmds/ver/CMakeFiles/systemcmds__ver.dir/ver.c.o -MF src/systemcmds/ver/CMakeFiles/systemcmds__ver.dir/ver.c.o.d -o src/systemcmds/ver/CMakeFiles/systemcmds__ver.dir/ver.c.o -c …/…/src/systemcmds/ver/ver.c
ccache: error: Failed to create file /home/iris/.ccache/tmp/tmp.cpp_stderr.iris-Precision-5530.24493.oXrvkt: Permission denied
[13/22] Linking CXX static library src…/bottle_drop/libmodules__bottle_drop.a
ninja: build stopped: subcommand failed.
Makefile:193: recipe for target ‘px4_sitl_default’ failed
make: *** [px4_sitl_default] Error 1

the reason seem like some “sudo” things, I tried to compile with:
sudo make px4_sitl_default and it passed
However some error occurred when I use the avoidance node: it failed to communicate with daemon.
So I think I have to compile it without sudo and I’m stuck here. Does anyone can give me a help? Many thanks:-)

It sounds indeed like a permission problem. I suggest to clean up the ccache and build directory and then not use sudo to build:

sudo rm -r /home/iris/.ccache
sudo rm -r build
make ...

Please create a new post for this.

Thanks for the solution, and it did work!
As for the avoidance node problem, it didn’t happen after make px4_sitl_default.
If there’s any other problem, I’ll create a new post, thx!

By the way, for someone who has the same problem.
If you had usesudo make px4_sitl_default gazebo before, then when make px4_sitl_default gazebo may fail because some .sdfs is generated under root permission, so you may delete those .sdf according to the ERROR hints.

1 Like