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

No such file or directory when compiling with PlatformIO and VsCode #76

Closed
1 task done
Tracked by #61
berickson opened this issue Jan 25, 2024 · 9 comments · Fixed by #77
Closed
1 task done
Tracked by #61

No such file or directory when compiling with PlatformIO and VsCode #76

berickson opened this issue Jan 25, 2024 · 9 comments · Fixed by #77
Assignees
Labels
🚨 Blocks Release 🚨 No release is to be made, until this is resolved. 🐞 Bug 🐞 OH DEAR!!! You seem to have spotted a bug! Compiler 💻 This happens during compiling/building/verifying 👍 Good first-time contribution Welcome to the club. This is how we roll, around here. ...in progress 🚧 Development on this is in progress PlatformIO 👽 This is specific to PlatformIO. ↩️ Regression ↩️ A recursive bug that has survived one or more previous releases.

Comments

@berickson
Copy link
Contributor

Is there an existing issue for this bug?

  • I have searched the issues and there is no existing issue for this bug.

What development environment are you using?

PlatformIO

What board are you using?

Teensy 4.0

What part of CRSF for Arduino is this bug related to?

Build/Compile/Upload

Current behaviour

Compiling fails with "No such file or directory". This looks very similar to #19, but now the issue is with PlatformIO / VsCode and not the Arduino IDE.

   35 | #include "SerialReceiver/CRC/CRC.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio/build/blue/lib87d/CRSFforArduino/CRSFforArduino/src/CRSFforArduino.cpp.o] Error 1
.pio/libdeps/blue/CRSFforArduino/src/CRSFforArduino/src/Hardware/CompatibilityTable/CompatibilityTable.cpp:30:10: fatal error: ./CFA_Config.hpp: No such file or directory
   30 | #include "./CFA_Config.hpp"
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio/build/blue/lib87d/CRSFforArduino/CRSFforArduino/src/Hardware/CompatibilityTable/CompatibilityTable.cpp.o] Error 1

Expected behaviour

No compiler errors.

Steps to reproduce

Using VsCode with a PlatformIO project, Add https://github.com/ZZ-Cat/CRSFforArduino to lib_deps in platformio.ini. Compile.

Additional information

I was able to "fix" the behavior for myself by creating a fork of the project at https://github.com/berickson/CRSFforArduinoFork where I #undef PLATFORMIO in several CPP files forcing it to use the same include paths that are used for Arduino. If I reference that repo from my platformio.ini libdeps, things compile fine.

@berickson berickson added Pending 📌 This is waiting for me to check it out 🐞 Bug 🐞 OH DEAR!!! You seem to have spotted a bug! labels Jan 25, 2024
@ZZ-Cat
Copy link
Owner

ZZ-Cat commented Jan 25, 2024

Yeha. I noticed that in my CI, which compile tests all the boards in the Compatibility Table on PlatformIO, and it failed nearly all of the Teensy boards for the same reason you're describing here.

What's interesting is... they all used to compile with impunity, until fairly recently. So, it looks more like something outside the scope of CRSF for Arduino changed and it has affected the compilation process for Teensy targets.

@berickson
Copy link
Contributor Author

Yeah, seems like path handling has changed in PlatformIO.

@ZZ-Cat
Copy link
Owner

ZZ-Cat commented Jan 26, 2024

Well, I'll add this to #61 and go from there.

@ZZ-Cat ZZ-Cat self-assigned this Jan 26, 2024
@ZZ-Cat ZZ-Cat moved this to Todo in Development Schedule Jan 26, 2024
@ZZ-Cat ZZ-Cat added this to the Version 1.0.0 milestone Jan 26, 2024
@ZZ-Cat
Copy link
Owner

ZZ-Cat commented Jan 26, 2024

Yeah, seems like path handling has changed in PlatformIO.

Okay, I looked into this on my end, and compile-tested the Main-Trunk:

  • Version: 1.0.0
  • Date: 2024-1-20
  • Commit: c9563f1

Screenshot 2024-01-27 093550

What's weird about this is, compiling the entire unified Teensy targets on my end succeeded.
The only thing I can think of is if you have a look at a253ab6, you will see that PlatformIO made changes to its path handling, and I originally had $PROJECT_DIR in CRSF for Arduino's platformio.ini configuration file.
It looked a little something like this:

include_dir = $PROJECT_DIR/src/platformio/include
lib_dir = $PROJECT_DIR/src
src_dir = $PROJECT_DIR/examples/platformio
test_dir = $PROJECT_DIR/src/platformio/test

After a recent update to PlatformIO, that $PROJECT_DIR created a separate $PROJECT_DIR folder in CRSF for Arduino's directory and that was what was causing the compilation process to fail.
Since a253ab6, I updated the platformio.ini file to look a little more like this:

include_dir = src/platformio/include
lib_dir = src
src_dir = examples/platformio
test_dir = src/platformio/test

So, chances are, that on your end, there may be a $PROJECT_DIR folder that may need to be deleted. This could be the cause of what's going on here.

