Open kevinuav opened 1 year ago
@kevinuav Have you tried removing sprintf or replacing them with snprintf as suggested in the log?
A workaround is to add set(CMAKE_OSX_SYSROOT "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk")
to https://github.com/PX4/PX4-Autopilot/blob/main/CMakeLists.txt
A workaround is to add
set(CMAKE_OSX_SYSROOT "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk")
to https://github.com/PX4/PX4-Autopilot/blob/main/CMakeLists.txt
Didn't work for me, still get error:
[ 6%] Building CXX object platforms/common/CMakeFiles/px4_platform.dir/px4_log.cpp.o
/Users/kevin/Downloads/PX4-Autopilot/platforms/common/px4_log.cpp:106:11: fatal error: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
pos += sprintf(buf + pos, "%s", __px4_log_level_color[level]);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
1 error generated.
make[2]: *** [platforms/common/CMakeFiles/px4_platform.dir/px4_log.cpp.o] Error 1
make[1]: *** [platforms/common/CMakeFiles/px4_platform.dir/all] Error 2
make: *** [all] Error 2
@walchko did you ever solve this?
@walchko did you ever solve this?
No ... sorry
Here's how to fix this (and it works on other macOS versions too).
cd into /Library/Developer/CommandLineTools/SDKs/
rename the latest SDK (so if its 14.2 call is 14.1)
then add a symlink to 12.3 but ensure the link is whatever your system is currently using (so if 14.2 do below)
sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk MacOSX14.2.sdk
12.3 seems to be what works for me.
Describe the bug
. I am using mac to develop px4's firmware(v1.14.0-beat). It did well on my old system BigSur . But not after I upgraded it to the latest OSX Ventura v13.2.
To Reproduce
When compiling for gazebo, it reports the issues like this:
It seems like that the apple's command line doesn't support the function "sprintf()" anymore. Although the very same codes can be compiled successfully.
Log Files and Screenshots
Here is the full output: