Skip to content

c and h source file are preprocessed while they should not #363

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
fpistm opened this issue May 10, 2021 · 2 comments
Closed

c and h source file are preprocessed while they should not #363

fpistm opened this issue May 10, 2021 · 2 comments
Labels
conclusion: duplicate Has already been submitted conclusion: off topic Off topic for this repository type: imperfection Perceived defect in any part of project

Comments

@fpistm
Copy link

fpistm commented May 10, 2021

Describe the bug
STM32 core allows user to define some value by adding a build_opt.h file at sketch level.
This file is not a standard header file as it is used by the gcc command line with @file option.

https://github.com/stm32duino/wiki/wiki/Customize-build-options-using-build_opt.h

To achieve this a simple recipe hooks prebuild is used. When no file exists at sketch level it creates an empty one.
It works fine with Arduino 1.8.x (until 1.8.13 seems 1.8.15 embed the same behaviour)
.h file extension has been used because Arduino 1.8.x does not allow to create file without a specific extension (ino, c, cpp, h, hpp).

But with Arduino IDE Beta 5, this file is preprocessed (seems like the ino file) and add extra line which cause issue to gcc.

For example a build_opt.h with:
-DHAL_CRC_MODULE_ENABLED

is converted to:

#line 1 "c:\\Users\\<username>\\AppData\\Local\\Temp\\.arduinoIDE-unsaved2021410-37444-aykylf.uyhtw\\sketch_may10a\\build_opt.h"
-DHAL_CRC_MODULE_ENABLED

Below the build result due to the #line addition:

arm-none-eabi-g++: error: #line: No such file or directory
arm-none-eabi-g++: error: 1: No such file or directory
Compilation error: Error: 2 UNKNOWN: exit status 1

To Reproduce
Steps to reproduce the behavior:

  1. Install IDE 2.0 Beta 5
  2. Install STM32 core version 2.0.0 (https://github.com/stm32duino/BoardManagerFiles/raw/master/package_stmicroelectronics_index.json)
  3. Add a build_opt.h file containing the line -DHAL_CRC_MODULE_ENABLED
  4. attempt to verify

Expected behavior
Do not preprocess file and able to build.

Desktop (please complete the following information):

  • OS: all
  • Version: [e.g. 2.0.0]: 2.0.0 Beta 5

Additional context
It seems that all created files are also preprocess: c, cpp,...

Issue originally reported by an user here:
stm32duino/Arduino_Core_STM32#1387

@fpistm
Copy link
Author

fpistm commented Jun 28, 2021

Probably linked to arduino-cli --> arduino/arduino-cli#1224
As issue has been reproduced with Arduino IDE 1.8.15.

@fpistm
Copy link
Author

fpistm commented Jun 28, 2021

I close this one as I guess it is not related to Arduino IDE 2.x.x --> arduino/arduino-cli#1338

@fpistm fpistm closed this as completed Jun 28, 2021
@per1234 per1234 added the conclusion: duplicate Has already been submitted label Jun 30, 2021
@rsora rsora added the type: imperfection Perceived defect in any part of project label Sep 22, 2021
@per1234 per1234 added the conclusion: off topic Off topic for this repository label Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: duplicate Has already been submitted conclusion: off topic Off topic for this repository type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants