-
Notifications
You must be signed in to change notification settings - Fork 638
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
compile errors in platformio + visual studio code #2006
Comments
Did you find a solution for your problem? I have exactly the same problem after a fresh installation. |
Does it work just via CLI, platformio / pio commands, without VSCode running? Like pio call in the log above, `C:\Users\internet.platformio\penv\Scripts\platformio.exe run --environment blitzwolf-bwshpx`, or `pio -e blitzwolf-bwshpx`
My guess that has something to do with either VSCode itself doing something with git or some Antivirus solution locking the temporary files that pio creates. But in any case, I’d start with https://github.com/platformio/platformio-core/issues
|
Hi @mcspr! Many thanks for your help. As you suggested, I tried now to build directly with pio CLI. The results were the same. But your hint with the virus scanner was perfect! I deactivated the "real time protection" and it worked! Once all the missing libraries are installed, the virus scanner can be activated again and the build works anyway. Again many thanks for your help!!! 👍 |
I have similar issues when changing between build versions. Disabling anti virus didn't always help. Running |
Go on here with the Platformio lib_deps instaling error #2062. I've tried to modify |
Yes, the script will run I cannot reproduce the issue thought. |
You're right, I have space in subprocess_libdeps(), I correct it but the same result. I don't see any of the prints of the C:\espurna-master 1.14.0\code\scripts\pio_pre.py in the terminal. Is this correct? Where are this prints printed? I copy the libraries to %userprofile%.plattormio\lib, with this there is no need of download libraries for each env_default. The pio creates the directory C:\espurna-master 1.14.0\code.pio\libdeps\itead-sonoff-t1-2ch, for example, but no liabraies are put there, only use the shared global ones. No mather of subprocess_libdeps(env.GetProjectOption("lib_deps"), storage) is None or other. |
@oscarsan1 The function that you moved depends on env variables BTW I have tried again with a different Windows env, and I see the issue when Python 3.7 is installed. Everything was ok when I tried earlier with 2.7. Can you try again with the latest 3.8? https://www.python.org/downloads/release/python-380/ Make sure that VSCode isn't running. And after installing 3.8, just check that running |
I've done this but there is no change. Same error. `Looking for PubSubClient library in registry You are in 'detached HEAD' state. You can look around, make experimental If you want to create a new branch to retain commits you create, you may git switch -c Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false RFM69 @ cb68f71 has been successfully installed! You are in 'detached HEAD' state. You can look around, make experimental If you want to create a new branch to retain commits you create, you may git switch -c Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false It seems thar there are the same errors but this time don't stop the build and going on with the next library. |
@knopserl @Matthias-GER @davebuk could you please check whether the Python version is 3.7.x and does changing the Python version help with the issue? @oscarsan1 Maybe that is the wrong penv? I do see two, in Those warnings are harmless, git just really wants us to know about the switch syntax. It can be disabled via |
@mcspr
Similarly to @oscarsan1 , I copied all the lib folders out of one of my previously built binaries I pulled the latest dev version in and built a new version of my |
I then tried
This is the issue I have faced before. VSCode will try and go through updating the libraries for each of my previously built devices and sometime fail. For this test I then deleted the files in Should VSCode be trying to keep a copy of the libraries for each previously built environment? If not, when do the contents of |
VSCode calls Line 2 in e5b72a0
After that, pio run -e <env> for each build task.
Global libs are never updated unless we modify our scripts to do so. Default behaviour is to check every library path for something that matches lib_deps entry, and if there is nothing found it will install one in the @davebuk and you might want to update to either Python 2.7.17 or 3.8, I see a bunch of issues for 2.7.13 shutil |
I tried the above suggestion and built a binary from a previously built environment which built fine. I then tried building an environment that I had never used before. It failed with the error
I then added an anti-virus exception to the folder: |
I still face the same problem! I have uninstalled, VSC + Platformio, deleted all directories and did a fresh install. I have also installed the latest stable Python version 3.8.1. No change.
|
But are you using Essentially, this is MVCE for the issue. Can you also try running this? import os
import sys
import stat
import shutil
import tempfile
import traceback
import subprocess
def stats(path):
try:
print(stat.filemode(os.stat(path).st_mode))
except Exception as e:
print(e)
def rmtree(path):
def _onerror(func, path, __):
try:
st_mode = os.stat(path).st_mode
if st_mode & stat.S_IREAD:
os.chmod(path, st_mode | stat.S_IWRITE)
func(path)
except Exception:
print('> custom rmtree failed')
traceback.print_exc()
return shutil.rmtree(path, onerror=_onerror)
CWD = os.path.join(os.environ["USERPROFILE"], "Documents")
LIB = 'asyncmqttclient'
target_lib = os.path.join(CWD, LIB)
tmp_lib = tempfile.mkdtemp('-package', '_tmp_installing_test', CWD)
print('> cloning into {}'.format(tmp_lib))
subprocess.run(['git','clone','--depth=1', 'https://github.com/marvinroger/async-mqtt-client', tmp_lib])
print('> moving {} to {}'.format(tmp_lib, target_lib))
shutil.move(tmp_lib, target_lib)
print('> stats')
stats(target_lib)
stats(tmp_lib)
print('> basic rmtree {}'.format(target_lib))
try:
shutil.rmtree(target_lib)
except Exception:
print('> basic rmtree failed!')
traceback.print_exc()
print('> custom rmtree {}'.format(target_lib))
rmtree(target_lib) But I too see such error on Windows 10:
So, it works with custom function from PIO but does not with stock Python function. Not sure what to make of it yet, will post to the PIO issue tracker. Quick search only points to this old issue platformio/platformio-core#2844 edit: formatting. |
This comment has been minimized.
This comment has been minimized.
@mcspr Thanks for your comprehensive reply. But I'm a bit confused what I should do now (sorry). BTW: All mentioned directories/trees are full accessible by anybody. I veryfied and changed the permissions and files are created in all that directories and any user has full access to all the directory trees. build and upload work with tasmota (which is from size/complexity/functionality somehow compareable to espurna), but I don't know if it also uses lib_deps = ... |
@knopserl The gist of the issue is that Python's And BTW as discussed above, you can move any installed contents of the The issue itself is a mystery though as to why exactly it happens, since you do have correct permissions and directories do not cross drives letters.
Is what I wondered about, since it fails for Tasmota kind of avoids that through keeping all of the libraries in repo itself: |
And sorry for wall of text :) As to what to test, the script above would be interesting to try out in different locations. diff --git a/Lib/shutil.py b/Lib/shutil.py
index 1e89256cc3..51493359df 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -778,7 +778,13 @@ def move(src, dst, copy_function=copy2):
raise Error("Destination path '%s' already exists" % real_dst)
try:
os.rename(src, real_dst)
+ print('successfully renamed {} to {}'.format(src, real_dst))
except OSError:
+ import traceback
+ print('>' * 80)
+ print('failed renaming {} to {}'.format(src, real_dst))
+ traceback.print_exc()
+ print('<' * 80)
if os.path.islink(src):
linkto = os.readlink(src)
os.symlink(linkto, real_dst)
@@ -787,6 +793,7 @@ def move(src, dst, copy_function=copy2):
if _destinsrc(src, dst):
raise Error("Cannot move a directory '%s' into itself"
" '%s'." % (src, dst))
+ print('copytree fallback')
copytree(src, real_dst, copy_function=copy_function,
symlinks=True)
rmtree(src) The file in question is |
@mcspr Thanks again for your effort. Not sure if I can follow all your thoughts ;-) Below is the output of the build task: There are German parts (I guess you can put it to translate.google.com) but it sometimes says not only permission error but in this case also that the file is locked by another process (maybe concurrent threads running in parallel?)
|
Thanks! What is weird is that it shows WinError 5 for rename too. 2nd error from googletest dir is new though, process conflict perhaps points to the (btw I edited the log you provided to surround it with ```, that way it does not apply any formatting to the text and uses monospace font) |
@knopserl does adding this line to the diff --git a/platformio/proc.py b/platformio/proc.py
index 80e50201..dfd77cd4 100644
--- a/platformio/proc.py
+++ b/platformio/proc.py
@@ -135,6 +135,8 @@ def exec_command(*args, **kwargs):
if v and isinstance(v, string_types):
result[k] = result[k].strip()
+ p.wait()
+
return result
|
@mcspr thanks for your patience. I would have no ideas to come further without your help. I have modified the proc.py as you've sugested. The "locked by another process" disapeared, but that did not show up every time before either.
|
Don't think changing espurna versions would do much, library installation is handled by the PIO. Something might have changed during last year in how it handles it though, old versions might've done things differently. But there were some changes to the build system so you would not be able to build current version 1.14.1 with PIO <= 4.0.0, last compatible version would be the 1.13.5
Are those the only errors and does the PIO process continue to download libraries then? If yes, then it works just fine, you just need to remove Python's As previously said, I'd bet it has something to do with AV software, but not sure how it would interact with things when "Avast antivirus disabled (no other virus scanner running).". Stock Windows Defender AV does not cause any issues with my installation :/ Just running the default settings, no extra stuff and directories in question are not even added to any exceptions. It just works as-is. |
@mcspr No this is not just a simple error, it breaks the build and link job. so I don't get an image and it does then of caourse also not upload. So basically I can't use the espurna project as it breaks the build after 5 seconds and does not finish. So unusable. That was the reason why I had to switch to tasmota because there I can build firmware, but I rather wanted to continue with espurna. I could run my virtual machine under Minut Lunx 19.2 (Tina) and try to do espurna development in Linux (which is rather a workaround), until it gets solved. Disabling the antivirus did not help either (I have tested it several times). I could also do a test on another PC where another antivirus is installed or deistall the antivirus completly (just run Windows Defender). But as I said, when I switch of all AV components, it has no effect. Do you develop under Windows 10 (1909) and do you have such problems or do you use Linux or another Windows 10 version or do you know from others having this problem? So you propose, that I continue the discussion in this PIO thread? |
Let's review other errors in a separate issue. I assumed that the project was building ok if libraries are present, but I really don't get how that could go wrong too. I do routinely use Windows PC to build things without any problems. Besides info based on comments in this thread at least 3 other people had similar issue, but I am not aware of any other problems with any other systems.
Yes. Just make sure to undo both PIO and Python modifications done so far. |
@mcspr I did not gave up and didi further testing. Now I tried your previous recommendation and changed to espurna/code directory and executed: |
PlatformIO guys would know both parts better, please refer there. Repeating the discussion above, you can move contents of
There are some developments in the pio-core about pre-packaging library archives, perhaps that is something to look into instead of "vendoring" source code as-is. |
@mcspr thanks. I posted the infos to vscode and platformIO (+platformIO.vscode extention) teams. The platformIO team did not further respond since 4 weeks and it worked standalone so I infomred vscode team, but the rejected and pointed me back to platformIO (speficically the extention team). Thanks for the hint. Where do I configure the .pio/libdefs location to use/move to another root directory? And would it solve the permission problem? |
It would stop installation each time new environment is used, for now.
Nowhere. Just place contents of |
@mcspr thanks, will try this weekend. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
This issue will be auto-closed because there hasn't been any activity for two months. Feel free to open a new one if you still experience this problem. |
@mcspr I have seen this topic was closed but not solved. I opend issues at vscod and pio + pio add-on team but non of them helped. So for me, it's no longer possible to use espurna (at least not with pio). All firther updates don't helped. As said, it's reprodocable on other PC's and I'm wondering how it could work for others (under Windows 10). I have seeen, that other have also this problem (also closed). After 20 times compile errors, it asked for a SPIFlash.h and after installing the RFM69 library it works. |
I'd continue to pursue platformio-core issue. You have to understand that it looks like some specific setup issue, as neither of us (PIO core developers and me personally) can reproduce it with our Windows 10 setups , in VMs or on real hardware, with Home or Pro editions :( I can't offer any other help but to add some workaround here with library vendoring i.e. I would download libraries myself and add them into the repo as .zip files, build system will use them instead of trying to fetch them and trigger the issue. Without fixing platformio itself, you would still have the issue with any other project if they are using |
platformio/platformio-core#3328 is still open btw |
I wanted to compile espurna with the latest versions of platformio and visual studio code.
I was able to compile espurna on my previos computer but dodnt get it to run on my new pc running Windows 10 1903 64Bit.
the espurna Wiki hints, installed all required components, platforms, extentiosn, git, gulp etc. all in latest version. I get several warning/errors and do get further.
I have spent already several evenings and have followed the honts I have found on espurna and searching in the web. I hope somebody experienced can help me further.
There is e.g. a permission error which seem to be rather a flase error as I have all perrmission and have tried other disks directories and the directories were empty etc.
Here is the output
The text was updated successfully, but these errors were encountered: