I am referring to the document https://docs.sonarqube.org/latest/analysis/languages/cfamily/ , part of Analysis Steps Using Build Wrapper. I follow the steps to download the build wrapper for macos, unzip the downloaded build wrapper and configure it in my PATH. But it fails when I try to run the command
Hi @chuenwailiew,
Can you, please, be more precise on how it fails when you run your build under Build Wrapper?
Additionally, some details about your system might help: your SonarQube version, your macOS version, and the CPU architecture (x86_64, x86_32, M1, …)
It looks like build-wrapper-macosx-x86 is still not visible from your PATH.
Did you put build-wrapper-macosx-x86 into the root (/) directory? In order to make an executable available you should put the directory containing this executable into your PATH variable, so in this case it would be the root “/” directory:
export PATH=$PATH:/
However, I do not recommend that. instead, you can save the Bulid Wrapper executable into a dedicated directory and add that directory to the PATH variable:
You can check out this manual about adding an executable into your PATH.
Another point is to make sure build-wrapper-macosx-x86 has the executable permission.
On your Finder screenshot you are showing your home directory (/Users/000751/). As you say yourself, on your OS the root directory (/) is not writeable, so I imagine it is rather difficult to add a build-wrapper-macos-x86 directory there. To verify that you indeed have extracted Build Wrapper into the root “/” and not your home directory “~”, you can execute ls / to display the contents of the root directory and ls /build-wrapper-macos-x86 to show the contents of the Build Wrapper directory in the root directory.
Do you confirm that you’ve indeed extracted Build Wrapper into the root “/” and not the home “/Users/000751” directory?
I don’t think I can access to root directory because of the company security’s issue. However when I try to study on the other option Analysis using compilation database , I don’t really understand how this should be done. Is there any more details and clearer example on this?
Instead of extracting Sonar Scanner and Build Wrapper into your root directory, you can extract them to your home directory as you did, and add the corresponding paths to your PATH:
If you want to use a compilation database, you will need to find out how to generate it with your build system. Unfortunately, I help you unless you know how to generate a compilation database. Here is an example of using a compilation database with CMake.
Hi @chuenwailiew,
Please provide some context: how are you running the Sonar Scanner and the Build Wrapper? Do you execute any command (e.g. cleaning the intermediate build files) or perform any action in your IDE between the runs of Build Wrapper and Sonar Scanner?
Additionally, these logs might be helpful: full execution log produced once you add the -X option, the “build-wrapper.log” and the “build-wrapper-dump.json”.
So Pod basically is a platform for iOS as some kind of container to use third-party library. “pod install command” does help us to download the library we need to use in our project, if it is not execute, it will cause build fail. That’s all what it does.
The issue is that analysis has to be done in the same exact environment where the build was done, with all the intermediate build files still being present in the same places. If you run build in one container/VM and analysis in another container/VM or on the host, analysis will fail. Do you run build and analysis in the same container/VM/host?
full execution log produced once you add the -X option
?
And for build-wrapper.log and build-wrapper-dump.json, I’ll let you use a cloud file-sharing service (think Dropbox, Googld Drive, SENDfiles, or others).