Tbb disabled causes multiple errors in make px4_sitl jmavsim

I followed steps from here:

Where I got to these steps:

brew unlink tbb
brew install tbb@2020
brew link tbb@2020

tbb@2020 is recently disabled. I was not able to force install. They had a 2021 version, but I got the same errors as below. I eventually just went back to ‘brew install tbb’ since I don’t see any other options.

I continued on with the steps, and eventually got to the “Building the code” page where I was to run

make px4_sitl jmavsim

I received these errors:

 make px4_sitl jmavsim
-- PX4 version: v1.14.0-beta2-196-gebe152fc22 (1.14.0)
-- Found PythonInterp: /usr/local/Caskroom/miniconda/base/bin/python3 (found suitable version "3.9.7", minimum required is "3") 
-- PX4 config file: /Users/bousborn/px4/Firmware/boards/px4/sitl/default.px4board
-- PLATFORM posix
-- ROMFSROOT px4fmu_common
-- ROOTFSDIR .
-- TESTING y
-- ETHERNET y
-- PX4 config: px4_sitl_default
-- PX4 platform: posix
-- PX4 lockstep: enabled
-- The CXX compiler identification is AppleClang 14.0.3.14030022
-- The C compiler identification is AppleClang 14.0.3.14030022
-- 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
-- cmake build type: RelWithDebInfo
-- ccache enabled (export CCACHE_DISABLE=1 to disable)
-- Could NOT find gz-transport (missing: gz-transport_DIR)
-- 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") 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- 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.14.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.14.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.3.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.14.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.14.0
-- Looking for ignition-fuel_tools4 -- found version 4.9.0
-- Searching for dependencies of ignition-fuel_tools4
-- Found CURL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/lib/libcurl.tbd (found version "7.87.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.14.0
-- Looking for ignition-msgs5 -- found version 5.11.0
-- Found gazebo-classic 11.13.0, including sitl_gazebo-classic simulator and gazebo-classic targets
-- Found Java: /Library/Java/JavaVirtualMachines/temurin-20.jdk/Contents/Home/bin/java (found version "20.0.1") 
-- ROMFS: ROMFS/px4fmu_common
-- Configuring done (39.7s)
-- Generating done (1.6s)
-- Build files have been written to: /Users/bousborn/px4/Firmware/build/px4_sitl_default
[0/900] git submodule src/drivers/gps/devices
[6/900] git submodule src/modules/mavlink/mavlink
[7/900] Building C object boards/px4/sitl/src/CMakeFiles/drivers_board.dir/sitl_led.c.o
FAILED: boards/px4/sitl/src/CMakeFiles/drivers_board.dir/sitl_led.c.o 
/usr/local/bin/ccache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -D__CUSTOM_FILE_IO__ -D__PX4_DARWIN -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I/Users/bousborn/px4/Firmware/boards/px4/sitl/src -I/Users/bousborn/px4/Firmware/platforms/posix/src/px4/common/include -I/Users/bousborn/px4/Firmware/build/px4_sitl_default -I/Users/bousborn/px4/Firmware/build/px4_sitl_default/src/lib -I/Users/bousborn/px4/Firmware/platforms/posix/src/px4/generic/generic/include -I/Users/bousborn/px4/Firmware/platforms/common -I/Users/bousborn/px4/Firmware/platforms/common/include -I/Users/bousborn/px4/Firmware/src -I/Users/bousborn/px4/Firmware/src/include -I/Users/bousborn/px4/Firmware/src/lib -I/Users/bousborn/px4/Firmware/src/lib/matrix -I/Users/bousborn/px4/Firmware/src/modules -I/Users/bousborn/px4/Firmware/platforms/posix/include -I/Users/bousborn/px4/Firmware/build/px4_sitl_default/external/Install/include -O2 -g -DNDEBUG -std=gnu11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.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-common -Wnested-externs -Wstrict-prototypes -Wbad-function-cast -MD -MT boards/px4/sitl/src/CMakeFiles/drivers_board.dir/sitl_led.c.o -MF boards/px4/sitl/src/CMakeFiles/drivers_board.dir/sitl_led.c.o.d -o boards/px4/sitl/src/CMakeFiles/drivers_board.dir/sitl_led.c.o -c /Users/bousborn/px4/Firmware/boards/px4/sitl/src/sitl_led.c
/Users/bousborn/px4/Firmware/boards/px4/sitl/src/sitl_led.c:53:23: fatal error: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
__EXPORT void led_init()
                      ^
                       void
1 error generated.
[15/900] Generating uORB topic ucdr headers
ninja: build stopped: subcommand failed.
make: *** [px4_sitl] Error 1

I tried adding the following to the Makefile but with no changes:

CFLAGS += -Wno-error=strict-prototypes -Wno-error=deprecated-declarations -Wno-error=deprecated-non-prototype
CFLAGS += -Wno-error=missing-parameter-type -Wno-error=unused-but-set-variable

CXXFLAGS += -Wno-error=strict-prototypes -Wno-error=deprecated-declarations
CXXFLAGS += -Wno-error=unused-but-set-variable

I also tried gazebo instead of jmavsim:

make px4_sitl gazebo

but got a bunch of similar strict prototypes errors.

I am building this on a Mac (NOT M1), running Ventura 13.4.

Does anyone know how to suppress these warning/errors to build? I believe the issue is that I have newer gcc/g++ versions, but I’d rather not change the gcc versions on my machine and I currently can’t install docker on this machine due to some restrictions of the network I am on.

I do see CMake files in the build, but the directions said to use make. Is it recommended to use cmake instead? If so, how do I pass it the parameters “px4_sitl” and “jmavsim”?

Well, I ended up fixing it locally. I just followed the errors and added in the voids, and commented out one variable that was assigned but not used. It now seems like it works (at least for building and running the jmavsim stuff). It ended up only being a few items. I apparently can’t attach a file with txt extension, so here is the pasted patch:

diff --git a/boards/px4/sitl/src/sitl_led.c b/boards/px4/sitl/src/sitl_led.c
index c9d3f4d053..f86e877764 100644
--- a/boards/px4/sitl/src/sitl_led.c
+++ b/boards/px4/sitl/src/sitl_led.c
@@ -50,7 +50,7 @@ __END_DECLS
 
 static bool _led_state[2] = { false, false };
 
-__EXPORT void led_init()
+__EXPORT void led_init(void)
 {
 	PX4_DEBUG("LED_INIT");
 }
diff --git a/platforms/common/work_queue/hrt_thread.c b/platforms/common/work_queue/hrt_thread.c
index 8438b0ae2c..8da8b415d1 100644
--- a/platforms/common/work_queue/hrt_thread.c
+++ b/platforms/common/work_queue/hrt_thread.c
@@ -113,7 +113,7 @@ static void _sighandler(int sig_num)
  *
  ****************************************************************************/
 
-static void hrt_work_process()
+static void hrt_work_process(void)
 {
 	struct wqueue_s *wqueue = &g_hrt_work;
 	volatile struct work_s *work;
diff --git a/platforms/common/work_queue/work_thread.c b/platforms/common/work_queue/work_thread.c
index b1e0e72355..5109b6ad8a 100644
--- a/platforms/common/work_queue/work_thread.c
+++ b/platforms/common/work_queue/work_thread.c
@@ -338,7 +338,7 @@ int work_usrthread(int argc, char *argv[])
 
 #endif /* CONFIG_SCHED_USRWORK */
 
-uint32_t clock_systimer()
+uint32_t clock_systimer(void)
 {
 	//printf("clock_systimer: %0lx\n", hrt_absolute_time());
 	return (0x00000000ffffffff & hrt_absolute_time());
diff --git a/platforms/posix/include/hrt_work.h b/platforms/posix/include/hrt_work.h
index 6dd2ab5a09..7799d3815c 100644
--- a/platforms/posix/include/hrt_work.h
+++ b/platforms/posix/include/hrt_work.h
@@ -48,13 +48,13 @@ int hrt_work_queue(struct work_s *work, worker_t worker, void *arg, uint32_t usd
 void hrt_work_cancel(struct work_s *work);
 
 static inline void hrt_work_lock(void);
-static inline void hrt_work_lock()
+static inline void hrt_work_lock(void)
 {
 	px4_sem_wait(&_hrt_work_lock);
 }
 
 static inline void hrt_work_unlock(void);
-static inline void hrt_work_unlock()
+static inline void hrt_work_unlock(void)
 {
 	px4_sem_post(&_hrt_work_lock);
 }
diff --git a/src/lib/rc/rc_tests/RCTest.cpp b/src/lib/rc/rc_tests/RCTest.cpp
index 07c45d33c0..3fa2cd41aa 100644
--- a/src/lib/rc/rc_tests/RCTest.cpp
+++ b/src/lib/rc/rc_tests/RCTest.cpp
@@ -359,7 +359,7 @@ bool RCTest::sbus2Test()
 	bool sbus_frame_drop;
 	uint16_t max_channels = sizeof(rc_values) / sizeof(rc_values[0]);
 
-	int rate_limiter = 0;
+//	int rate_limiter = 0;
 	unsigned last_drop = 0;
 
 	while (EOF != (ret = fscanf(fp, "%f,%x,,", &f, &x))) {
@@ -390,7 +390,7 @@ bool RCTest::sbus2Test()
 			last_drop = sbus_frame_drops + sbus_frame_resets;
 		}
 
-		rate_limiter++;
+//		rate_limiter++;
 	}
 
 	ut_test(ret == EOF);

Copy and paste that to a file called diff.patch. Then run:

git apply patchfile.patch

It should build then. I now think this is not really related to the tbb as I initially thought, I think this code is just old and was originally compiled with gcc version 8 or 9. Now, the newer versions are stricter on forcing warnings to errors.

But, I still want to know what I am doing wrong that I can’t just follow the directions and build it. So, if anyone sees any issue with the directions as they are listed on the site for MacOS, please let me know!!

Worked like a charm! Thank you.