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

Relative Path Issue: PlatformIO 6.1.16 Incorrect Path Resolution When Linking Library Files #5004

Open
AliveGh0st opened this issue Oct 23, 2024 · 2 comments

Comments

@AliveGh0st
Copy link

Description

While using PlatformIO 6.1.16 for project development, I encountered an issue with relative path resolution. Specifically, when using the -Wl,-static flag and relative paths to link library files, the path ./ incorrectly points to C:\Users\admin\.platformio\platforms\ststm32\builder instead of the project root directory, resulting in an error during the linking process.

Steps to Reproduce

  1. Configure platformio.ini with the following build_flags:
    build_flags = 
        -Wl,-static
        ./ExternalLibs/Library1/lib1.a
        ./ExternalLibs/Library2/lib2.a
        ./ExternalLibs/Library3/lib3.a
        ./App/Main/libmain.a
    

2.Run the pio run command in the project root directory.
3.During the linking of firmware.elf, observe the path resolution error and subsequent linking failure.
Expected Behavior
The relative path ./ should point to the project root directory, allowing the library files to be correctly linked. Although using absolute paths can solve the issue, it is not conducive to project portability.

Actual Behavior

The relative path ./ points to C:\Users\admin\.platformio\platforms\ststm32\builder , causing the library file paths to be incorrectly resolved and the linking process to fail.

Error Log

The following error log is produced during the linking process:

 *** [.pio\build\genericSTM32F103ZE\firmware.elf] Implicit dependency `C:\Users\admin\.platformio\platforms\ststm32\builder\ExternalLibs\Library1\lib1.a' not found, needed by target `.pio\build\genericSTM32F103ZE\firmware.elf'.

System Information

  • PlatformIO Version: 6.1.16
  • Operating System: Windows 10
  • PLATFORM: ST STM32 (17.6.0) > STM32F103ZE (64k RAM. 512k Flash)
  • HARDWARE: STM32F103ZET6 72MHz, 64KB RAM, 512KB Flash
  • DEBUG: Current (stlink) External (blackmagic, cmsis-dap, jlink, stlink)
  • PACKAGES: toolchain-gccarmnoneeabi @ 1.120301.0 (12.3.1)

Additional Information

Using absolute paths resolves the issue, but it would be preferable to use relative paths, with the relative paths correctly pointing to the project root directory.

Thank you for your support and assistance!

@ivankravets
Copy link
Member

ivankravets commented Oct 23, 2024

Could you try a temporary solution?

build_flags = 
  $PROJECT_DIR/ExternalLibs/Library1/lib1.a

@AliveGh0st
Copy link
Author

not work.

*** [.pio\build\genericSTM32F103ZE\firmware.elf] Implicit dependency `C:\Users\admin\.platformio\platforms\ststm32\builder\$PROJECT_DIR\ExternalLibs\Library1\lib1.a' not found, needed by target `.pio\build\genericSTM32F103ZE\firmware.elf'.

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

2 participants