Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SITL not working on alpine for Copter 4.5 (still) #27780

Open
Zavitit opened this issue Aug 7, 2024 · 11 comments
Open

SITL not working on alpine for Copter 4.5 (still) #27780

Zavitit opened this issue Aug 7, 2024 · 11 comments

Comments

@Zavitit
Copy link

Zavitit commented Aug 7, 2024

Bug report

As was mentioned in #27227
for some reason building SITL on alpine failed with the error in that issue

@peterbarker fixed the issue that was stated there but SITL still won't build properly
I've added a comment there (that ill quote here at the end) with the details of the docker I'm using and the error I've encountered I'd really appreciate help with this problem

Version
Copter 4.5

Platform
[ ] All
[ ] AntennaTracker
[X ] Copter
[ ] Plane
[ ] Rover
[ ] Submarine

Airframe type
cotacopter

Hardware type
Cube

Logs
adding the comment from the previous issue:

@peterbarker Thank you very much for the help but unfortunately I'm still having this issue

I'm adding my Dockerfile maybe I'm just doing something wrong?

FROM alpine:3.19 AS builder

WORKDIR /ardupilot

RUN apk update && apk add --no-cache \
        linux-headers \
        g++ \
        python3 \
        py-future \
        py-pip \
        libxml2-dev \
        libxslt-dev \
        git \
    && ln -sf python3 /usr/bin/python \
    &&  rm -rf /var/cache/apk/*

RUN python3 -m pip install --user --no-deps --no-cache-dir empy==3.3.4 pexpect ptyprocess --break-system-packages

RUN git clone https://github.com/ardupilot/ardupilot.git --depth 1 --single-branch src \
    && cd src \
    && git submodule update --init --recursive --depth 1

RUN cd /ardupilot/src && ./waf configure --board sitl --no-submodule-update \
    && ./waf copter
# ------ fails during ./waf copter------

ENTRYPOINT ["sh"]

i did some manual experimentation and just rerunning the ./waf copter command resulted in around 5 targets that won't compile
output for the last run:

Waf: Entering directory `/ardupilot/src/build/sitl'
Embedding file locations.txt:Tools/autotest/locations.txt
Embedding file models/Callisto.json:Tools/autotest/models/Callisto.json
Embedding file models/freestyle.json:Tools/autotest/models/freestyle.json
Embedding file models/plane-3d.parm:Tools/autotest/models/plane-3d.parm
Embedding file models/plane.parm:Tools/autotest/models/plane.parm
Embedding file models/xplane_heli.json:Tools/autotest/models/xplane_heli.json
Embedding file models/xplane_plane.json:Tools/autotest/models/xplane_plane.json
Generating compile_commands.json
Build commands will be stored in build/sitl/compile_commands.json
Generating compile_commands.json
Build commands will be stored in build/sitl/compile_commands.json
[ 802/1331] Compiling libraries/SITL/SIM_VectorNav.cpp
[ 843/1331] Compiling libraries/SITL/SIM_MicroStrain7.cpp
[ 844/1331] Compiling libraries/SITL/SIM_MicroStrain.cpp
[ 873/1331] Compiling libraries/SITL/SIM_GPS_NMEA.cpp
[ 884/1331] Compiling libraries/SITL/SIM_GPS_MSP.cpp
[ 889/1331] Compiling libraries/SITL/SIM_GPS.cpp
[ 893/1331] Compiling libraries/SITL/SIM_FlightAxis.cpp
[1073/1331] Compiling libraries/AP_HAL_SITL/SITL_cmdline.cpp
../../libraries/SITL/SIM_GPS_NMEA.cpp: In member function 'virtual void SITL::GPS_NMEA::publish(const SITL::GPS_Data*)':
../../libraries/SITL/SIM_GPS_NMEA.cpp:39:20: error: aggregate 'SITL::timeval tv' has incomplete type and cannot be defined
   39 |     struct timeval tv;
      |                    ^~
compilation terminated due to -Wfatal-errors.

../../libraries/SITL/SIM_MicroStrain.cpp: In static member function 'static void SITL::MicroStrain::simulation_timeval(SITL::timeval*)':
../../libraries/SITL/SIM_MicroStrain.cpp:44:27: error: aggregate 'SITL::timeval first_tv' has incomplete type and cannot be defined
   44 |     static struct timeval first_tv;
      |                           ^~~~~~~~
compilation terminated due to -Wfatal-errors.

../../libraries/SITL/SIM_GPS_MSP.cpp: In member function 'virtual void SITL::GPS_MSP::publish(const SITL::GPS_Data*)':
../../libraries/SITL/SIM_GPS_MSP.cpp:57:20: error: aggregate 'SITL::timeval tv' has incomplete type and cannot be defined
   57 |     struct timeval tv;
      |                    ^~
compilation terminated due to -Wfatal-errors.

../../libraries/SITL/SIM_GPS.cpp: In static member function 'static void SITL::GPS_Backend::simulation_timeval(SITL::timeval*)':
../../libraries/SITL/SIM_GPS.cpp:122:27: error: aggregate 'SITL::timeval first_tv' has incomplete type and cannot be defined
  122 |     static struct timeval first_tv;
      |                           ^~~~~~~~
compilation terminated due to -Wfatal-errors.

../../libraries/SITL/SIM_FlightAxis.cpp: In function 'double timestamp_sec()':
../../libraries/SITL/SIM_FlightAxis.cpp:103:12: error: reference to 'timeval' is ambiguous
  103 |     struct timeval tval;
      |            ^~~~~~~
compilation terminated due to -Wfatal-errors.

../../libraries/SITL/SIM_MicroStrain7.cpp: In member function 'virtual void SITL::MicroStrain7::send_gnss_packet()':
../../libraries/SITL/SIM_MicroStrain7.cpp:39:24: error: aggregate 'SITL::timeval tv' has incomplete type and cannot be defined
   39 |         struct timeval tv;
      |                        ^~
compilation terminated due to -Wfatal-errors.

../../libraries/SITL/SIM_VectorNav.cpp: In function 'void simulation_timeval(SITL::timeval*)':
../../libraries/SITL/SIM_VectorNav.cpp:71:27: error: aggregate 'SITL::timeval first_tv' has incomplete type and cannot be defined
   71 |     static struct timeval first_tv;
      |                           ^~~~~~~~
compilation terminated due to -Wfatal-errors.

../../libraries/AP_HAL_SITL/SITL_cmdline.cpp: In member function 'void HALSITL::SITL_State::_parse_command_line(int, char* const*)':
../../libraries/AP_HAL_SITL/SITL_cmdline.cpp:240:19: error: reference to 'timeval' is ambiguous
  240 |     static struct timeval first_tv;
      |                   ^~~~~~~
compilation terminated due to -Wfatal-errors.

Waf: Leaving directory `/ardupilot/src/build/sitl'
Build failed
 -> task in 'objs/SITL' failed (exit status 1): 
        {task 137329632954304: cxx SIM_GPS_NMEA.cpp -> SIM_GPS_NMEA.cpp.0.o}
 (run with -v to display more information)
 -> task in 'objs/SITL' failed (exit status 1): 
        {task 137329632958112: cxx SIM_MicroStrain.cpp -> SIM_MicroStrain.cpp.0.o}
 (run with -v to display more information)
 -> task in 'objs/SITL' failed (exit status 1): 
        {task 137329632954192: cxx SIM_GPS_MSP.cpp -> SIM_GPS_MSP.cpp.0.o}
 (run with -v to display more information)
 -> task in 'objs/SITL' failed (exit status 1): 
        {task 137329632953968: cxx SIM_GPS.cpp -> SIM_GPS.cpp.0.o}
 (run with -v to display more information)
 -> task in 'objs/SITL' failed (exit status 1): 
        {task 137329632953072: cxx SIM_FlightAxis.cpp -> SIM_FlightAxis.cpp.0.o}
 (run with -v to display more information)
 -> task in 'objs/SITL' failed (exit status 1): 
        {task 137329632958224: cxx SIM_MicroStrain7.cpp -> SIM_MicroStrain7.cpp.0.o}
 (run with -v to display more information)
 -> task in 'objs/SITL' failed (exit status 1): 
        {task 137329632964496: cxx SIM_VectorNav.cpp -> SIM_VectorNav.cpp.0.o}
 (run with -v to display more information)
 -> task in 'objs/AP_HAL_SITL/ArduCopter' failed (exit status 1): 
        {task 137329632802448: cxx SITL_cmdline.cpp -> SITL_cmdline.cpp.3.o}
 (run with -v to display more information)
@khancyr
Copy link
Contributor

khancyr commented Aug 7, 2024

hello,

Looks like a well know issue on alpine, it needs to include #include <sys/time.h>. Would you like to make a PR to correct this ? or I can do it later today

@Zavitit
Copy link
Author

Zavitit commented Aug 7, 2024

I started doing some changes with the <sys.time.h> and <time.h> but it became messy pretty fast and I don't want to make changes I don't fully understand
I'd really appreciate it if you could give it a go later 🙏

@khancyr
Copy link
Contributor

khancyr commented Aug 7, 2024

ok np, I will look at it tonight

@Zavitit
Copy link
Author

Zavitit commented Aug 11, 2024

@khancyr have you had a chance to look at this issue?

@Zavitit Zavitit closed this as completed Aug 11, 2024
@Zavitit Zavitit reopened this Aug 11, 2024
@Zavitit
Copy link
Author

Zavitit commented Aug 11, 2024

Sorry about the status change is was a miss-click 😅

@khancyr
Copy link
Contributor

khancyr commented Aug 11, 2024

Hello,

I forget... sorry. I will do it soon and add some test so alpine don't break again

@khancyr
Copy link
Contributor

khancyr commented Aug 12, 2024

solved in #27818

@peterbarker
Copy link
Contributor

@Zavitit could you test that @khancyr 's patches fix the problem, please?

@khancyr
Copy link
Contributor

khancyr commented Aug 13, 2024

Should be good for SITL. Linux target still have a lot of issues

@Zavitit
Copy link
Author

Zavitit commented Aug 14, 2024

unfortunately this fails for me but it looks like it might be a compatibility issue with the python version installed on my docker (3.11) what version where you using to test?

the crash i get when running ./waf compter

 ...
expanding uavcan.equipment.gnss.RTCMStream
expanding uavcan.equipment.gnss.Fix
expanding uavcan.equipment.gnss.ECEFPositionVelocity

multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.11/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
                    ^^^^^^^^^^^^^^^^^^^
  File "/ardupilot/src/modules/DroneCAN/dronecan_dsdlc/dronecan_dsdlc.py", line 118, in expand_message
    output = em.expand(msg_header_template, get_empy_env_broadcast(msg))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/em.py", line 5961, in expand
    result = interp.expand(data, locals, name, dispatcher=None)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/em.py", line 4681, in expand
    self.string(data, locals, dispatcher)
  File "/root/.local/lib/python3.11/site-packages/em.py", line 4830, in string
    while not self.safe(scanner, True, locals, dispatcher):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/em.py", line 4862, in safe
    if dispatcher():
       ^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/em.py", line 4843, in safe
    return self.parse(scanner, locals)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/em.py", line 4870, in parse
    token = scanner.one()
            ^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/em.py", line 3999, in one
    token.scan(self)
  File "/root/.local/lib/python3.11/site-packages/em.py", line 2648, in scan
    self.subscan(scanner, self.type)
  File "/root/.local/lib/python3.11/site-packages/em.py", line 2664, in subscan
    token = scanner.one()
            ^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/em.py", line 3999, in one
    token.scan(self)
  File "/root/.local/lib/python3.11/site-packages/em.py", line 2648, in scan
    self.subscan(scanner, self.type)
  File "/root/.local/lib/python3.11/site-packages/em.py", line 2664, in subscan
    token = scanner.one()
            ^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/em.py", line 3999, in one
    token.scan(self)
  File "/root/.local/lib/python3.11/site-packages/em.py", line 2648, in scan
    self.subscan(scanner, self.type)
  File "/root/.local/lib/python3.11/site-packages/em.py", line 2664, in subscan
    token = scanner.one()
            ^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/em.py", line 3995, in one
    raise ParseError("unknown markup sequence: `%s%s`%s" % (self.config.prefix, first, self.factory.addendum(first)))
em.ParseError: unknown markup sequence: `@)`; the `@)` markup has been removed, just use `)` instead
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/ardupilot/src/modules/DroneCAN/dronecan_dsdlc/dronecan_dsdlc.py", line 194, in <module>
    x = result.get()
        ^^^^^^^^^^^^
  File "/usr/lib/python3.11/multiprocessing/pool.py", line 774, in get
    raise self._value
em.ParseError: unknown markup sequence: `@)`; the `@)` markup has been removed, just use `)` instead

dronecangen returned 1 error code
Waf: Leaving directory `/ardupilot/src/build/sitl'
Build failed
 -> task in 'dronecan' failed (exit status 1): 
        {task 130332061951024: dronecangen ardupilot,com,cuav,dronecan,mppt,tests,uavcan -> }
 (run with -v to display more information)

@peterbarker
Copy link
Contributor

@Zavitit the empy version should be pinned to known-working version. Check the install script to see which one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants