# PX4 Build broken for SITL Targets

Source: https://forum.modalai.com/topic/3510/px4-build-broken-for-sitl-targets
Category: VOXL SDK and Software (https://forum.modalai.com/category/47/voxl-sdk-and-software)
Posted: 2024-05-30 19:00:48 UTC by ejohnson
Replies: 1 · Views: 1070

## ejohnson · 2024-05-30 19:00:48 UTC

I would like to conduct SITL testing on the same PX4 commit I am deploying to my voxl. I have noticed that the SITL targets for both JMAVSim and JSBSim are failing to build. 

I have been able to get my SITL platforms to build, but I have not been able to do it with out breaking the Voxl target. Here is a PR with change I made to get the SITL targets building. 
https://github.com/modalai/px4-firmware/pull/61

I think the main issue are pound defines like the following

```
#if PX4_SOC_ARCH_ID == PX4_SOC_ARCH_ID_VOXL2
#include "fc_sensor.h"
#endif
```

`PX4_SOC_ARCH_ID_VOXL2` is defined in the following enum
```
typedef enum PX4_SOC_ARCH_ID_t {

	PX4_SOC_ARCH_ID_UNUSED         =  0x0000,

	PX4_SOC_ARCH_ID_STM32F4        =  0x0001,
	PX4_SOC_ARCH_ID_STM32F7        =  0x0002,
	PX4_SOC_ARCH_ID_KINETISK66     =  0x0003,
	PX4_SOC_ARCH_ID_SAMV7          =  0x0004,
	PX4_SOC_ARCH_ID_NXPIMXRT1062   =  0x0005,

	PX4_SOC_ARCH_ID_STM32H7        =  0x0006,

	PX4_SOC_ARCH_ID_NXPS32K146     =  0x0007,
	PX4_SOC_ARCH_ID_NXPS32K344     =  0x0008,

	PX4_SOC_ARCH_ID_EAGLE          =  0x1001,
	PX4_SOC_ARCH_ID_QURT           =  0x1002,

	PX4_SOC_ARCH_ID_RPI            =  0x1004,
	PX4_SOC_ARCH_ID_SIM            =  0x1005,
	PX4_SOC_ARCH_ID_SITL           =  0x1006,

	PX4_SOC_ARCH_ID_BBBLUE         =  0x1008,

	PX4_SOC_ARCH_ID_VOXL2          =  0x100A,

} PX4_SOC_ARCH_ID_t;
```

The problem is that enums are not evaluated by the preprocessor. Therefore, when the preprocessor encounters the macro evaluation, PX4_SOC_ARCH_ID and PX4_SOC_ARCH_ID_VOXL2 are not recognized as they are part of an enum. As a result, #include "fc_sensor.h" is always included, regardless of the board type.

Would someone from the dev team be able to suggest a better way to create the macro? 

Thanks in advance!

## Reply by Eric Katzfey (ModalAI staff) · 2024-05-30 20:01:51 UTC

@ejohnson Yes, that is a bug. Don't have a suggestion off the top of my head.
