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

PlatformIO detect wrong system type on Windows #4353

Closed
1 task done
KawaiiZapic opened this issue Jul 13, 2022 · 13 comments
Closed
1 task done

PlatformIO detect wrong system type on Windows #4353

KawaiiZapic opened this issue Jul 13, 2022 · 13 comments
Labels
Milestone

Comments

@KawaiiZapic
Copy link

What kind of issue is this?

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system: Windows 10 Pro x64

PlatformIO Version (platformio --version): PlatformIO Core, version 6.1.1

Description of problem

PlatformIO detect my system as windows instead of windows_amd64, and could not install package from repo.

Steps to Reproduce

  1. Create a project with STC8H8K64U
  2. platformio run --target upload

Actual Results

Processing STC8H8K64U (platform: intel_mcs51; board: STC8H8K64U)
------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing platformio/toolchain-sdcc @ >=1.40100.0,<1.40201.0
Error: Could not find the package with 'platformio/toolchain-sdcc @ >=1.40100.0,<1.40201.0' requirements for your system 'windows'

Expected Results

should detect my system as windows_amd64 and install package successfully.

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:STC8H8K64U]
platform = intel_mcs51
board = STC8H8K64U

Source file to reproduce issue:
No.

Additional info

@ivankravets
Copy link
Member

How is it possible? Please provide an output of pio system info command.

@KawaiiZapic
Copy link
Author

How is it possible? Please provide an output of pio system info command.

(penv) PS C:\Users\57735> pio system info
--------------------------  ------------------------------------------------------
PlatformIO Core             6.1.1
Python                      3.9.10-final.0
System Type                 windows
Platform                    Windows-10
File System Encoding        utf-8
Locale Encoding             cp936
PlatformIO Core Directory   C:\Users\57735\.platformio
PlatformIO Core Executable  C:\Users\57735\.platformio\penv\Scripts\platformio.exe
Python Executable           C:\Users\57735\.platformio\penv\Scripts\python.exe
Global Libraries            0
Development Platforms       2
Tools & Toolchains          8
--------------------------  ------------------------------------------------------

@KawaiiZapic
Copy link
Author

def get_systype():
    type_ = platform.system().lower()
    arch = platform.machine().lower()
    if type_ == "windows" and "x86" in arch:
        arch = "amd64" if "64" in arch else "x86"
    return "%s_%s" % (type_, arch) if arch else type_

return "%s_%s" % (type_, arch) if arch else type_
seem cannot get arch in here, maybe a python internal bug?

@ivankravets
Copy link
Member

Is this a virtual machine? What is your CPU?

@KawaiiZapic
Copy link
Author

Is this a virtual machine? What is your CPU?

It's my notebook, Ryzen 5 5700U

@ivankravets
Copy link
Member

Please type python and run the next:

import platform
platform.architecture()
platform.machine()

Please provide output.

@KawaiiZapic
Copy link
Author

KawaiiZapic commented Jul 13, 2022

Python 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.machine()
''
>>> platform.system()
'Windows'
>>> platform.architecture()
('64bit', 'WindowsPE')

It seem like a python internal bug

---- update
add platform.architecture() result

@ivankravets
Copy link
Member

Yes, looks like a Python bug. Let me quickly make a fix on our side. Thanks for the report.

@ivankravets ivankravets added this to the 6.1.2 milestone Jul 13, 2022
@ivankravets
Copy link
Member

Please re-test with pio upgrade --dev.

Does it work now?

@KawaiiZapic
Copy link
Author

KawaiiZapic commented Jul 13, 2022

I noticed that we use 64 as keyword to determine the system is amd64 or not.
Now Arm device is being more and more popular, Windows also has officially support for arm64(or "aarch64") devices, I think is better to make a more strict check on system type.

I do have a Windows arm device but I can't access to it now, so I can't give a help on this.
Maybe we can mark this down and fix it up later.
* Python is going to have officially support for Windows arm64 from 3.11, which is not release yet.

* Now it's 1AM here, I will give feedback for new version tomorrow asap.

@KawaiiZapic
Copy link
Author

Please re-test with pio upgrade --dev.

Does it work now?

(penv) PS C:\Users\57735> pio system info
--------------------------  ------------------------------------------------------
PlatformIO Core             6.1.2a2
Python                      3.9.10-final.0
System Type                 windows_amd64
Platform                    Windows-10
File System Encoding        utf-8
Locale Encoding             cp936
PlatformIO Core Directory   C:\Users\57735\.platformio
PlatformIO Core Executable  C:\Users\57735\.platformio\penv\Scripts\platformio.exe
Python Executable           C:\Users\57735\.platformio\penv\Scripts\python.exe
Global Libraries            0
Development Platforms       2
Tools & Toolchains          8
--------------------------  ------------------------------------------------------

work fine now

@sghillie
Copy link

WE are having the same issue, but in reverse. it is detecting as a windows_amd64, but I am running on intel

@KawaiiZapic
Copy link
Author

KawaiiZapic commented Mar 12, 2024

WE are having the same issue, but in reverse. it is detecting as a windows_amd64, but I am running on intel

It's actually correct. Most 64bit Intel processor should be determined as amd64, because Intel's 64 bit architecture Intel 64 is mostly same as AMD64
https://en.m.wikipedia.org/wiki/X86-64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants