Scanning objective-c file raise error "arm_neon.h" not found

If the objective-c file import <simd/simd.h> or some other frameworks using simd framework,
it always raise error “arm_neon.h” not found.

15:53:22.906 DEBUG: [main] /Users/sunny/Desktop/sonarqube_test/sonarqube_test/TestDataModel.m:9 could not build module 'simd'

15:53:22.965 DEBUG: [main] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/simd/base.h:77 'arm_neon.h' file not found

15:53:22.967 WARN: Some issues were raised on files not present in the list of dependencies while analyzing /Users/sunny/Desktop/sonarqube_test/sonarqube_test/TestDataModel.m:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/simd/base.h

15:53:22.973 INFO: PCH: unique=0 use=0 (forceInclude=0,throughHeader=0,firstInclude=0) out of 1 (forceInclude=0,throughHeader=0)

sonar-cfamily-reproducer.zip (7.8 MB)

Hello @Sunny_Lee,

If I understand correctly, when you are doing a normal build of your project, the header is found, but not when you are analyzing it. This means that the header search path that is used to find this header is not the same during analysis.

A workaround for you might be to add to your build commands the folder that contains this header (as a -isystem argument), but it would be better to understand why we the search path is not automatically detected.

One of the things we do to determine this path is probing the compiler. In your case, we are probing it with the following command-line options:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
   -x objective-c --std gnu11 -target arm64-apple-ios12.0 
   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk
   -v -dM -E -

Do you know of any other command-line option that should be added for this header file to be found, or to enable simd?

I have add -isystem argument and it print the search directory which arm_neon.h was.
But the problem was not fixed.

clang -cc1 version 13.1.6 (clang-1316.0.21.2.5) default target x86_64-apple-darwin21.6.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.5.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.5.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.5.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.5.sdk/System/Library/Frameworks (framework directory)
End of search list.

The arm_neon.h is in ‘/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include’ , but I don’t know why this directory was not searched by scanner.

Hello @Sunny_Lee

I was able to reproduce the issue, and I have raised [CPP-3856] - Jira to address this bug. Thanks for your report.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.