@ZZ-Cat
Copy link
Owner

ZZ-Cat commented Jan 26, 2024

Alright! I found it. =^/.^=

Screenshot 2024-01-27 102357

Now I know what I am dealing with here. Yea, this is how I point the Arduino IDE to the rest of CRSF for Arduino's files, because the Arduino IDE doesn't like nested library files and folders. So, PlatformIO kinda has to come along for the ride.
It looks to me like I will need to point PlatformIO to the rest of CRSF for Arduino's files in a different way to Arduino IDE... which is a fairly easy fix.

@berickson
Copy link
Contributor Author

I just checked and I didn't see any extra $PROJECT_DIR folder on my end, also I'm not specifying any folders in my platformio.ini, for what it's worth, here's what my platformio.ini looks like, nothing too special:

[platformio]

[env:blue]
platform = teensy
board = teensy40
framework = arduino
board_microros_transport = serial
lib_deps = 
	I2Cdevlib-Core
	I2Cdevlib-MPU9150
	https://github.com/micro-ROS/micro_ros_platformio
	https://github.com/berickson/Servo100Hz
	https://github.com/Seeed-Studio/Grove_3Axis_Digital_Compass_HMC5883L
	https://github.com/berickson/CRSFforArduinoFork
	#https://github.com/ZZ-Cat/CRSFforArduino
build_flags = -DUSB_SERIAL -DBLUE_CAR
upload_protocol = teensy-cli
board_microros_user_meta = microros.meta
monitor_speed = 921600

@ZZ-Cat
Copy link
Owner

ZZ-Cat commented Jan 27, 2024

I just checked and I didn't see any extra $PROJECT_DIR folder on my end, also I'm not specifying any folders in my platformio.ini, for what it's worth, here's what my platformio.ini looks like, nothing too special:

[platformio]

[env:blue]
platform = teensy
board = teensy40
framework = arduino
board_microros_transport = serial
lib_deps = 
	I2Cdevlib-Core
	I2Cdevlib-MPU9150
	https://github.com/micro-ROS/micro_ros_platformio
	https://github.com/berickson/Servo100Hz
	https://github.com/Seeed-Studio/Grove_3Axis_Digital_Compass_HMC5883L
	https://github.com/berickson/CRSFforArduinoFork
	#https://github.com/ZZ-Cat/CRSFforArduino
build_flags = -DUSB_SERIAL -DBLUE_CAR
upload_protocol = teensy-cli
board_microros_user_meta = microros.meta
monitor_speed = 921600

I see. I dug a little more into the issue you're having here, and it seems to me like it's a lot more problematic than what I initially thought.
So, fixing this is now my top priority.

By the way things are going, I may finish up doing another re-structure of the entire repository. 'Cause on my end, no matter how I tried to dick around with the includes, compilation still failed.
A possible solution I can think of off the top of my head is to standardise the folder-and-file structure with Arduino's library specifications.
Currently, CRSF for Arduino is set up as a PlatformIO project, not a library. This is likely why we're getting compilation errors when CRSF for Arduino is used as a dependency... because I didn't initially test this part yet, and Version 1.0.0 is not officially released yet.

This bug isn't hardware-specific, by the way.
I compile-tested this with my Adafruit Metro M4 Express and I got the same compilation errors as what you're getting.

@ZZ-Cat ZZ-Cat added 🚨 Blocks Release 🚨 No release is to be made, until this is resolved. ↩️ Regression ↩️ A recursive bug that has survived one or more previous releases. Compiler 💻 This happens during compiling/building/verifying PlatformIO 👽 This is specific to PlatformIO. 👍 Good first-time contribution Welcome to the club. This is how we roll, around here. ...in progress 🚧 Development on this is in progress and removed Pending 📌 This is waiting for me to check it out labels Jan 27, 2024
@ZZ-Cat ZZ-Cat linked a pull request Feb 2, 2024 that will close this issue
@ZZ-Cat ZZ-Cat closed this as completed in #77 Feb 5, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Development Schedule Feb 5, 2024
@berickson
Copy link
Contributor Author

I was on vacation so I was just now able to test this out. I tried it out this morning by updating my platformio.ini library dependency with

https://github.com/ZZ-Cat/CRSFforArduino.git @^1.0.0

and everything compiles and seems to work fine. Thanks!

@ZZ-Cat
Copy link
Owner

ZZ-Cat commented Feb 14, 2024

Excellent. You're welcome. =^/.^=

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 Blocks Release 🚨 No release is to be made, until this is resolved. 🐞 Bug 🐞 OH DEAR!!! You seem to have spotted a bug! Compiler 💻 This happens during compiling/building/verifying 👍 Good first-time contribution Welcome to the club. This is how we roll, around here. ...in progress 🚧 Development on this is in progress PlatformIO 👽 This is specific to PlatformIO. ↩️ Regression ↩️ A recursive bug that has survived one or more previous releases.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants