Skip to content

Unable to generate only the compilation database #1547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jacquesg opened this issue Nov 13, 2021 · 1 comment · Fixed by #1549
Closed

Unable to generate only the compilation database #1547

jacquesg opened this issue Nov 13, 2021 · 1 comment · Fixed by #1549
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@jacquesg
Copy link

Bug Report

Current behavior

/home/linuxbrew/.linuxbrew/bin/arduino-cli --config-file /home/jacquesg/.arduino15/arduino-cli.yaml compile --fqbn esp32:esp32:featheresp32 --only-compilation-database --clean --build-path $PWD/build --format json /home/jacquesg/dev/AdvancedWebServer
{                                                                                                                                                                                                         
  "compiler_out": "",                                                                                                                                                                                     
  "compiler_err": "xtensa-esp32-elf-g++: error: /home/jacquesg/dev/AdvancedWebServer/build/build_opt.h: No such file or directory\n",                                                                     
  "builder_result": {                                                                                                                                                                                     
    "build_path": "/home/jacquesg/dev/AdvancedWebServer/build"                                                                                                                                            
  },                                                                                                                                                                                                      
  "success": false                                                                                                                                                                                        
} 
/home/linuxbrew/.linuxbrew/bin/arduino-cli --config-file /home/jacquesg/.arduino15/arduino-cli.yaml compile --fqbn esp32:esp32:featheresp32 --clean --build-path $PWD/build --format json /home/jacquesg/dev/AdvancedWebServer                                                                                                                                                     
{                                                                                                                                                                                                         
  "compiler_out": "Sketch uses 701109 bytes (53%) of program storage space. Maximum is 1310720 bytes.\nGlobal variables use 39840 bytes (12%) of dynamic memory, leaving 287840 bytes for local variables.
 Maximum is 327680 bytes.\n",                                                                                                                                                                             
  "compiler_err": "",
... SNIP ...
  },
  "success": true
}

From the above, by only requesting the compilation database the compilation fails.

Expected behavior

No error should be generated.

Environment

  • CLI version (output of arduino-cli version): arduino-cli alpha Version: 0.19.3 Commit: 12f1afc Date: 2021-10-11T15:14:04Z
  • OS and platform: Linux with an ESP32 board
@per1234
Copy link
Contributor

per1234 commented Nov 14, 2021

I'll add some additional information:
The command that was shared is far more than is needed for a minimal demonstration. The only two requirements are:

arduino-cli compile --fqbn esp32:esp32:featheresp32 --only-compilation-database

This is specific to the configuration of the ESP32 platform (i.e., it won't occur when compiling for another platform such as arduino:avr). It is the result of this feature:
espressif/arduino-esp32#5237

Note the comment there:

The script has been taken from stm32duino's Arduino_Core_STM32 package

The same type of issue occurs when compiling for boards of the STMicroelectronics:stm32 boards platform (except the missing file is named build.opt):

$ arduino-cli compile --fqbn STMicroelectronics:stm32:GenF0 --only-compilation-database Foo
arm-none-eabi-g++: error: C:\Users\per\AppData\Local\Temp\arduino-sketch-E8AF847218556EB3A395D00D1B675AD8/sketch/build.opt: No such file or directory

Error during build: exit status 1

The problem seems to be that the recipe.hooks.prebuild.NUMBER.pattern hook doesn't run when using the --only-compilation-database flag, so the required build_opt.h/build.opt file is missing from the build folder.

@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Nov 14, 2021
cmaglie added a commit to cmaglie/arduino-cli that referenced this issue Nov 16, 2021
cmaglie added a commit that referenced this issue Nov 17, 2021
…1549)

* Clean up some useless constants
* made legacy/builder.go independent from legacy/constants
* Now 'compile --only-compilation-database' will run all pre-* hooks

Some platforms make sketch preparation see #1547

Fix #1547

Co-authored-by: per1234 <[email protected]>
@per1234 per1234 added the conclusion: resolved Issue was resolved label Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants