# SITL Building issues

**URL:** <https://discuss.px4.io/t/sitl-building-issues/9910>\
**Category:** PX4 Autopilot\
**Created:** [March 7, 2019, 7:48pm UTC](https://discuss.px4.io/t/sitl-building-issues/9910 "2019-03-07T19:48:51Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![sk12345](https://discuss.px4.io/letter_avatar_proxy/v4/letter/s/3ab097/32.png) [@sk12345](https://discuss.px4.io/u/sk12345)\
**Post date:** [March 7, 2019, 7:48pm UTC](https://discuss.px4.io/t/sitl-building-issues/9910/1 "2019-03-07T19:48:51Z")

</div>

Hello,

I’m having some issues with the SITL simulation. I’m not sure how I broke it, but somehow I have. It was working previously. Without reinstalling ubuntu and starting from scratch, I’m stumped on how to fix this.

When I run this command “make px4\_sitl\_default gazebo” I get this message (note I killed it at the end after the real error):

```
sk@sk-Precision-5520:~/Firmware$ make px4_sitl_default gazebo
[2/6] Performing configure step for 'sitl_gazebo'
-- install-prefix: /usr/local
-- Boost version: 1.58.0
-- Found the following Boost libraries:
-- system
-- thread
-- timer
-- filesystem
-- chrono
-- date_time
-- atomic
-- Boost version: 1.58.0
-- Building klt_feature_tracker without catkin
-- Building OpticalFlow with OpenCV
-- catkin DISABLED
Gazebo version: 7.0
-- Using C++14 compiler
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sk/Firmware/build/px4_sitl_default/build_gazebo
[3/6] Performing build step for 'sitl_gazebo'
ninja: no work to do.
[6/6] cd /home/sk/Firmware/build/px4_sitl_default/tmp && /home/sk/Firmware/Tools/sitl_run.sh /home/sk/Firmware/build/px4_sitl_default/bin/px4 none gazebo none /home/sk/Firmware /home/sk/Firmware/build/px4_sitl_default
SITL ARGS
sitl_bin: /home/sk/Firmware/build/px4_sitl_default/bin/px4
debugger: none
program: gazebo
model: none
src_path: /home/sk/Firmware
build_path: /home/sk/Firmware/build/px4_sitl_default
empty model, setting iris as default
GAZEBO_PLUGIN_PATH :/home/sk/Firmware/build/px4_sitl_default/build_gazebo:/home/sk/Firmware/build/px4_sitl_default/build_gazebo
GAZEBO_MODEL_PATH :/home/sk/catkin_ws/src/avoidance/sim/models:/home/sk/Firmware/Tools/sitl_gazebo/models:/home/sk/Firmware/Tools/sitl_gazebo/models
LD_LIBRARY_PATH /home/sk/catkin_ws/devel/lib:/opt/ros/kinetic/lib:/opt/ros/kinetic/lib/x86_64-linux-gnu:/home/sk/Firmware/build/px4_sitl_default/build_gazebo:/home/sk/Firmware/build/px4_sitl_default/build_gazebo
Gazebo multi-robot simulator, version 7.0.0
Copyright (C) 2012-2016 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 10.3.18.229
[Dbg] [gazebo_mavlink_interface.cpp:137] <joint_name> not found for channel[0] no joint control will be performed for this channel.
[Dbg] [gazebo_mavlink_interface.cpp:137] <joint_name> not found for channel[1] no joint control will be performed for this channel.
[Dbg] [gazebo_mavlink_interface.cpp:137] <joint_name> not found for channel[2] no joint control will be performed for this channel.
[Dbg] [gazebo_mavlink_interface.cpp:137] <joint_name> not found for channel[3] no joint control will be performed for this channel.
[Wrn] [gazebo_mavlink_interface.cpp:126] joint [zephyr_delta_wing::propeller_joint] not found for channel[4] no joint control for this channel.
[Wrn] [gazebo_mavlink_interface.cpp:126] joint [zephyr_delta_wing::flap_left_joint] not found for channel[5] no joint control for this channel.
[Wrn] [gazebo_mavlink_interface.cpp:126] joint [zephyr_delta_wing::flap_right_joint] not found for channel[6] no joint control for this channel.
[Dbg] [gazebo_mavlink_interface.cpp:137] <joint_name> not found for channel[7] no joint control will be performed for this channel.
[Msg] Conecting to PX4 SITL using TCP
[Msg] Lockstep is enabled
[Msg] Speed factor set to: 1
SITL COMMAND: "/home/sk/Firmware/build/px4_sitl_default/bin/px4" "/home/sk/Firmware"/ROMFS/px4fmu_common -s etc/init.d-posix/rcS -t "/home/sk/Firmware"/test_data
INFO [px4] Creating symlink /home/sk/Firmware/ROMFS/px4fmu_common -> /home/sk/Firmware/build/px4_sitl_default/tmp/rootfs/etc
ERROR [px4_daemon] error binding socket
0 WARNING: setRealtimeSched failed (not run as root?)

________  _____ 
| ___ \ \ \ / / / |
| |_/ / \ V / / /| |
| __/ / \ / /_| |
| | / /^\ \ \___ |
\_| \/ \/ |_/

px4 starting.

INFO [px4] Calling startup script: /bin/sh etc/init.d-posix/rcS 0
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
ERROR [px4_daemon] error connecting to socket
Error: no autostart file found (etc/init.d-posix/ERROR [px4_daemon] error connecting to socket_*)
ERROR [px4] Startup script returned with return value: 256
pxh> Gazebo multi-robot simulator, version 7.0.0
Copyright (C) 2012-2016 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 10.3.18.229
[Wrn] [Event.cc:87] Warning: Deleteing a connection right after creation. Make sure to save the ConnectionPtr from a Connect call

Exiting...
pxh> Shutting down
/home/sk/Firmware/Tools/sitl_run.sh: line 151: kill: (666) - No such process
ninja: build stopped: interrupted by user.
Makefile:190: recipe for target 'px4_sitl_default' failed
make: *** [px4_sitl_default] Interrupt

```

If I run that same command with sudo in front I have no issues. I have tried adding the user to the dialout group, however this didn’t help.

I’m not sure what I’ve managed to break. I’ve tried recloning the firmware with no success, as well as make clean too.

Any suggestions on what the issue might be would be really helpful.  
Thanks!

---

<div class="post-metadata">

**Author:** ![RicardoM17](https://discuss.px4.io/user_avatar/discuss.px4.io/ricardom17/32/4040_2.png) [@RicardoM17](https://discuss.px4.io/u/RicardoM17)\
**Post date:** [March 14, 2019, 2:19pm UTC](https://discuss.px4.io/t/sitl-building-issues/9910/2 "2019-03-14T14:19:16Z")

</div>

Same issue here.

For the record I’m on Ubuntu 18.04. I was messing with some files trying to add a new model but now I’m trying on a reset master and I have the same outcome as you. Using sudo works so atleast we have that.

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [March 14, 2019, 3:04pm UTC](https://discuss.px4.io/t/sitl-building-issues/9910/3 "2019-03-14T15:04:36Z")

</div>

Hm, that’s odd. Can you check if you have permissions to `/tmp`?

---

<div class="post-metadata">

**Author:** ![RicardoM17](https://discuss.px4.io/user_avatar/discuss.px4.io/ricardom17/32/4040_2.png) [@RicardoM17](https://discuss.px4.io/u/RicardoM17)\
**Post date:** [March 14, 2019, 3:26pm UTC](https://discuss.px4.io/t/sitl-building-issues/9910/4 "2019-03-14T15:26:40Z")

</div>

yap by using `/tmp` it just moves me to that directory so yea all good

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [March 14, 2019, 9:49pm UTC](https://discuss.px4.io/t/sitl-building-issues/9910/5 "2019-03-14T21:49:35Z")

</div>

What’s the output of this?

```auto
ls -ld /tmp

```

---

<div class="post-metadata">

**Author:** ![RicardoM17](https://discuss.px4.io/user_avatar/discuss.px4.io/ricardom17/32/4040_2.png) [@RicardoM17](https://discuss.px4.io/u/RicardoM17)\
**Post date:** [March 15, 2019, 12:45pm UTC](https://discuss.px4.io/t/sitl-building-issues/9910/6 "2019-03-15T12:45:10Z")

</div>

`drwxrwxrwt 17 root root 12288 Mar 15 13:36 /tmp`

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [March 15, 2019, 4:28pm UTC](https://discuss.px4.io/t/sitl-building-issues/9910/7 "2019-03-15T16:28:37Z")

</div>

Ok, that’s the same that I have, so shouldn’t be the problem.

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [March 15, 2019, 4:32pm UTC](https://discuss.px4.io/t/sitl-building-issues/9910/8 "2019-03-15T16:32:21Z")

</div>

Can you change this line:

> <https://github.com/PX4/Firmware/blob/e9fb17c51af834532d34c1d74707838d8c28a849/platforms/posix/src/px4_daemon/client.cpp#L81>

to:

`PX4_ERR("error connecting to socket: %s", strerror(errno));`

and see what the output is?

---

<div class="post-metadata">

**Author:** ![Oliver\_ss](https://discuss.px4.io/letter_avatar_proxy/v4/letter/o/ac91a4/32.png) [@Oliver\_ss](https://discuss.px4.io/u/Oliver_ss)\
**Post date:** [April 17, 2019, 7:56pm UTC](https://discuss.px4.io/t/sitl-building-issues/9910/9 "2019-04-17T19:56:59Z")

</div>

Hi, I met the same problem and I tried to let it report the problem. it showed “ERROR [px4\_daemon] error connecting to socket: Permission denied”

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [April 23, 2019, 11:25am UTC](https://discuss.px4.io/t/sitl-building-issues/9910/10 "2019-04-23T11:25:04Z")

</div>

Since it’s a permission problem, can you try if it works with `sudo`?

---

<div class="post-metadata">

**Author:** ![hhenryy](https://discuss.px4.io/user_avatar/discuss.px4.io/hhenryy/32/16488_2.png) [@hhenryy](https://discuss.px4.io/u/hhenryy)\
**Post date:** [December 2, 2019, 12:46pm UTC](https://discuss.px4.io/t/sitl-building-issues/9910/11 "2019-12-02T12:46:57Z")

</div>

I am having the same issue. However, making the changes that @JulianOes suggest doesn’t print anything new. I found making the same changes in the following file, PX4/platforms/posix/src/px4\_daemon/server.cpp does provide additional information. The error is:

ERROR [px4\_daemon] error connecting to socket: Address already in use

Hope this can help.

---

<div class="post-metadata">

**Author:** ![hhenryy](https://discuss.px4.io/user_avatar/discuss.px4.io/hhenryy/32/16488_2.png) [@hhenryy](https://discuss.px4.io/u/hhenryy)\
**Post date:** [December 2, 2019, 2:16pm UTC](https://discuss.px4.io/t/sitl-building-issues/9910/12 "2019-12-02T14:16:40Z")

</div>

The path to the socket file is described in PX4/platforms/posix/src/px4\_daemon/sock\_protocol.cpp. In my case it was /tmp/px4-sock-\*

Go to /tmp and see who owns your px4-sock file. If it is owned by root, that’s why you cannot build PX4 without sudo. Just delete both of the px4-sock\* files and build PX4 without sudo.

If you built PX4 with root before some of the built files will be owned by root. You will need to delete those. In my case it was the hidden files: .ninja\_deps and .ninja\_log located in PX4/build/px4\_sitl\_default

---

<div class="post-metadata">

**Author:** ![Ranjeet](https://discuss.px4.io/user_avatar/discuss.px4.io/ranjeet/32/6514_2.png) [@Ranjeet](https://discuss.px4.io/u/Ranjeet)\
**Post date:** [October 11, 2020, 6:03pm UTC](https://discuss.px4.io/t/sitl-building-issues/9910/13 "2020-10-11T18:03:22Z")

</div>

@hhenryy, correct explanation of the problem. You should be a part of the dev team. Thanks it solved my problem.

---

<div class="post-metadata">

**Author:** ![Sunghun\_Jung](https://discuss.px4.io/user_avatar/discuss.px4.io/sunghun_jung/32/6429_2.png) [@Sunghun\_Jung](https://discuss.px4.io/u/Sunghun_Jung)\
**Post date:** [August 30, 2021, 2:50am UTC](https://discuss.px4.io/t/sitl-building-issues/9910/14 "2021-08-30T02:50:11Z")

</div>

This works great. Thank you very much.
