Please let me know how it goes.
Thanks
Please let me know how it goes.
Thanks
With above workaround, SITL compilation and linking on M1 is successful. Here it is (8K):
SITL running on M1.
3D view captured from .bin log in M1.
QGC (female voice) on M1.
MP (male voice) on Windows PC (TCP).
All normal.
As seen, QGC has a very poor speech capability.
That is great, what did you do exactly to LogStructure.h ??
thanks,
Corrado
Only for SITL compilation:
ardupilot/libraries/AP_Logger/LogStructure.h
ā¦
#include <AP_AIS/LogStructure.h>
// structure used to define logging format
struct LogStructure {
uint8_t msg_type;
ā¦
Only delete PACKED.
Ok, thanks!!!
Corrado
The whole struct to be deleted?
Looking at LogStructure.h and donāt understand what to edit. Can you please make it a bit clearer?
*** UPDATE *** Erased all occurencies of PACKED in LogStructure.h and now sitl compiles.
Thank you very much.
@Webillo now if i start python3 sim_vehicle.py -v ArduCopter i get the following error:
ImportError: dlopen(/opt/homebrew/lib/python3.9/site-packages/gnureadline.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace ā_add_historyā
and it exits mavproxy. Is there a way to have sitl running as a separate object from mavproxy?
*** UPDATE *** started with option --no-mavproxy and it kind of started but than console is in following condition:
RiTW: Window access not found, logging to /tmp/ArduCopter.log
SIM_VEHICLE: Waiting for SITL to exit
I donāt think it is waiting for a connectionā¦
For me it compiles and links deleting PACKED in that single line.
See this.
In my case I changed in mavproxy.py gnureadline to readline (I think you can remove gnureadline module completely if you have it). If you cannot find it, try to upgrade mavproxy.py, or use the one in GitHub.
If not, another stupid thing never tested in M1.
Ok, thank you for the explanations.
Corrado
Is there a #define we could use so that this one thing could be compiled out only when building SITL on Mac?
I found that this breaks --speedup i.e. if I use this hack to get SITL to built then if I pass the --speedup option the SITL process will crash with an illegal hardware instruction error. If I donāt set speedup it works fine.
Itās nice to having it working but it seems a bit dodgy to me.
Could the --speedup
issue be related to SITL: crash on Apple M1 when the simulator is compiled for arm64 and --speedup is not specified at startup Ā· Issue #19588 Ā· ArduPilot/ardupilot Ā· GitHub and AP_Logger_File: fix a SITL crash on arm64 when no speedup was specified on the command line by ntamas Ā· Pull Request #19717 Ā· ArduPilot/ardupilot Ā· GitHub ?
It could be @ntamas . I have to look at this more because āsomething changedā recently and Iām not having this problem now. I think I still use the hack (remove PACKED) - the code compiles and builds and I have managed to run the entire suite of test.Plane scripts which include lots of various speedup values, so it must be working.
Another workaround that does not seem to require the removal of PACKED
is to compile the simulator for x86_64
and run it through Rosetta, i.e.:
CFLAGS="-arch x86_64" CXXFLAGS="-arch x86_64" LDFLAGS="-arch x86_64" \
./waf configure --board sitl --debug && ./waf copter
Okay, so it wasnāt clear for me from the previous posts so let me summarize my experiences:
Removing all occurrences of PACKED
from LogStructure.h
indeed works, but this breaks logging as sizeof(some_log_packet)
does not match the size of the log packet inferred from the format string any more, and the simulator complains about that (it even sends STATUSTEXT messages about the invalid logging configuration periodically).
I figured out that it is enough to remove PACKED
from one single place: struct PACKED LogStructure
in LogStructure.h
. All other instances of PACKED
may remain there, and then the warnings are gone, the logging works againā¦
ā¦or well, not exactly. Logging starts, and then I hit this issue again if I donāt specify a speedup value explicitly at startup (i.e. -S 1
). Note that this happens only for a native arm64
binary; Intel binaries still work.
Iāve asked on the #simulation channel on Discord why struct LogStructure
needs to be packed; if I get an answer and it doesnāt need to be packed, Iāll submit a PR to remove it.
Yes, Rosetta works very well.
From here:
For me it compiles and links deleting PACKED in that single line.
I never experienced this problem, but have no idea why not.
There must be a subtle difference in Intel and M1 64bit arquitectures about this (no idea).
Do you use sim_vehicle.py
to start the SITL? If so, thatās the reason; sim_vehicle.py
seems to pass --speedup
unconditionally.
Yes, thanks, now I see that the detailed execution command of an example with sim_vehicle.py ⦠(without speedup) is:
ā¦ardupilot/build/sitl/bin/arducopter -S --model + --speedup 1 --defaults ā¦
Hello,
Not sure if anyone will check this SOLVED thread but actual Iāve got an issue compiling copter sitl just recently after updating my mac m1 to Sonoma 14.4.
Before that like 1-2 months ago I was successfully able to compile the same codebase and there wasnāt any issue.
The following error is shown in console
Build failed
-> task in 'bin/arducopter' failed (exit status 1):
{task 4362910992: cxxprogram AP_Arming.cpp.50.o,AP_ExternalControl_Copter.cpp.50.o,AP_Rally.cpp.50.o,AP_State.cpp.50.o,Attitude.cpp.50.o,Copter.cpp.50.o,GCS_Copter.cpp.50.o,GCS_Mavlink.cpp.50.o,Log.cpp.50.o,Parameters.cpp.50.o,RC_Channel.cpp.50.o,UserCode.cpp.50.o,UserParameters.cpp.50.o,afs_copter.cpp.50.o,autoyaw.cpp.50.o,avoidance.cpp.50.o,avoidance_adsb.cpp.50.o,baro_ground_effect.cpp.50.o,commands.cpp.50.o,compassmot.cpp.50.o,crash_check.cpp.50.o,ekf_check.cpp.50.o,esc_calibration.cpp.50.o,events.cpp.50.o,failsafe.cpp.50.o,fence.cpp.50.o,heli.cpp.50.o,inertia.cpp.50.o,land_detector.cpp.50.o,landing_gear.cpp.50.o,mode.cpp.50.o,mode_acro.cpp.50.o,mode_acro_heli.cpp.50.o,mode_althold.cpp.50.o,mode_auto.cpp.50.o,mode_autorotate.cpp.50.o,mode_autotune.cpp.50.o,mode_avoid_adsb.cpp.50.o,mode_brake.cpp.50.o,mode_circle.cpp.50.o,mode_drift.cpp.50.o,mode_flip.cpp.50.o,mode_flowhold.cpp.50.o,mode_follow.cpp.50.o,mode_guided.cpp.50.o,mode_guided_nogps.cpp.50.o,mode_land.cpp.50.o,mode_loiter.cpp.50.o,mode_poshold.cpp.50.o,mode_rtl.cpp.50.o,mode_smart_rtl.cpp.50.o,mode_sport.cpp.50.o,mode_stabilize.cpp.50.o,mode_stabilize_heli.cpp.50.o,mode_systemid.cpp.50.o,mode_throw.cpp.50.o,mode_turtle.cpp.50.o,mode_zigzag.cpp.50.o,motor_test.cpp.50.o,motors.cpp.50.o,navigation.cpp.50.o,precision_landing.cpp.50.o,radio.cpp.50.o,sensors.cpp.50.o,standby.cpp.50.o,surface_tracking.cpp.50.o,system.cpp.50.o,takeoff.cpp.50.o,takeoff_check.cpp.50.o,terrain.cpp.50.o,toy_mode.cpp.50.o,tuning.cpp.50.o -> arducopter}
:
{task 4362910992: cxxprogram AP_Arming.cpp.50.o,AP_ExternalControl_Copter.cpp.50.o,AP_Rally.cpp.50.o,AP_State.cpp.50.o,Attitude.cpp.50.o,Copter.cpp.50.o,GCS_Copter.cpp.50.o,GCS_Mavlink.cpp.50.o,Log.cpp.50.o,Parameters.cpp.50.o,RC_Channel.cpp.50.o,UserCode.cpp.50.o,UserParameters.cpp.50.o,afs_copter.cpp.50.o,autoyaw.cpp.50.o,avoidance.cpp.50.o,avoidance_adsb.cpp.50.o,baro_ground_effect.cpp.50.o,commands.cpp.50.o,compassmot.cpp.50.o,crash_check.cpp.50.o,ekf_check.cpp.50.o,esc_calibration.cpp.50.o,events.cpp.50.o,failsafe.cpp.50.o,fence.cpp.50.o,heli.cpp.50.o,inertia.cpp.50.o,land_detector.cpp.50.o,landing_gear.cpp.50.o,mode.cpp.50.o,mode_acro.cpp.50.o,mode_acro_heli.cpp.50.o,mode_althold.cpp.50.o,mode_auto.cpp.50.o,mode_autorotate.cpp.50.o,mode_autotune.cpp.50.o,mode_avoid_adsb.cpp.50.o,mode_brake.cpp.50.o,mode_circle.cpp.50.o,mode_drift.cpp.50.o,mode_flip.cpp.50.o,mode_flowhold.cpp.50.o,mode_follow.cpp.50.o,mode_guided.cpp.50.o,mode_guided_nogps.cpp.50.o,mode_land.cpp.50.o,mode_loiter.cpp.50.o,mode_poshold.cpp.50.o,mode_rtl.cpp.50.o,mode_smart_rtl.cpp.50.o,mode_sport.cpp.50.o,mode_stabilize.cpp.50.o,mode_stabilize_heli.cpp.50.o,mode_systemid.cpp.50.o,mode_throw.cpp.50.o,mode_turtle.cpp.50.o,mode_zigzag.cpp.50.o,motor_test.cpp.50.o,motors.cpp.50.o,navigation.cpp.50.o,precision_landing.cpp.50.o,radio.cpp.50.o,sensors.cpp.50.o,standby.cpp.50.o,surface_tracking.cpp.50.o,system.cpp.50.o,takeoff.cpp.50.o,takeoff_check.cpp.50.o,terrain.cpp.50.o,toy_mode.cpp.50.o,tuning.cpp.50.o -> arducopter}
['/usr/bin/clang++', '-Wl,-dead_strip', '-pthread', 'ArduCopter/AP_Arming.cpp.50.o', 'ArduCopter/AP_ExternalControl_Copter.cpp.50.o', 'ArduCopter/AP_Rally.cpp.50.o', 'ArduCopter/AP_State.cpp.50.o', 'ArduCopter/Attitude.cpp.50.o', 'ArduCopter/Copter.cpp.50.o', 'ArduCopter/GCS_Copter.cpp.50.o', 'ArduCopter/GCS_Mavlink.cpp.50.o', 'ArduCopter/Log.cpp.50.o', 'ArduCopter/Parameters.cpp.50.o', 'ArduCopter/RC_Channel.cpp.50.o', 'ArduCopter/UserCode.cpp.50.o', 'ArduCopter/UserParameters.cpp.50.o', 'ArduCopter/afs_copter.cpp.50.o', 'ArduCopter/autoyaw.cpp.50.o', 'ArduCopter/avoidance.cpp.50.o', 'ArduCopter/avoidance_adsb.cpp.50.o', 'ArduCopter/baro_ground_effect.cpp.50.o', 'ArduCopter/commands.cpp.50.o', 'ArduCopter/compassmot.cpp.50.o', 'ArduCopter/crash_check.cpp.50.o', 'ArduCopter/ekf_check.cpp.50.o', 'ArduCopter/esc_calibration.cpp.50.o', 'ArduCopter/events.cpp.50.o', 'ArduCopter/failsafe.cpp.50.o', 'ArduCopter/fence.cpp.50.o', 'ArduCopter/heli.cpp.50.o', 'ArduCopter/inertia.cpp.50.o', 'ArduCopter/land_detector.cpp.50.o', 'ArduCopter/landing_gear.cpp.50.o', 'ArduCopter/mode.cpp.50.o', 'ArduCopter/mode_acro.cpp.50.o', 'ArduCopter/mode_acro_heli.cpp.50.o', 'ArduCopter/mode_althold.cpp.50.o', 'ArduCopter/mode_auto.cpp.50.o', 'ArduCopter/mode_autorotate.cpp.50.o', 'ArduCopter/mode_autotune.cpp.50.o', 'ArduCopter/mode_avoid_adsb.cpp.50.o', 'ArduCopter/mode_brake.cpp.50.o', 'ArduCopter/mode_circle.cpp.50.o', 'ArduCopter/mode_drift.cpp.50.o', 'ArduCopter/mode_flip.cpp.50.o', 'ArduCopter/mode_flowhold.cpp.50.o', 'ArduCopter/mode_follow.cpp.50.o', 'ArduCopter/mode_guided.cpp.50.o', 'ArduCopter/mode_guided_nogps.cpp.50.o', 'ArduCopter/mode_land.cpp.50.o', 'ArduCopter/mode_loiter.cpp.50.o', 'ArduCopter/mode_poshold.cpp.50.o', 'ArduCopter/mode_rtl.cpp.50.o', 'ArduCopter/mode_smart_rtl.cpp.50.o', 'ArduCopter/mode_sport.cpp.50.o', 'ArduCopter/mode_stabilize.cpp.50.o', 'ArduCopter/mode_stabilize_heli.cpp.50.o', 'ArduCopter/mode_systemid.cpp.50.o', 'ArduCopter/mode_throw.cpp.50.o', 'ArduCopter/mode_turtle.cpp.50.o', 'ArduCopter/mode_zigzag.cpp.50.o', 'ArduCopter/motor_test.cpp.50.o', 'ArduCopter/motors.cpp.50.o', 'ArduCopter/navigation.cpp.50.o', 'ArduCopter/precision_landing.cpp.50.o', 'ArduCopter/radio.cpp.50.o', 'ArduCopter/sensors.cpp.50.o', 'ArduCopter/standby.cpp.50.o', 'ArduCopter/surface_tracking.cpp.50.o', 'ArduCopter/system.cpp.50.o', 'ArduCopter/takeoff.cpp.50.o', 'ArduCopter/takeoff_check.cpp.50.o', 'ArduCopter/terrain.cpp.50.o', 'ArduCopter/toy_mode.cpp.50.o', 'ArduCopter/tuning.cpp.50.o', '-obin/arducopter', '-Llib', '-lArduCopter_libs', '-lm']
as well would be useful to know that failue happens only on latest step of compile
[1305/1305] Linking build/sitl/bin/arducopter
13:59:56 runner ['/usr/bin/clang++', '-Wl,-dead_strip', '-pthread', 'ArduCopter/AP_Arming.cpp.50.o', 'ArduCopter/AP_ExternalControl_Copter.cpp.50.o', 'ArduCopter/AP_Rally.cpp.50.o', 'ArduCopter/AP_State.cpp.50.o', 'ArduCopter/Attitude.cpp.50.o', 'ArduCopter/Copter.cpp.50.o', 'ArduCopter/GCS_Copter.cpp.50.o', 'ArduCopter/GCS_Mavlink.cpp.50.o', 'ArduCopter/Log.cpp.50.o', 'ArduCopter/Parameters.cpp.50.o', 'ArduCopter/RC_Channel.cpp.50.o', 'ArduCopter/UserCode.cpp.50.o', 'ArduCopter/UserParameters.cpp.50.o', 'ArduCopter/afs_copter.cpp.50.o', 'ArduCopter/autoyaw.cpp.50.o', 'ArduCopter/avoidance.cpp.50.o', 'ArduCopter/avoidance_adsb.cpp.50.o', 'ArduCopter/baro_ground_effect.cpp.50.o', 'ArduCopter/commands.cpp.50.o', 'ArduCopter/compassmot.cpp.50.o', 'ArduCopter/crash_check.cpp.50.o', 'ArduCopter/ekf_check.cpp.50.o', 'ArduCopter/esc_calibration.cpp.50.o', 'ArduCopter/events.cpp.50.o', 'ArduCopter/failsafe.cpp.50.o', 'ArduCopter/fence.cpp.50.o', 'ArduCopter/heli.cpp.50.o', 'ArduCopter/inertia.cpp.50.o', 'ArduCopter/land_detector.cpp.50.o', 'ArduCopter/landing_gear.cpp.50.o', 'ArduCopter/mode.cpp.50.o', 'ArduCopter/mode_acro.cpp.50.o', 'ArduCopter/mode_acro_heli.cpp.50.o', 'ArduCopter/mode_althold.cpp.50.o', 'ArduCopter/mode_auto.cpp.50.o', 'ArduCopter/mode_autorotate.cpp.50.o', 'ArduCopter/mode_autotune.cpp.50.o', 'ArduCopter/mode_avoid_adsb.cpp.50.o', 'ArduCopter/mode_brake.cpp.50.o', 'ArduCopter/mode_circle.cpp.50.o', 'ArduCopter/mode_drift.cpp.50.o', 'ArduCopter/mode_flip.cpp.50.o', 'ArduCopter/mode_flowhold.cpp.50.o', 'ArduCopter/mode_follow.cpp.50.o', 'ArduCopter/mode_guided.cpp.50.o', 'ArduCopter/mode_guided_nogps.cpp.50.o', 'ArduCopter/mode_land.cpp.50.o', 'ArduCopter/mode_loiter.cpp.50.o', 'ArduCopter/mode_poshold.cpp.50.o', 'ArduCopter/mode_rtl.cpp.50.o', 'ArduCopter/mode_smart_rtl.cpp.50.o', 'ArduCopter/mode_sport.cpp.50.o', 'ArduCopter/mode_stabilize.cpp.50.o', 'ArduCopter/mode_stabilize_heli.cpp.50.o', 'ArduCopter/mode_systemid.cpp.50.o', 'ArduCopter/mode_throw.cpp.50.o', 'ArduCopter/mode_turtle.cpp.50.o', 'ArduCopter/mode_zigzag.cpp.50.o', 'ArduCopter/motor_test.cpp.50.o', 'ArduCopter/motors.cpp.50.o', 'ArduCopter/navigation.cpp.50.o', 'ArduCopter/precision_landing.cpp.50.o', 'ArduCopter/radio.cpp.50.o', 'ArduCopter/sensors.cpp.50.o', 'ArduCopter/standby.cpp.50.o', 'ArduCopter/surface_tracking.cpp.50.o', 'ArduCopter/system.cpp.50.o', 'ArduCopter/takeoff.cpp.50.o', 'ArduCopter/takeoff_check.cpp.50.o', 'ArduCopter/terrain.cpp.50.o', 'ArduCopter/toy_mode.cpp.50.o', 'ArduCopter/tuning.cpp.50.o', '-obin/arducopter', '-Llib', '-lArduCopter_libs', '-lm']
ld: building fixups: pointer not aligned at __ZN12AP_FWVersion5fwverE+0x34 from /Users/r.koval/code/ardupilot/build/sitl/ArduCopter/Copter.cpp.50.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Meanwhile when I compile some other board, everything is finished without failure.
Any help is appreciated.
Thanks!
Iāll try to check this within a few days (I donāt remember exactly what happened two years ago), but recall from all above that it was a problem about structures alignment differences (and pointers) in M1 and x64. I modified source code and it compiled.