You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
platformio fails to upload to an arduino, due to a missing library. /home/$HOME/.platformio/packages/tool-avrdude/avrdude: error while loading shared libraries: libreadline.so.6: cannot open shared object file: No such file or directory
I don't have an Arduino, could you please check the following?
Save this as platformio.nix:
{ stdenv, buildFHSUserEnv }:
buildFHSUserEnv {
name = "platformio";
targetPkgs = pkgs: with pkgs; [
pythonPackages.python
pythonPackages.setuptools
pythonPackages.pip
pythonPackages.bottle
pythonPackages.platformio
readline62
zlib
];
meta = with stdenv.lib; {
description = "An open source ecosystem for IoT development";
homepage = http://platformio.org;
maintainers = with maintainers; [ mog ];
license = licenses.asl20;
platforms = with platforms; linux;
};
runScript = "platformio";
}
And build it with nix-build -E "with import <nixpkgs> {}; callPackage ./platformio.nix {}". Check if it uploads now with result/bin/platformio run -t upload.
This does not work. An interesting side node: platformio itself downloads the avrdude binary to $HOME/.platformio/packages/tool-avrdude/avrdude_bin. The file $HOME/.platformio/packages/tool-avrdude/avrdude is only a wrapper script to redirect input and ouput:
#!/bin/bash
export LD_LIBRARY_PATH="`dirname "$0"`"
exec -a "$0" "`dirname "$0"`/avrdude_bin" "$@"
So an easy workaround is to install avrdude itself and replace
exec -a "$0" "`dirname "$0"`/avrdude_bin" "$@"
with exec -a "$0" "`which avrdude`" "$@"
Can this be fixed in nix? Or is it somewhat unrealistic to provide the needed library for this prebuilt binary of avrdude?
By 'This does not work.' is meant, that the same error as described in the original bug report still occurs. The nix-expression itself builds fine, but without touching the problem.
Meaning that short-term you can probably just wipe out ~/.platformio and reinstall.
Can this be fixed in nix? Or is it somewhat unrealistic to provide the needed library for this prebuilt binary of avrdude?
The problem here is that LD_LIBRARY_PATH is overridden. This will be fixed after #31263 lands in and we switch to NIX_LD_LIBRARY_PATH for FHS chroot environments.
I don't have an avr handy to confirm avrdude works with the current platformio 3.5.0 package in master, but I can confirm that it ran to the point it hangs on the port
[mog@worklaptop:~/platest]$ pio run -t upload --upload-port /dev/ttyUSB0
[Wed Jan 10 09:33:43 2018] Processing diecimilaatmega168 (platform: atmelavr; board: diecimilaatmega168; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Collected 24 compatible libraries
Looking for dependencies...
No dependencies
Looking for upload port...
Use manually specified: /dev/ttyUSB0
Uploading .pioenvs/diecimilaatmega168/firmware.hex
Can someone with privileges move cherrypick the commit into 17.09 ?
Activity
lukateras commentedon Nov 2, 2017
Probably could be fixed by adding
readline62to https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/arduino/platformio/chrootenv.nixtargetPkgs. Not sure if it needsmultiPkgsat all.I don't have an Arduino, could you please check the following?
Save this as
platformio.nix:And build it with
nix-build -E "with import <nixpkgs> {}; callPackage ./platformio.nix {}". Check if it uploads now withresult/bin/platformio run -t upload.wucke13 commentedon Nov 3, 2017
This does not work. An interesting side node:
platformioitself downloads the avrdude binary to$HOME/.platformio/packages/tool-avrdude/avrdude_bin. The file$HOME/.platformio/packages/tool-avrdude/avrdudeis only a wrapper script to redirect input and ouput:So an easy workaround is to install
avrdudeitself and replacewith
exec -a "$0" "`which avrdude`" "$@"Can this be fixed in nix? Or is it somewhat unrealistic to provide the needed library for this prebuilt binary of avrdude?
lukateras commentedon Nov 3, 2017
Could you please show stderr?
wucke13 commentedon Nov 5, 2017
By 'This does not work.' is meant, that the same error as described in the original bug report still occurs. The nix-expression itself builds fine, but without touching the problem.
lukateras commentedon Nov 5, 2017
I've just got
~/.platformio/packages/tool-avrdudeand for me it doesn't depend onlibreadline.so.6:Meaning that short-term you can probably just wipe out
~/.platformioand reinstall.The problem here is that
LD_LIBRARY_PATHis overridden. This will be fixed after #31263 lands in and we switch toNIX_LD_LIBRARY_PATHfor FHS chroot environments.wucke13 commentedon Nov 8, 2017
Ok. I will close for now, and reopen if the problem persists in a while. Thanks!
lukateras commentedon Nov 8, 2017
@wucke13 Better to leave open if that's still an issue.
wucke13 commentedon Nov 8, 2017
Ok then. I still have the error. Did the following:
rm -rf ~/.platformiosudo nixos-rebuild switch --upgradeplatformio run -t uploadinside of an platformio project folder. The following is the result:So, the very same command does work on the avrdude binary provided by the nixpkgs, but not on the binary downloaded by platformio.
mogorman commentedon Jan 10, 2018
I don't have an avr handy to confirm avrdude works with the current platformio 3.5.0 package in master, but I can confirm that it ran to the point it hangs on the port
Can someone with privileges move cherrypick the commit into 17.09 ?
lukateras commentedon Jan 11, 2018
@mogorman: Sure. Which commit?
mogorman commentedon Jan 11, 2018
@yegortimoshenko #33367
wucke13 commentedon Jan 14, 2018
I checked #33367, and I can confirm that it did work to upload with that build. So, with that commit, this is solved.