openwch / arduino_core_ch32

Core library for CH32duino
248 stars 41 forks source link

Installing, or updating, to version 1.0.4 fails under Windows (11) #44

Open pkootstra opened 8 months ago

pkootstra commented 8 months ago

When installing, or updating to, version 1.0.4, the installation fails when using Windows (11), with the following console output:

Tool WCH:riscv-none-embed-gcc@8.2.0 already installed

Tool WCH:openocd@1.0.0 already installed

Downloading packages

WCH:beforeinstall@1.0.0

WCH:ch32v@1.0.4

Installing WCH:beforeinstall@1.0.0

Failed to install platform: 'WCH:ch32v:1.0.4'.

Error: 13 INTERNAL: Cannot install tool WCH:beforeinstall@1.0.0: extracting archive: Create link 
C:\Users\UserName\AppData\Local\Arduino15\tmp\package-332495206\wch_beforeinstall_linux-1.0.0\libhidapi-hidraw.so: symlink libhidapi-hidraw.so.0.0.0 C:\Users\UserName\AppData\Local\Arduino15\tmp\package-332495206\wch_beforeinstall_linux-1.0.0\libhidapi-hidraw.so: A required privilege is not held by the client.

Apparently the installer attempts to install linux binaries in windows...

dquadros commented 8 months ago

Same here on a "fresh" install. Selecting version 1.0.3 after the bad install will complete ok.

Khalinda commented 6 months ago

It looks like Tianpei made a misteak [sic]. I Googled "beforeinstall", and the explanation on this page:

https://github.com/openwch/arduino_core_ch32

implies that the beforeinstall script is only needed on Linux. I tracked down the script on my PC in this directory:

...\AppData\Local\Arduino15\packages\WCH\tools\beforeinstall\1.0.0\

I edited the file "Start.sh" and I commented out all of the code in the file (prefixing each line with "#"). This next step may not be necessary, but I deleted the "ch32v" directory found here:

...\AppData\Local\Arduino15\packages\WCH\hardware\

Finally, I reinstalled CH32 (version 1.0.4) using the Arduino board manager and it installed without a problem. It seems to be working. At least I was able to compile a sketch and load it to a CH32 board.
`

DeqingSun commented 6 months ago

The install seems OK with "Run as Administrator". On my windows machine the Administrator is another user so the package is installed somewhere else. Then I need to copy the package in C:\Users\{Your USER}\AppData\Local\Arduino15\packages to the right location manually.

Ivoz commented 5 months ago

Right, so it needs to skip trying to symlink linux .so files from wch_beforeinstall_linux-1.0.0.tar.gz when run on Windows...

@TianpeiLee is https://github.com/openwch/board_manager_files/blob/main/package_ch32v_index.json#L227-L230 really needed for Windows?

TianpeiLee commented 3 months ago

@Ivoz This is not provided for Windows, but at the time I remembered that if I did not add this link in the Windows resources, the arduino ide seemed not to recognize the json file normally. Maybe the method I tested at the time was wrong. I will confirm this again.(#89 Same problem)

suprimex commented 3 months ago

Why it was closed? The problem is still actual! Fresh install:

Downloading packages WCH:beforeinstall@1.0.0 WCH:ch32v@1.0.4 Installing WCH:beforeinstall@1.0.0 Failed to install platform: 'WCH:ch32v:1.0.4'. Error: 13 INTERNAL: Cannot install tool WCH:beforeinstall@1.0.0: extracting archive: Create link C:\Users\\AppData\Local\Arduino15\tmp\package-3016519650\wch_beforeinstall_linux-1.0.0\libhidapi-hidraw.so: symlink libhidapi-hidraw.so.0.0.0 C:\Users\\AppData\Local\Arduino15\tmp\package-3016519650\wch_beforeinstall_linux-1.0.0\libhidapi-hidraw.so: A required privilege is not held by the client.

TianpeiLee commented 3 months ago

If the IDE requires the library structure to be consistent in each environment, then there is nothing I can do. Maybe I can only install it in administrator mode.

DeqingSun commented 3 months ago

If the IDE requires the library structure to be consistent in each environment, then there is nothing I can do. Maybe I can only install it in administrator mode.

Then why the link for the 3 dependencies of beforeinstall should be the same link? Here is how I change the link to an empty archive and it installs fine with a local server running on port 9000.

{
          "name": "beforeinstall",
          "version": "1.0.0",
          "systems":
          [
            {
              "host": "x86_64-linux-gnu",
              "url": "https://codeload.github.com/TianpeiLee/wch_beforeinstall_linux/tar.gz/refs/tags/1.0.0",
              "archiveFileName": "wch_beforeinstall_linux-1.0.0.tar.gz",
              "checksum": "SHA-256:17EF3A94BC46B9EB9AB1FDECC48FCD3880EEB8FCC36E6648626320F0BF2864DC",
              "size": "507269"
            },
            {
              "host": "i686-mingw32",
              "url": "http://localhost:9000/wch_beforeinstall_empty.tar.gz",
              "archiveFileName": "wch_beforeinstall_empty.tar.gz",
              "checksum": "SHA-256:87f2e600b449220e88b20c5c867eb879b4acad177824fab65a9b3713d53246fd",
              "size": "186"
            },
            {
              "host": "x86_64-apple-darwin",
              "url": "http://localhost:9000/wch_beforeinstall_empty.tar.gz",
              "archiveFileName": "wch_beforeinstall_empty.tar.gz",
              "checksum": "SHA-256:87f2e600b449220e88b20c5c867eb879b4acad177824fab65a9b3713d53246fd",
              "size": "186"
            }               
          ]
        }       

package_ch32v_index.json wch_beforeinstall_empty.tar.gz

TianpeiLee commented 3 months ago

I know, but this essentially makes it download a file, and I was expecting it not to download unnecessary files.

DeqingSun commented 3 months ago

Yes I tried to remove it completely for Windows and Mac, but Arduino throw an error. So I used an empty file. I think an empty file is better than an incorrect file. Or this issue should be submitted to Arduino support.

TianpeiLee commented 3 months ago

It seems that my previous memory was correct. Yes, an empty file is better than an incorrect file. When the tool chain is updated, I will change it to an empty file.

fcassia2017 commented 2 months ago

Confirming it happens on Windows 11. Fresh install of Arduino IDE. I'm trying to bring newbies into the CH32v003 platform and this is a show stopper. // Installing WCH:openocd@1.0.0 Configuring tool. WCH:openocd@1.0.0 installed Installing WCH:beforeinstall@1.0.0 Failed to install platform: 'WCH:ch32v:1.0.4'. Error: 13 INTERNAL: Cannot install tool WCH:beforeinstall@1.0.0: extracting archive: Create link C:\Users\Nando\AppData\Local\Arduino15\tmp\package-3340045858\wch_beforeinstall_linux-1.0.0\libhidapi-hidraw.so: symlink libhidapi-hidraw.so.0.0.0 C:\Users\Nando\AppData\Local\Arduino15\tmp\package-3340045858\wch_beforeinstall_linux-1.0.0\libhidapi-hidraw.so: A required privilege is not held by the client. //