Reason:permission denied

assalamuallaikum,hello everyone. ive problem using platform io, ive project using arduino uno and i already created the file.and type code for blinking led. but when i Build the program, it shows like this:

> Executing task in folder bismillah: C:\Users\ridho\.platformio\penv\Scripts\platformio.exe run <

Processing uno (platform: atmelavr; board: uno; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR 2.1.0 > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES:
 - framework-arduino-avr 5.0.0
 - toolchain-atmelavr 1.50400.190710 (5.4.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 5 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\uno\src\main.cpp.o
Archiving .pio\build\uno\libFrameworkArduinoVariant.a
Compiling .pio\build\uno\FrameworkArduino\CDC.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial0.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial1.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial2.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial3.cpp.o
Compiling .pio\build\uno\FrameworkArduino\IPAddress.cpp.o
Compiling .pio\build\uno\FrameworkArduino\PluggableUSB.cpp.o
Compiling .pio\build\uno\FrameworkArduino\Print.cpp.o
Compiling .pio\build\uno\FrameworkArduino\Stream.cpp.o
Compiling .pio\build\uno\FrameworkArduino\Tone.cpp.o
Compiling .pio\build\uno\FrameworkArduino\USBCore.cpp.o
Compiling .pio\build\uno\FrameworkArduino\WInterrupts.c.o
Compiling .pio\build\uno\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\uno\FrameworkArduino\WString.cpp.o
Compiling .pio\build\uno\FrameworkArduino\abi.cpp.o
Compiling .pio\build\uno\FrameworkArduino\hooks.c.o
Compiling .pio\build\uno\FrameworkArduino\main.cpp.o
Compiling .pio\build\uno\FrameworkArduino\new.cpp.o
Compiling .pio\build\uno\FrameworkArduino\wiring_analog.c.o
Compiling .pio\build\uno\FrameworkArduino\wiring_digital.c.o
Compiling .pio\build\uno\FrameworkArduino\wiring_pulse.S.o
Compiling .pio\build\uno\FrameworkArduino\wiring_pulse.c.o
Compiling .pio\build\uno\FrameworkArduino\wiring_shift.c.o
Archiving .pio\build\uno\libFrameworkArduino.a
**c:\users\ridho\.platformio\packages\toolchain-atmelavr\bin\../lib/gcc/avr/5.4.0/../../../../avr/bin/ar.exe: unable to rename '.pio\build\uno\libFrameworkArduino.a'; reason: Permission denied**
***** [.pio\build\uno\libFrameworkArduino.a] Error 1**
=========================================================== [FAILED] Took 4.10 seconds ===========================================================
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

__________________________

the main problem is unable to rename ‘.pio\build\uno\libFrameworkArduino.a’; reason: Permission denied**
***** [.pio\build\uno\libFrameworkArduino.a] Error 1**

anyone can help ,then .regard -r.azhar megantara

Permission denied sorts of errors during compilation are often related to your antivirus/antimalware software. Try temporarily disabling or pausing it, and see if the error goes away. If it does, you need to see how you whitelist PlatformIO/compiler tools so the antivirus software doesn’t get quite so overzealous in it’s blocking of proper functionality.

when i paused protection my antivirus/win defender, still same problem .there is no different.

> Executing task: C:\Users\ridho\.platformio\penv\Scripts\platformio.exe run <

Processing uno (platform: atmelavr; board: uno; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR 2.1.0 > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES:
 - framework-arduino-avr 5.0.0
 - toolchain-atmelavr 1.50400.190710 (5.4.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 6 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Linking .pio\build\uno\firmware.elf
C:\Users\ridho\AppData\Local\Temp\ccB9Hd45.ltrans0.ltrans.o: In function `main':
<artificial>:(.text.startup+0x0): undefined reference to `init'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\uno\firmware.elf] Error 1
==================================================== [FAILED] Took 3.62 seconds 
```====================================================
The terminal process terminated with exit code: 1

so i assume the main problem is:

undefined reference to init’ . or what?

this my source code:

#include <Arduino.h>

int out_blue,out_green,out_red,out_yellow;

void setup() {
  // put your setup code here, to run once:
out_blue=A0;
out_green=A1;
out_red=A2;
out_yellow=A3;
pinMode(out_blue, OUTPUT);
pinMode(out_green, OUTPUT);
pinMode(out_red, OUTPUT);
pinMode(out_yellow, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(out_blue,1);
}

No, that’s not the same error… before you had

**c:\users\ridho\.platformio\packages\toolchain-atmelavr\bin\../lib/gcc/avr/5.4.0/../../../../avr/bin/ar.exe: unable to rename '.pio\build\uno\libFrameworkArduino.a'; reason: Permission denied**
***** [.pio\build\uno\libFrameworkArduino.a] Error 1**

now you’re getting

C:\Users\ridho\AppData\Local\Temp\ccB9Hd45.ltrans0.ltrans.o: In function `main':
<artificial>:(.text.startup+0x0): undefined reference to `init'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\uno\firmware.elf] Error 1

This is probably related to the prior failed build, as the init function referenced in the error is part of the Arduino framework… and that prior build failed at libFrameworkArduino.a. Subsequent builds are probably trying to use the cached files from the failed build, leading to more failures.

Are you using VSCode? If so, open the PlatformIO extensions sidebar panel, run the Clean project task (which will remove all cached build files, giving the next build a clean start), and try building it again (again, ensuring your AV is paused).

image

If this still fails, we’re probably going to need to see the log of a Verbose Build. Please use triple backticks (```) before and after the log so that forum software doesn’t try to interpret the log as formatting and mangle it.

i have tried as your instruction above,and this is the result:

======================================================================
> Executing task: C:\Users\ridho\.platformio\penv\Scripts\platformio.exe run <

Processing uno (platform: atmelavr; board: uno; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR 2.1.0 > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES:
 - framework-arduino-avr 5.0.0
 - toolchain-atmelavr 1.50400.190710 (5.4.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 6 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\uno\src\main.cpp.o
Archiving .pio\build\uno\libFrameworkArduinoVariant.a
Compiling .pio\build\uno\FrameworkArduino\CDC.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial0.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial1.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial2.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial3.cpp.o
Compiling .pio\build\uno\FrameworkArduino\IPAddress.cpp.o
Compiling .pio\build\uno\FrameworkArduino\PluggableUSB.cpp.o
Compiling .pio\build\uno\FrameworkArduino\Print.cpp.o
Compiling .pio\build\uno\FrameworkArduino\Stream.cpp.o
Compiling .pio\build\uno\FrameworkArduino\Tone.cpp.o
Compiling .pio\build\uno\FrameworkArduino\USBCore.cpp.o
Compiling .pio\build\uno\FrameworkArduino\WInterrupts.c.o
Compiling .pio\build\uno\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\uno\FrameworkArduino\WString.cpp.o
Compiling .pio\build\uno\FrameworkArduino\abi.cpp.o
Compiling .pio\build\uno\FrameworkArduino\hooks.c.o
Compiling .pio\build\uno\FrameworkArduino\main.cpp.o
Compiling .pio\build\uno\FrameworkArduino\new.cpp.o
Compiling .pio\build\uno\FrameworkArduino\wiring_analog.c.o
Compiling .pio\build\uno\FrameworkArduino\wiring_digital.c.o
Compiling .pio\build\uno\FrameworkArduino\wiring_pulse.S.o
Compiling .pio\build\uno\FrameworkArduino\wiring_pulse.c.o
Compiling .pio\build\uno\FrameworkArduino\wiring_shift.c.o
Archiving .pio\build\uno\libFrameworkArduino.a
***Linking .pio\build\uno\firmware.elf***
***C:\Users\ridho\AppData\Local\Temp\cco177fm.ltrans0.ltrans.o: In function `main':***
***<artificial>:(.text.startup+0x0): undefined reference to `init'***
***collect2.exe: error: ld returned 1 exit status***
****** [.pio\build\uno\firmware.elf] Error 1***
***==================================================== [FAILED] Took 2.09 seconds ====================================================***
***The terminal process terminated with exit code: 1***

Terminal will be reused by tasks, press any key to close it.

i try by clicking verbose build

> Executing task: C:\Users\ridho\.platformio\penv\Scripts\platformio.exe run --verbose <

Processing uno (platform: atmelavr; board: uno; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR 2.1.0 > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES:
 - framework-arduino-avr 5.0.0
 - toolchain-atmelavr 1.50400.190710 (5.4.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 6 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
avr-g++ -o .pio\build\uno\firmware.elf -Os -mmcu=atmega328p -Wl,--gc-sections -flto -fuse-linker-plugin .pio\build\uno\src\main.cpp.o -L.pio\build\uno -Wl,--start-group .pio\build\uno\libFrameworkArduinoVariant.a .pio\build\uno\libFrameworkArduino.a -lm -Wl,--end-group
C:\Users\ridho\AppData\Local\Temp\ccFNuYA1.ltrans0.ltrans.o: In function `main':
<artificial>:(.text.startup+0x0): undefined reference to `init'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\uno\firmware.elf] Error 1
==================================================== [FAILED] Took 1.22 seconds ====================================================
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

this my antivirus on my pc:

image

i have not try to"Please use triple backticks (```) before and after the log" , idk to do that, so how?,

The verbose build really needed another clean before you ran that, for it to be of much use, but its looking more like what Max suggested in the other thread, which is that the framework files themselves are broken.

Try opening the following path in Windows Explorer %userprofile%\.platformio\packages, and deleting the framework-arduino-avr folder. Then try another clean and build, this time, the build should trigger the re-download and install of the framework files, and if there is something dodgy there, should complete this time.

You should only need to turn Kaspesky off, the Windows Firewall and SmartScreen should be fine to leave on.

i have not try to"Please use triple backticks (```) before and after the log" , idk to do that, so how?,

Literately type that character - it’s to the left of the 1 in the number key row - three times before and after where you’d going to paste the log - it’s a formatting code that tells the forum to not format anything between the two logs of ```. I’ve been editing the posts and adding it, so no need to do that :wink:

1 Like

ya,WORKED 100% ,THANKSS…i have also read max comment problem like this and same solution with u by disabling AV. but i see on frame that firmware.elf doeasnt exist. so the question is how to restore the firmware.elf earlier. and u provide solution on right time.this very very help to us broh thanks…" Try opening the following path in Windows Explorer %userprofile%\.platformio\packages , and deleting the framework-arduino-avr folder. Then try another clean and build, this time, the build should trigger the re-download and install of the framework files"

this worked for me, and as you know my firmware.elf back to their natural habit make me touched…huhuhu.“MUANTAB JIWA brohh” GOD BLESS OF YOU &((&

i also shared in my youtube channel…Platform IO: [.pio\build\uno\firmware.elf] Error 1 ||| : undefined reference to `init' - YouTube thanks…

1 Like

Glad you got it working. At 3:18 into the video, you probably should have just waited a little longer. You could see that VSCode + PlatformIO was still loading, and if you hadn’t clicked away from the terminal (onto the problems tab) it would have indicated it was installing the framework-arduino-avr package again.

This is also the reason for all the entries in the ‘Problems’ tab. At that point in time, because the framework-arduino-avr folder is missing, those files are missing. But those errors/entries will go away (unless there is some other issue) by the end of the build, because the folder is present again.

1 Like

hmm…ok thanks for your reaction brohh…hhhehe :grinning: :grinning: :grinning:

1 Like