PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.48k stars 13.5k forks source link

Gazebo simulation compiling error after upgraded OSX from BigSur to the latest Ventura #21125

Open kevinuav opened 1 year ago

kevinuav commented 1 year ago

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:

/Users/kevin/PX4-Autopilot/src/lib/sensorcalibration/Utilities.hpp:91:2: 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]
        sprintf(str, "CAL%s%u_%s", sensor_type, instance, cal_type);

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:

% make px4_sitl gazebo_plane
-- PX4 version: v1.13.0-1-g49c4ca0620
-- Found PythonInterp: /usr/local/bin/python3 (found suitable version "3.9.16", minimum required is "3") 
-- PX4 config file: /Users/kevin/PX4-Autopilot/boards/px4/sitl/default.px4board
-- PLATFORM posix
-- ROMFSROOT px4fmu_common
-- TESTING y
-- ETHERNET y
-- PX4 config: px4_sitl_default
-- PX4 platform: posix
-- PX4 lockstep: enabled
-- cmake build type: RelWithDebInfo
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- The C compiler identification is AppleClang 14.0.0.14000029
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Building for code coverage
-- ccache enabled (export CCACHE_DISABLE=1 to disable)
-- ROMFS: ROMFS/px4fmu_common
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/kevin/PX4-Autopilot/build/px4_sitl_default
[0/868] git submodule src/drivers/gps/devices
[4/868] git submodule src/modules/mavlink/mavlink
[11/868] git submodule Tools/sitl_gazebo
[12/868] Generating Mavlink developmen...ssage_definitions/v1.0/development.xml
Validating /Users/kevin/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/development.xml
Parsing /Users/kevin/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/development.xml
Validating /Users/kevin/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/standard.xml
Parsing /Users/kevin/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/standard.xml
Validating /Users/kevin/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/common.xml
Parsing /Users/kevin/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/common.xml
Validating /Users/kevin/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/minimal.xml
Parsing /Users/kevin/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/minimal.xml
Merged enum MAV_CMD
Merged enum MAV_CMD
Found 230 MAVLink message types in 4 XML files
Generating C implementation in directory /Users/kevin/PX4-Autopilot/build/px4_sitl_default/mavlink/development
Generating C implementation in directory /Users/kevin/PX4-Autopilot/build/px4_sitl_default/mavlink/standard
Generating C implementation in directory /Users/kevin/PX4-Autopilot/build/px4_sitl_default/mavlink/common
Generating C implementation in directory /Users/kevin/PX4-Autopilot/build/px4_sitl_default/mavlink/minimal
Copying fixed headers for protocol 2.0 to /Users/kevin/PX4-Autopilot/build/px4_sitl_default/mavlink
[22/868] Performing configure step for 'sitl_gazebo'
-- install-prefix: /usr/local
-- cmake build type: RelWithDebInfo
-- The C compiler identification is AppleClang 14.0.0.14000029
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test COMPILER_SUPPORTS_CXX17
-- Performing Test COMPILER_SUPPORTS_CXX17 - Success
-- Performing Test COMPILER_SUPPORTS_CXX14
-- Performing Test COMPILER_SUPPORTS_CXX14 - Success
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Using C++17 standard
-- ccache enabled (export CCACHE_DISABLE=1 to disable)
-- Found Boost: /usr/local/lib/cmake/Boost-1.81.0/BoostConfig.cmake (found suitable version "1.81.0", minimum required is "1.58") found components: system thread filesystem 
CMake Warning (dev) at /usr/local/Cellar/cmake/3.25.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (PkgConfig)
  does not match the name of the calling package (gazebo).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.25.2/share/cmake/Modules/FindPkgConfig.cmake:99 (find_package_handle_standard_args)
  /usr/local/lib/cmake/gazebo/gazebo-config.cmake:62 (include)
  CMakeLists.txt:48 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2") 
-- Checking for module 'bullet>=2.82'
--   Found bullet, version 3.25
-- Found assimp: /usr/local/Cellar/assimp/5.2.5/include (found version "5.2.4") 
-- Found Threads: TRUE  
-- Found DART: /usr/local/include (Required is at least version "6.6") found components: dart 
-- Found Boost: /usr/local/lib/cmake/Boost-1.81.0/BoostConfig.cmake (found suitable version "1.81.0", minimum required is "1.40.0") found components: thread system filesystem program_options regex iostreams date_time 
-- Found Protobuf: /usr/local/lib/libprotobuf.dylib (found version "3.21.12") 
-- Looking for ignition-math6 -- found version 6.13.0
-- Searching for dependencies of ignition-math6
-- Looking for OGRE...
-- OGRE_PREFIX_WATCH changed.
-- Checking for module 'OGRE'
--   Found OGRE, version 1.9.0
-- Found Ogre Ghadamon (1.9.0)
-- Found OGRE: optimized;/usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreMain.dylib;debug;/usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreMain.dylib
-- Looking for OGRE_Paging...
-- Found OGRE_Paging: optimized;/usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgrePaging.dylib;debug;/usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgrePaging.dylib
-- Looking for OGRE_Terrain...
-- Found OGRE_Terrain: optimized;/usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreTerrain.dylib;debug;/usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreTerrain.dylib
-- Looking for OGRE_Property...
-- Found OGRE_Property: optimized;/usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreProperty.dylib;debug;/usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreProperty.dylib
-- Looking for OGRE_RTShaderSystem...
-- Found OGRE_RTShaderSystem: optimized;/usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreRTShaderSystem.dylib;debug;/usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreRTShaderSystem.dylib
-- Looking for OGRE_Volume...
-- Found OGRE_Volume: optimized;/usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreVolume.dylib;debug;/usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreVolume.dylib
-- Looking for OGRE_Overlay...
-- Found OGRE_Overlay: optimized;/usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreOverlay.dylib;debug;/usr/local/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreOverlay.dylib
-- Looking for ignition-math6 -- found version 6.13.0
-- Looking for ignition-transport8 -- found version 8.4.0
-- Searching for dependencies of ignition-transport8
-- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/lib/libz.tbd (found version "1.2.11") 
-- Config-file not installed for ZeroMQ -- checking for pkg-config
-- Checking for module 'libzmq >= 4'
--   Found libzmq , version 4.3.4
-- Found ZeroMQ: TRUE (Required is at least version "4") 
-- Found UUID: TRUE  
-- Looking for ignition-msgs5 -- found version 5.11.0
-- Searching for dependencies of ignition-msgs5
-- Looking for ignition-math6 -- found version 6.13.0
-- Checking for module 'tinyxml2'
--   Found tinyxml2, version 9.0.0
-- Looking for ignition-msgs5 -- found version 5.11.0
-- Looking for ignition-common3 -- found version 3.15.1
-- Searching for dependencies of ignition-common3
-- Looking for dlfcn.h - found
-- Looking for libdl - found
-- Found DL: TRUE  
-- Searching for <ignition-common3> component [graphics]
-- Looking for ignition-common3-graphics -- found version 3.15.1
-- Searching for dependencies of ignition-common3-graphics
-- Looking for ignition-math6 -- found version 6.13.0
-- Looking for ignition-fuel_tools4 -- found version 4.8.1
-- Searching for dependencies of ignition-fuel_tools4
-- Found CURL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/lib/libcurl.tbd (found version "7.85.0")  
-- Checking for module 'jsoncpp'
--   Found jsoncpp, version 1.9.4
-- Found JSONCPP: TRUE  
-- Checking for module 'yaml-0.1'
--   Found yaml-0.1, version 0.2.5
-- Found YAML: TRUE  
-- Checking for module 'libzip'
--   Found libzip, version 1.9.2
-- Found ZIP: TRUE  
-- Looking for ignition-common3 -- found version 3.15.1
-- Looking for ignition-math6 -- found version 6.13.0
-- Looking for ignition-msgs5 -- found version 5.11.0
-- Checking for one of the modules 'glib-2.0'
-- Found PythonInterp: /usr/local/bin/python3 (found suitable version "3.9.16", minimum required is "3") 
-- Found OpenCV: /usr/local/Cellar/opencv/4.7.0_1 (found version "4.7.0") 
-- Found TinyXML: /usr/local/lib/libtinyxml.dylib  
-- Checking for module 'gstreamer-1.0 >= 1.0'
--   Found gstreamer-1.0 , version 1.22.0
-- Checking for module 'gstreamer-base-1.0 >= 1.0'
--   Found gstreamer-base-1.0 , version 1.22.0
-- Checking for module 'gstreamer-app-1.0 >= 1.0'
--   Found gstreamer-app-1.0 , version 1.22.0
-- Found GStreamer: GSTREAMER_INCLUDE_DIRS;GSTREAMER_LIBRARIES;GSTREAMER_VERSION;GSTREAMER_BASE_INCLUDE_DIRS;GSTREAMER_BASE_LIBRARIES (Required is at least version "1.0") 
-- Checking for one of the modules 'icu-uc'
-- Checking for module 'OGRE'
--   Found OGRE, version 1.9.0
CMake Deprecation Warning at external/OpticalFlow/CMakeLists.txt:34 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

CMake Deprecation Warning at external/OpticalFlow/external/klt_feature_tracker/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Building klt_feature_tracker without catkin
-- Building OpticalFlow with OpenCV
-- Found MAVLink: /Users/kevin/PX4-Autopilot/build/px4_sitl_default/mavlink (found version "2.0") 
-- catkin DISABLED
-- Checking for module 'protobuf'
--   Found protobuf, version 3.21.12.0
-- Gazebo version: 11.12
-- Found GStreamer: adding gst_camera_plugin
-- Found GStreamer: adding gst_video_stream_widget
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/kevin/PX4-Autopilot/build/px4_sitl_default/build_gazebo
[298/868] Building CXX object src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Utilities.cpp.o
FAILED: src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Utilities.cpp.o 
/usr/local/bin/ccache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=\"sensor_calibration\" -D__CUSTOM_FILE_IO__ -D__PX4_DARWIN -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I/Users/kevin/PX4-Autopilot/boards/px4/sitl/src -I/Users/kevin/PX4-Autopilot/platforms/posix/src/px4/common/include -I/Users/kevin/PX4-Autopilot/build/px4_sitl_default -I/Users/kevin/PX4-Autopilot/build/px4_sitl_default/src/lib -I/Users/kevin/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/Users/kevin/PX4-Autopilot/platforms/common -I/Users/kevin/PX4-Autopilot/platforms/common/include -I/Users/kevin/PX4-Autopilot/src -I/Users/kevin/PX4-Autopilot/src/include -I/Users/kevin/PX4-Autopilot/src/lib -I/Users/kevin/PX4-Autopilot/src/lib/matrix -I/Users/kevin/PX4-Autopilot/src/modules -I/Users/kevin/PX4-Autopilot/platforms/posix/include -I/Users/kevin/PX4-Autopilot/build/px4_sitl_default/external/Install/include -O2 -g -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fPIC -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -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-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fcolor-diagnostics -fdiagnostics-absolute-paths -Qunused-arguments -Wno-c99-designator -Wno-unknown-warning-option -Wno-unused-const-variable -Wno-varargs -fno-exceptions -fno-threadsafe-statics -Wreorder -Wno-overloaded-virtual -fno-rtti -std=gnu++14 -MD -MT src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Utilities.cpp.o -MF src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Utilities.cpp.o.d -o src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Utilities.cpp.o -c /Users/kevin/PX4-Autopilot/src/lib/sensor_calibration/Utilities.cpp
/Users/kevin/PX4-Autopilot/src/lib/sensor_calibration/Utilities.cpp:67:3: 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]
                sprintf(str, "CAL_%s%u_ID", sensor_type, i);
                ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.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.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
