Skip to content
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

cc1plus.exe fatal error #4682

Closed
roberbike opened this issue Jul 1, 2023 · 15 comments
Closed

cc1plus.exe fatal error #4682

roberbike opened this issue Jul 1, 2023 · 15 comments

Comments

@roberbike
Copy link

Hello.
I have this error compiling one proyect in windows 10.:

piobug

My platformio.ini has this flag that complile ok under linux :
build_flags =
${common.build_flags}
-D USER_SETUP_LOADED=1
-include /$PROJECT_LIBDEPS_DIR/$PIOENV/TFT_eSPI/User_Setups/Setup25_TTGO_T_Display.h

If I changue this line:
-include /$PROJECT_LIBDEPS_DIR/$PIOENV/TFT_eSPI/User_Setups/Setup25_TTGO_T_Display.h

by this other:
-include $PROJECT_LIBDEPS_DIR/$PIOENV/TFT_eSPI/User_Setups/Setup25_TTGO_T_Display.h

The proyect compile under windows 10 + vscode +platformio.
But not compile under linux. It is neccesary to put " / " to compile it.

There is an issue with platformio that cause this fault?

I asked here for this bug: https://community.platformio.org/t/cc1plus-exe-fatal-error/34551

Thanks.
Robert.

@roberbike
Copy link
Author

roberbike commented Jul 3, 2023 via email

@roberbike
Copy link
Author

This works under linux and windows:

-include .pio/libdeps/${PIOENV}/TFT_eSPI/User_Setups/Setup25_TTGO_T_Display.h

@roberbike
Copy link
Author

roberbike commented Jul 3, 2023 via email

@ivankravets
Copy link
Member

Sorry, I deleted my previous comment. This is actually a bug and we will fix it ASAP.

@ivankravets
Copy link
Member

Thanks for the report. Please re-test with pio upgrade --dev.

@CapnBry
Copy link

CapnBry commented Jul 5, 2023

I've tested with PlatformIO Core, version 6.1.9a1 as 6.1.8 has broken our build system entirely and I still have an include error issue. Our build flags have a relative path in them as the PlatformIO docs say

Process file as if #include "file" appeared as the first line of the primary source file.

However, the build system prepends the builder path directory as an absolute path to the include file, when it is actually in our PROJECT_DIR/include, which is already in -Iinclude

build_flags =
	${env_common_stm32.build_flags}
	${radio_2400.build_flags}
	${common_env_data.build_flags_tx}
	-flto
	-include target/FM30_TX.h

Build output

arm-none-eabi-gcc -o .pio\build\FM30_TX_via_DFU\FrameworkArduinoVariant\PeripheralPins.c.o -c -std=gnu11 -O2 -Wno-builtin-macro-redefined -Wall -flto -include C:\Users\bmayland\.platformio\platforms\ststm32\builder\target\FM30_TX.h ...

Should I open a new issue for this or keep it here?

@ivankravets
Copy link
Member

Could you provide a simple project (zip archive attached here) to reproduce this issue?

@CapnBry
Copy link

CapnBry commented Jul 5, 2023

I apologize for my error, but I have misspoken in my previous message. The builder does properly support it if I supply an absolute path for the include file via a variable, but does not leave relative paths alone. It expands the relative path into the builder directory.

I do not have a simple project to supply. I can work around this in our project by supplying the full path the -include file but that's a real problem because we'd now have to go back and cut new version of all our supported older versions so the build works again.

The builder code here does not fire because the relative path does not exist (platformio/builder/tools/piobuild.py)

 if os.path.exists(p):
                result["CCFLAGS"][i] = (f[0], os.path.abspath(p))

@ivankravets
Copy link
Member

Please provide the 1 line from platformio.ini which works and another one that does not.

@CapnBry
Copy link

CapnBry commented Jul 5, 2023

working

build_flags =
	${env_common_stm32.build_flags}
	${radio_2400.build_flags}
	${common_env_data.build_flags_tx}
	-flto
	-include ${PROJECT_DIR}/include/target/FM30_TX.h
	-DUSBCON
	-DPIO_FRAMEWORK_ARDUINO_ENABLE_CDC
	-DHSE_VALUE=16000000U
	-DVECT_TAB_OFFSET=0x1000U
	-Wl,--defsym=FLASH_APP_OFFSET=0x1000

not working (what we had before

build_flags =
	${env_common_stm32.build_flags}
	${radio_2400.build_flags}
	${common_env_data.build_flags_tx}
	-flto
	-include target/FM30_TX.h
	-DUSBCON
	-DPIO_FRAMEWORK_ARDUINO_ENABLE_CDC
	-DHSE_VALUE=16000000U
	-DVECT_TAB_OFFSET=0x1000U
	-Wl,--defsym=FLASH_APP_OFFSET=0x1000

@ivankravets
Copy link
Member

You need

-include include/target/FM30_TX.h

The cwd is the project root dir.

@CapnBry
Copy link

CapnBry commented Jul 5, 2023

Oh I see! I appreciate that.

In 6.1.8 it worked though, and for years it has worked. Not to be too snarky because I appreciate your help, but

Process file as if #include "file" appeared as the first line of the primary source file.

This file is in the include path and therefore should have no issue being included, so long as an absolute path was not added to it. Is there any way this can not be processed and have a bogus path added to it?

@ivankravets
Copy link
Member

I think we can improve this behavior. I reopen this issue.

@ivankravets ivankravets reopened this Jul 5, 2023
@ivankravets ivankravets modified the milestones: 6.1.8, 6.1.9 Jul 5, 2023
@ivankravets
Copy link
Member

Or, could I ask you to create a new issue and refer to this one? It's better for history.

@CapnBry
Copy link

CapnBry commented Jul 5, 2023

Can do, will tag this issue in it too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants