Rate This Document
Findability
Accuracy
Completeness
Readability

Generating a BC File

A BC file is used for memory consistency check and vectorization check.

Command Function

Compiles the source file to generate a BC file.

Ensure that the source file used to generate the BC file can be compiled locally using the compilation command provided.

Syntax

1
devkit advisor bc-gen [-h | --help] {-c COMMAND | --command COMMAND} [-o OUTPUT_PATH | --output OUTPUT_PATH] [-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeout TIMEOUT] [-t THREADS | --thread THREADS]

Parameter Description

Table 1 Parameter description

Parameter

Option

Description

-h/--help

-

Obtains help information. This parameter is optional.

-c/--command

-

Source code build command. This parameter is mandatory. Builds source code. If there are multiple build commands, separate them with semicolons (;) and enclose them with single quotation marks (') or double quotation marks ("). If a command contains spaces, enclose it with single or double quotation marks.

Example: "mkdir build;cd build;cmake ..;make"

NOTE:

The source code build command in the command line tool does not support variable setting and environment variable export.

Example: "CFLAGS='-O0 -g';make" or "export CFLAGS='-O0 -g';make"

-o/--output

-

Path for storing the generated BC file. You must have the write permission on the path. This parameter is optional. By default, the report is saved in the current path and is named in the format of Module-name_Timestamp.

-l/--log-level

0/1/2/3

Log level, which defaults to 1. This parameter is optional.
  • 0: DEBUG
  • 1: INFO
  • 2: WARNING
  • 3: ERROR

--set-timeout

-

Timeout interval of a task, in minutes. If the execution duration exceeds the timeout interval, the task exits. This parameter is optional. By default, there is no timeout interval. The task will be executed until it is complete.

-t/--thread

-

Number of threads for compiling the BC file, which defaults to half of the total number of CPUs in the current environment. This parameter is optional.

Example

Create a BC file.

In this example, the source file in the /home/test directory is scanned, the build commands are cmake . and make, and the BC file is stored in the /home/test/bc_files directory. Replace the example parameter values with the actual ones.

1
2
cd /home/test && cmake .
devkit advisor bc-gen -c make -o /home/test/bc_files

The following information is displayed and a report is generated:

Executing bc gen task, please wait...
Current progress: ###### [20%]
Start to get the compile database
Current progress: ################ [50%]
Start to generate the BC files
Current progress: ################################# [100%]
Configuration:
    Generate BC files path: /home/test/bc_files
    Compile command: make
    Threads: The threads is not set, using the half number of cores.
    Task Timeout Interval: The timeout period is not set.
    Log level: info

Summary:
    Scanned all source files, there are 5 linked BC files and 5 object BC files generated.

For the detail information, please check:
Output path of linked BC files: /home/test/bc_files/bc-gen_20250408112730_d397/bin
Output path of object BC files: /home/test/bc_files/bc-gen_20250408112730_d397/object

There are 3 linked BC files fail to be generated. For the causes of the failure to generate all the BC files and their intermediates, please check:
Log path: /install_path/advisor/logs/affinity/affinity.log
  • If the BC file fails to be generated, view the error details in /current_path/bc_warning.json and /install_path/advisor/logs/affinity/affinity.log. For details about how to rectify errors, see Compatibility in the BiSheng Compiler User Guide.
  • current_path indicates the current path and install_path indicates the tool installation directory.