1 error generated.
[302/868] Building CXX object src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Accelerometer.cpp.o
FAILED: src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Accelerometer.cpp.o 
/usr/local/bin/ccache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=\"sensor_calibration\" -D__CUSTOM_FILE_IO__ -D__PX4_DARWIN -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I/Users/kevin/PX4-Autopilot/boards/px4/sitl/src -I/Users/kevin/PX4-Autopilot/platforms/posix/src/px4/common/include -I/Users/kevin/PX4-Autopilot/build/px4_sitl_default -I/Users/kevin/PX4-Autopilot/build/px4_sitl_default/src/lib -I/Users/kevin/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/Users/kevin/PX4-Autopilot/platforms/common -I/Users/kevin/PX4-Autopilot/platforms/common/include -I/Users/kevin/PX4-Autopilot/src -I/Users/kevin/PX4-Autopilot/src/include -I/Users/kevin/PX4-Autopilot/src/lib -I/Users/kevin/PX4-Autopilot/src/lib/matrix -I/Users/kevin/PX4-Autopilot/src/modules -I/Users/kevin/PX4-Autopilot/platforms/posix/include -I/Users/kevin/PX4-Autopilot/build/px4_sitl_default/external/Install/include -O2 -g -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fPIC -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -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-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fcolor-diagnostics -fdiagnostics-absolute-paths -Qunused-arguments -Wno-c99-designator -Wno-unknown-warning-option -Wno-unused-const-variable -Wno-varargs -fno-exceptions -fno-threadsafe-statics -Wreorder -Wno-overloaded-virtual -fno-rtti -std=gnu++14 -MD -MT src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Accelerometer.cpp.o -MF src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Accelerometer.cpp.o.d -o src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Accelerometer.cpp.o -c /Users/kevin/PX4-Autopilot/src/lib/sensor_calibration/Accelerometer.cpp
In file included from /Users/kevin/PX4-Autopilot/src/lib/sensor_calibration/Accelerometer.cpp:36:
/Users/kevin/PX4-Autopilot/src/lib/sensor_calibration/Utilities.hpp:91:2: 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]
        sprintf(str, "CAL_%s%u_%s", sensor_type, instance, cal_type);
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.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.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
1 error generated.
[303/868] Building CXX object src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Barometer.cpp.o
FAILED: src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Barometer.cpp.o 
/usr/local/bin/ccache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=\"sensor_calibration\" -D__CUSTOM_FILE_IO__ -D__PX4_DARWIN -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I/Users/kevin/PX4-Autopilot/boards/px4/sitl/src -I/Users/kevin/PX4-Autopilot/platforms/posix/src/px4/common/include -I/Users/kevin/PX4-Autopilot/build/px4_sitl_default -I/Users/kevin/PX4-Autopilot/build/px4_sitl_default/src/lib -I/Users/kevin/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/Users/kevin/PX4-Autopilot/platforms/common -I/Users/kevin/PX4-Autopilot/platforms/common/include -I/Users/kevin/PX4-Autopilot/src -I/Users/kevin/PX4-Autopilot/src/include -I/Users/kevin/PX4-Autopilot/src/lib -I/Users/kevin/PX4-Autopilot/src/lib/matrix -I/Users/kevin/PX4-Autopilot/src/modules -I/Users/kevin/PX4-Autopilot/platforms/posix/include -I/Users/kevin/PX4-Autopilot/build/px4_sitl_default/external/Install/include -O2 -g -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fPIC -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -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-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fcolor-diagnostics -fdiagnostics-absolute-paths -Qunused-arguments -Wno-c99-designator -Wno-unknown-warning-option -Wno-unused-const-variable -Wno-varargs -fno-exceptions -fno-threadsafe-statics -Wreorder -Wno-overloaded-virtual -fno-rtti -std=gnu++14 -MD -MT src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Barometer.cpp.o -MF src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Barometer.cpp.o.d -o src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Barometer.cpp.o -c /Users/kevin/PX4-Autopilot/src/lib/sensor_calibration/Barometer.cpp
In file included from /Users/kevin/PX4-Autopilot/src/lib/sensor_calibration/Barometer.cpp:36:
/Users/kevin/PX4-Autopilot/src/lib/sensor_calibration/Utilities.hpp:91:2: 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]
        sprintf(str, "CAL_%s%u_%s", sensor_type, instance, cal_type);
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.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.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
1 error generated.
[304/868] Building CXX object src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Gyroscope.cpp.o
FAILED: src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Gyroscope.cpp.o 
/usr/local/bin/ccache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=\"sensor_calibration\" -D__CUSTOM_FILE_IO__ -D__PX4_DARWIN -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I/Users/kevin/PX4-Autopilot/boards/px4/sitl/src -I/Users/kevin/PX4-Autopilot/platforms/posix/src/px4/common/include -I/Users/kevin/PX4-Autopilot/build/px4_sitl_default -I/Users/kevin/PX4-Autopilot/build/px4_sitl_default/src/lib -I/Users/kevin/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/Users/kevin/PX4-Autopilot/platforms/common -I/Users/kevin/PX4-Autopilot/platforms/common/include -I/Users/kevin/PX4-Autopilot/src -I/Users/kevin/PX4-Autopilot/src/include -I/Users/kevin/PX4-Autopilot/src/lib -I/Users/kevin/PX4-Autopilot/src/lib/matrix -I/Users/kevin/PX4-Autopilot/src/modules -I/Users/kevin/PX4-Autopilot/platforms/posix/include -I/Users/kevin/PX4-Autopilot/build/px4_sitl_default/external/Install/include -O2 -g -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fPIC -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -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-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fcolor-diagnostics -fdiagnostics-absolute-paths -Qunused-arguments -Wno-c99-designator -Wno-unknown-warning-option -Wno-unused-const-variable -Wno-varargs -fno-exceptions -fno-threadsafe-statics -Wreorder -Wno-overloaded-virtual -fno-rtti -std=gnu++14 -MD -MT src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Gyroscope.cpp.o -MF src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Gyroscope.cpp.o.d -o src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Gyroscope.cpp.o -c /Users/kevin/PX4-Autopilot/src/lib/sensor_calibration/Gyroscope.cpp
In file included from /Users/kevin/PX4-Autopilot/src/lib/sensor_calibration/Gyroscope.cpp:36:
/Users/kevin/PX4-Autopilot/src/lib/sensor_calibration/Utilities.hpp:91:2: 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]
        sprintf(str, "CAL_%s%u_%s", sensor_type, instance, cal_type);
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.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.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
1 error generated.
[305/868] Building CXX object src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Magnetometer.cpp.o
FAILED: src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Magnetometer.cpp.o 
/usr/local/bin/ccache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=\"sensor_calibration\" -D__CUSTOM_FILE_IO__ -D__PX4_DARWIN -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I/Users/kevin/PX4-Autopilot/boards/px4/sitl/src -I/Users/kevin/PX4-Autopilot/platforms/posix/src/px4/common/include -I/Users/kevin/PX4-Autopilot/build/px4_sitl_default -I/Users/kevin/PX4-Autopilot/build/px4_sitl_default/src/lib -I/Users/kevin/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/Users/kevin/PX4-Autopilot/platforms/common -I/Users/kevin/PX4-Autopilot/platforms/common/include -I/Users/kevin/PX4-Autopilot/src -I/Users/kevin/PX4-Autopilot/src/include -I/Users/kevin/PX4-Autopilot/src/lib -I/Users/kevin/PX4-Autopilot/src/lib/matrix -I/Users/kevin/PX4-Autopilot/src/modules -I/Users/kevin/PX4-Autopilot/platforms/posix/include -I/Users/kevin/PX4-Autopilot/build/px4_sitl_default/external/Install/include -O2 -g -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fPIC -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -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-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fcolor-diagnostics -fdiagnostics-absolute-paths -Qunused-arguments -Wno-c99-designator -Wno-unknown-warning-option -Wno-unused-const-variable -Wno-varargs -fno-exceptions -fno-threadsafe-statics -Wreorder -Wno-overloaded-virtual -fno-rtti -std=gnu++14 -MD -MT src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Magnetometer.cpp.o -MF src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Magnetometer.cpp.o.d -o src/lib/sensor_calibration/CMakeFiles/sensor_calibration.dir/Magnetometer.cpp.o -c /Users/kevin/PX4-Autopilot/src/lib/sensor_calibration/Magnetometer.cpp
In file included from /Users/kevin/PX4-Autopilot/src/lib/sensor_calibration/Magnetometer.cpp:36:
/Users/kevin/PX4-Autopilot/src/lib/sensor_calibration/Utilities.hpp:91:2: 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]
        sprintf(str, "CAL_%s%u_%s", sensor_type, instance, cal_type);
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.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.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
1 error generated.
[306/868] Building CXX object src/lib/tecs/CMakeFiles/tecs.dir/TECS.cpp.o
ninja: build stopped: subcommand failed.
make: *** [px4_sitl] Error 1
message.txt
31 KB
Jaeyoung-Lim commented 1 year ago

@kevinuav Have you tried removing sprintf or replacing them with snprintf as suggested in the log?

ecmnet commented 1 year ago

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

walchko commented 1 year ago

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
mkarklins commented 1 year ago

@walchko did you ever solve this?

walchko commented 1 year ago

@walchko did you ever solve this?

No ... sorry

ryanjAA commented 6 months ago

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.