Coder Social home page Coder Social logo

tristanisham / zvm Goto Github PK

View Code? Open in Web Editor NEW
351.0 7.0 30.0 30.5 MB

zvm (Zig Version Manager) lets you easily install/upgrade between different versions of Zig.

Home Page: https://www.zvm.app

License: MIT License

Go 84.36% TypeScript 3.74% Shell 5.97% PowerShell 5.94%
version-control version-manager versioning zig ziglang

zvm's Introduction

Zig Version Manager (zvm) is a tool for managing your Zig installs. With std under heavy development and a large feature roadmap, Zig is bound to continue changing. Breaking existing builds, updating valid syntax, and introducing new features like a package manager. While this is great for developers, it also can lead to headaches when you need multiple versions of a language installed to compile your projects, or a language gets updated frequently.

Join our Community

Subscribe on Polar

Installing ZVM

ZVM lives entirely in $HOME/.zvm on all platforms it supports. Inside of the directory, ZVM will download new ZIG versions and symlink whichever version you specify with zvm use to $HOME/.zvm/bin. You should add this folder to your path. After ZVM 0.2.3, ZVM's installer will now add ZVM to $HOME/.zvm/self. You should also add this directory as the environment variable ZVM_INSTALL. The installer should handle this for you automatically if you're on *nix systems, but you'll have to manually do this on Windows. You can then add ZVM_INSTALL to your path.

If you don't want to use ZVM_INSTALL (like you already have ZVM in a place you like), then ZVM will update the exact executable you've called upgrade from.

Linux, BSD, MacOS, *nix

curl https://raw.githubusercontent.com/tristanisham/zvm/master/install.sh | bash

Then add ZVM's directories to your $PATH

echo "# ZVM" >> $HOME/.profile
echo export ZVM_INSTALL="$HOME/.zvm/self" >> $HOME/.profile
echo export PATH="$PATH:$HOME/.zvm/bin" >> $HOME/.profile
echo export PATH="$PATH:$ZVM_INSTALL/" >> $HOME/.profile

Windows

PowerShell

irm https://raw.githubusercontent.com/tristanisham/zvm/master/install.ps1 | iex

Command Prompt

powershell -c "irm https://raw.githubusercontent.com/tristanisham/zvm/master/install.ps1 | iex"

Manually

Please grab the latest release.

Putting ZVM on your Path

ZVM requires a few directories to be on your $PATH. If you don't know how to update your environment variables perminantly on Windows, you can follow this guide. Once you're in the appropriate menu, add or append to the following environment variables:

Add

  • ZVM_INSTALL: %USERPROFILE%\.zvm\self

Append

  • PATH: %USERPROFILE%\.zvm\bin
  • PATH: %ZVM_INSTALL%

Configure ZVM path

It is possible to overwrite the default behavior of ZVM to adhere to XDG specification on Linux. There's an environment variable ZVM_PATH. Setting it to $XDG_DATA_HOME/zvm will do the trick.

Community Package

AUR

zvm on the Arch AUR is a community maintained package, and may be out of date.

Why should I use ZVM?

While Zig is still pre-1.0 if you're going to stay up-to-date with the master branch, you're going to be downloading Zig quite often. You could do it manually, having to scoll around to find your appropriate version, decompress it, and install it on your $PATH. Or, you could install ZVM and run zvm i master every time you want to update. zvm is a static binary under a permissive license. It supports more platforms than any other Zig version manager. Its only dependency is tar on Unix-based systems. Whether you're on Windows, MacOS, Linux, a flavor of BSD, or Plan 9 zvm will let you install, switch between, and run multiple versions of Zig.

Contributing and Notice

zvm is stable software. Pre-v1.0.0 any breaking changes will be clearly labeled, and any commands potentially on the chopping block will print notice. The program is under constant development, and the author is very willing to work with contributors. If you have any issues, ideas, or contributions you'd like to suggest create a GitHub issue.

How to use ZVM

Install

zvm install <version> 
# Or
zvm i <version>

Use install or i to download a specific version of Zig. To install the latest version, use "master".

# Example
zvm i master

Install ZLS with ZVM

You can now install ZLS with your Zig download! To install ZLS with ZVM, simply pass the --zls flag with zvm i. For example:

zvm i --zls master

Switch between installed Zig versions

zvm use <version>

Use use to switch between versions of Zig.

# Example
zvm use master

List installed Zig versions

# Example
zvm ls

Use ls to list all installed version of Zig.

List all versions of Zig available

zvm ls --all

The --all flag will list the available verisons of Zig for download. Not the versions locally installed.

Uninstall a Zig version

# Example
zvm rm 0.10.0

Use uninstall or rm to remove an uninstalled version from your system.

Upgrade your ZVM installation

As of zvm v0.2.3 you can now upgrade your ZVM installation from, well, zvm. Just run:

zvm upgrade

The latest version of ZVM should install on your machine, regardless of where your binary lives (though if you have your binary in a privaledged folder, you may have to run this command with sudo).

Clean up build artifacts

# Example
zvm clean

Use clean to remove build artifacts (Good if you're on Windows).

Set Version Map Source

vmu "https://validurl.local/vmu.json" # Change the source ZVM pulls Zig release information from. Good for self-hosted Zig CDNs.
                                       # ZVM only supports schemas that match the offical version map schema. 
                                       # Run `vmu default` to reset your version map.

vmu default # Resets back to default Zig releases.
vmu mach # Sets ZVM to pull from Mach nominated Zig.

Print program help

zvm help

Print program version

zvm --version

Prints the version of ZVM you have installed.


Option flags

Color Toggle

Enable or disable colored ZVM output. No value toggles colors.

Enable

  • on
  • yes/y
  • enabled
  • true

Disabled

  • off
  • no/n
  • disabled
  • false
--color # Toggle ANSI color printing on or off for ZVM's output, i.e. --color=true

Environment Variables

  • ZVM_DEBG enables DEBUG logging for your executable. This is meant for contributors and developers.
  • ZVM_SET_CU Toggle the automatic upgrade checker. If you want to reenable the checker, just uset ZVM_SET_CU.

Please Consider Giving the Repo a Star ⭐

Star History Chart

zvm's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

zvm's Issues

ZLS not installing for mach nominated versions

Installing mach-latest with -vmu mach and -D=zls does not install zls for that version. Not sure if metadata on zls versions for mach nominated versions exists but if it does this would be nice to have working

--vmu flag set's version map flag in settings, but ZVM still installs from default

Using zvm -vmu "https://example.com" correctly sets the value in ~/.zvm/settings.json.

{
    "useColor": true,
    "versionMapUrl": "https://example.com"
}

But running zvm i master resets the setting and fetches from the default.

{
    "useColor": true,
    "versionMapUrl": "https://ziglang.org/download/index.json"
}

I believe the bug is in ZVM.fetchVersionMap() near line 20. The call to loadSetting is the logical place for the reset but it doesn't modify the data structure.

func (z *ZVM) loadSettings() error {
	set_path := z.Settings.basePath
	if _, err := os.Stat(set_path); errors.Is(err, os.ErrNotExist) {
		return ErrNoSettings
	}

	data, err := os.ReadFile(set_path)
	if err != nil {
		return err
	}

	return json.Unmarshal(data, &z.Settings)
}

Some fresh eyes on this issue would be appreciated as I'm very occupied with life stuff at the moment. @OlshaMB would you please take a look as this is directly related to your pull request?

Updating master installs?

Hi!

I've been using ZVM regularly for a while on both windows and macos, thanks for creating this!

The only thing I've run into that is a small bother, is that I have to go into .zvm and delete the master folder before running zvm i master to install the latest version of master, otherwise it seems to stick on the already installed version.

Am I missing some functionality to let me overwrite the installed master with a new version?

Thanks!

Discordant ZVM versions

With the latest version the version shown with zvm -v is v0.1.7, whereas in the cli help and in the user agent of the download request in the Install function the version is v0.1.6.

'zvm i -D=zls' fails to download ZLS on tagged releases

On ArchLinux, with fresh install through install script.

I've managed to track down this bug to this line. For an unknown reason (to me)(see comment below) asset.BrowserDownloadUrl is empty but browser_download_url in the Github API response is okay.

[marcin:~]% zvm version
v0.5.3
[marcin:~]% zvm i -D=zls master
Downloading master: 100% |████████████████████████████████████████| (48/48 MB, 38 MB/s)               
Checking shasum...
Shasums match! 🎉
Extracting bundle...
Removing old symlink
Finding ZLS executable...
Downloading ZLS 100% |████████████████████████████████████████| (17/17 MB, 9.6 MB/s)        
Removing old symlink
Done! 🎉
[marcin:~]% zls --version
0.12.0-dev.371+47373c1
[marcin:~]% zvm ls
master
[marcin:~]% zvm use master
[marcin:~]% zvm ls
master
[marcin:~]% zvm i -D=zls 0.11.0
Downloading 0.11.0: 100% |████████████████████████████████████████| (45/45 MB, 38 MB/s)               
Checking shasum...
Shasums match! 🎉
Extracting bundle...
Removing old symlink
Finding ZLS executable...
[marcin:~]% zls --version
zsh: command not found: zls
[marcin:~]% zvm ls
0.11.0
master
[marcin:~]% zvm use 0.11.0
[marcin:~]% zls --version
zsh: command not found: zls
[marcin:~]% zvm use master
[marcin:~]% zls --version
0.12.0-dev.371+47373c1
[marcin:~]% zvm i -D=zls 0.10.0
Downloading 0.10.0: 100% |████████████████████████████████████████| (44/44 MB, 38 MB/s)               
Checking shasum...
Shasums match! 🎉
Extracting bundle...
Removing old symlink
Finding ZLS executable...
[marcin:~]% zls --version 
zsh: command not found: zls
[marcin:~]% ls ~/.zvm/master
doc  lib  LICENSE  README.md  zig  zls
[marcin:~]% ls ~/.zvm/0.11.0 
doc  lib  LICENSE  README.md  zig
[marcin:~]% ls ~/.zvm/0.10.0 
doc  lib  LICENSE  zig

Delve:

(dlv) clearall
Breakpoint 2 cleared at 0x9b9d16 for zvm/cli.(*ZVM).InstallZls() ./cli/install.go:288
Breakpoint 3 cleared at 0x9b8cb6 for zvm/cli.getZLSDownloadUrl() ./cli/install.go:223
Breakpoint 1 cleared at 0x9b5a16 for zvm/cli.(*ZVM).Install() ./cli/install.go:27
Breakpoint 4 cleared at 0x9b9a8f for zvm/cli.getZLSDownloadUrl() ./cli/install.go:276
(dlv) list
> zvm/cli.getZLSDownloadUrl() ./cli/install.go:276 (PC: 0x9b9a8f)
   271:			// getting platform information
   272:			var downloadUrl string
   273:			for _, asset := range taggedReleaseResponse.Assets {
   274:				if strings.Contains(asset.Name, archDouble) {
   275:					downloadUrl = asset.BrowserDownloadUrl
=> 276:					break
   277:				}
   278:			}
   279:	
   280:			if downloadUrl == "" {
   281:				return "", errors.New("invalid release URl")
(dlv) break
Breakpoint 5 set at 0x9b9a8f for zvm/cli.getZLSDownloadUrl() ./cli/install.go:276
(dlv) r
Process restarted with PID 13141
(dlv) c
Downloading 0.11.0: 100% |█████████████████████████████████████████| (45/45 MB, 38 MB/s)               
Checking shasum...
Shasums match! 🎉
Extracting bundle...
Removing old symlink
Finding ZLS executable...
> zvm/cli.getZLSDownloadUrl() ./cli/install.go:276 (hits goroutine(1):1 total:1) (PC: 0x9b9a8f)
   271:			// getting platform information
   272:			var downloadUrl string
   273:			for _, asset := range taggedReleaseResponse.Assets {
   274:				if strings.Contains(asset.Name, archDouble) {
   275:					downloadUrl = asset.BrowserDownloadUrl
=> 276:					break
   277:				}
   278:			}
   279:	
   280:			if downloadUrl == "" {
   281:				return "", errors.New("invalid release URl")
(dlv) p asset
zvm/cli.gitHubAsset {
	Url: "https://api.github.com/repos/zigtools/zls/releases/assets/121342...+3 more",
	Name: "zls-x86_64-linux.tar.gz",
	BrowserDownloadUrl: "",}
(dlv) p downloadUrl
""
(dlv) p releaseBuffer
bytes.Buffer {
	buf: []uint8 len: 15029, cap: 16384, [123,34,117,114,108,34,58,34,104,116,116,112,115,58,47,47,97,112,105,46,103,105,116,104,117,98,46,99,111,109,47,114,101,112,111,115,47,122,105,103,116,111,111,108,115,47,122,108,115,47,114,101,108,101,97,115,101,115,47,49,49,55,48,54,...+14965 more],
	off: 0,
	lastRead: opInvalid (0),}
(dlv) p url
"https://api.github.com/repos/zigtools/zls/releases/tags/0.11.0"

`zvm upgrade` failure on ArchLinux

❯ zvm upgrade
There's a new version of ZVM (v0.4.0).
 Run 'zvm upgrade' to install it!
Upgrading ZVM... 100% |██████████████████████████████████████████████████████████████████████████████████████████| (7.5/7.5 MB, 34 MB/s)
2023/11/02 18:52:55 ERRO this is a new command, and may have some issues. Consider reporting your problem on Github :) github=https://github.com/
tristanisham/zvm/issues
2023/11/02 18:52:55 FATA failed to self-upgrade zvm
rename /tmp/zvm-upgrade-2633282309/zvm /home/dogue/.zvm/self/zvm: invalid cross-device link

Was on 0.3.0, tried to upgrade and now my zvm installation appears to be broken. The .zvm folder is still in place but the shell can't find the actual zvm binary.

Doing a fresh install seems to have worked to repair my install.

Installing/Using Zig Versions Fails on Windows with ZVM 0.5.5

Steps Taken

  • Install zvm from powershell with: irm https://raw.githubusercontent.com/tristanisham/zvm/master/install.ps1 | iex
  • run zvm i -D=zls 0.11.0 (or any other zig version)

Actual Results

The following error is produced:

PS C:\Users\user> zvm i -D=zls 0.11.0
Downloading 0.11.0: 100% |█████████████████████████████████████████████████████████| (77/77 MB, 88 MB/s)
Checking shasum...
Shasums match! 🎉
Extracting bundle...
Removing old symlink
2024/03/01 09:21:13 FATA could not remove bin remove C:\Users\user\.zvm\bin\zvm.exe: Access is denied.="missing value"

Expected Results

I can install zig versions.

Notes

Best guess is that zvm is trying to point the .zvm/bin directory at the bin directory for the 0.11.0 install, however the zvm executable is also in that directory, and since ZVM is running windows will not allow changing the symlink (Windows keeps file handles open to running processes). Probably best to not have the zvm executable in a directory that ZVM can modify the symlink for.

Error installing versions from "use" flow

go run . use 0.11.0
          
  Error   
          
2024/03/22 00:28:39 ERRO symlink /home/tristan/.zvm/0.11.0 /home/tristan/.zvm/bin: file exists

Please report this error as a GitHub issue.
https://github.com/tristanisham/zvm/issues/
                                           
exit status 1

I can't install zvm on Fedora 39 aarch64 (Asahi Linux)

I'm using Fedora 39 aarch64, but I can't install zvm.

$ curl https://raw.githubusercontent.com/tristanisham/zvm/master/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3808  100  3808    0     0   6459      0 --:--:-- --:--:-- --:--:--  6454
Installing zvm-linux-aarch64.tar in /home/kebo/zvm
wget is installed. Using wget...
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors

Run the following commands to put ZVM on your path via /home/kebo/.profile

echo "# ZVM" >> $HOME/.profile
echo 'export ZVM_INSTALL="$HOME/.zvm/self"' >> $HOME/.profile
echo 'export PATH="$PATH:$HOME/.zvm/bin"' >> $HOME/.profile
echo 'export PATH="$PATH:$ZVM_INSTALL/"' >> $HOME/.profile
Run 'source ~/.profile' to start using ZVM in this shell!

It seems that install.sh tried to download zvm-linux-aarch64.tar, not zvm-linux-arm64.tar.

Incorrect ZLS version

I am on Windows. I have installed zvm properly and ran zvm i -D=zls master to install zig and zls. However, zls --version gives 0.11.0 while zig version gives 0.12.0-dev.2127+fcc0c5ddc.

Edit: Current temporary fix - Since I am only using zls on vscode, I have manually downloaded the zls binary from the repo and updated the path inside vscode extension setting instead. It would be nice if the versioning of zls can be controlled directly by zvm while the vscode extension setting points directly to .zvm\bin

"zvm i" goes through the entire install process even if there is no new version

(apologies for posting this as an empty issue initially, I don't use GH issues much and I misclicked)

Is your feature request related to a problem? Please describe.
Running "zvm i master" will reinstall the same version if no new version is available.

Describe the solution you'd like
Exit without doing anything if the latest version and the currently installed version are the same. I use the command to get the latest version, so it would be nice if there were a check to ensure that re-downloading + installing is actually necessary.

Feature Request: List available zig versions for installation

This feature will allow us to verify what zig versions are available before installing it:

Something like:

zvm list 

or

zvm check

or

zvm versions

To me the choice of the cmd does't mather much, only to find what binaries are available to be downloaded

Add zls

My request is more of a question about whether it makes sense to add zls as an optional part of installation (the same way as ghcup works, which allows to install hls, ghc, and its build systems).

My experience was that, when you install a master version of zig, you also get an outdated zls, which is a little inconvenient.

Please document about path

I don't find any relevant info, and I scan through the source code figuring out it should be at ~/.zvm/bin

Cannot `go install github.com/tristanisham/zvm`

❯ go install github.com/tristanisham/zvm@latest
go: downloading github.com/tristanisham/zvm v0.5.3
go: github.com/tristanisham/zvm@latest: version constraints conflict:
	github.com/tristanisham/[email protected]: parsing go.mod:
	module declares its path as: zvm
	        but was required as: github.com/tristanisham/zvm

Can't use mach versions

Installing a Mach-nominated version works, but it can't be used after that.

$ zvm -vmu=mach
2024/03/01 12:48:39 INFO Run `-vmu default` to reset your version map.

$ zvm i mach-latest
Downloading mach-latest: 100% |██████████████████████████████████████████████████████████████████████████████████████████████████████████████| (46/46 MB, 42 MB/s)
Checking shasum...
Shasums match! 🎉
Extracting bundle...
Removing old symlink

$ zvm use mach-latest
2024/03/01 12:45:48 FATA version mach-latest is not a released version

Same if I pass "-vmu mach" to the use command:

zvm -vmu=mach use mach-latest
2024/03/01 12:47:59 INFO Run `-vmu default` to reset your version map.
2024/03/01 12:47:59 FATA version mach-latest is not a released version

Upgrade on Windows requires user to run PowerShell Commands. Here's a possible fix.

fn replace_exe(from: &Path, to: &Path) -> Result<(), std::io::Error> {
  if cfg!(windows) {
    // On windows you cannot replace the currently running executable.
    // so first we rename it to deno.old.exe
    fs::rename(to, to.with_extension("old.exe"))?;
  } else {
    fs::remove_file(to)?;
  }
  // Windows cannot rename files across device boundaries, so if rename fails,
  // we try again with copy.
  fs::rename(from, to).or_else(|_| fs::copy(from, to).map(|_| ()))?;
  Ok(())
}

This code is from Deno. See if we can replicate this functionality to remove the need for user intervention.

Shasum validation

Shasum's from zig.onl fail to validate. Current theory is that I'm calculating the difference between the raw directory and the archive.

Add the possibily to install master from a specific commit hash

I've been using zvm for a few months now and it is really helpful, thanks for the effort you've put into it 🙏🏽. As I've started to use the master branch zig version more frequently, I sometimes would have needed the possibility to have multiple "master versions" installed from different commit hashes.

sth. like

zvm install master

Would install the latest commit from the zig master branch, and then

zvm install master#972e70b

Would install the given commit hash from the master branch.

I'm not sure if that can be easily done, looks like this feature would need to pull the zig git repository and build the given version then 🤔.

ZLS Invalid Executable on Windows

On Windows, using the ZLS install command (zvm install -D=zls master) installs a completely invalid EXE. Attempting to run the version of zig placed in %USERPROFILE%\.zvm\bin produces the following error:

> zls
ResourceUnavailable: Program 'zls.exe' failed to run: An error occurred trying to start process 'C:\Users\cridl\.zvm\bin\zls.exe' with working directory 'D:\Documents\Development\AoC\aoc-2023\Zig'. The specified executable is not a valid application for this OS platform.At line:1 char:1

Upon further inspection, the zls.exe file placed in the bin folder isn't even a valid Win32 executable.

[BUG] Windows symlink bug

platform Win10
zvm v0.6.1 windows/amd64

after zvm ls

2024/04/09 21:59:10 WARN exec: "zig": executable file not found in %PATH%
0.10.1
0.11.0
master

The path and env are configured properly,

After zvm use 0.11.0 (or any other version) , there is following error :

2024/04/09 21:53:40 ERRO remove C:\Users\francek\.zvm\bin: The system cannot find the file specified.

There is actualy no .zvm\bin subdir

ZVM downloads macos-x86_64 on macos-aarch64 then crashes

~ ❯❯❯ zvm i master
Install master
→ Version master is not installed. Beginning download...
→ Downloading Zig version master for platform macos-x86_64...
Illegal instruction at address 0x1050bde4b
???:?:?: 0x1050bde4b in ___lttf2 (???)
Unwind error at address `zvm:0x1050bde4b` (error.InvalidUnwindInfo), trace may be incomplete

fish: Job 1, 'zvm i master' terminated by signal SIGABRT (Abort)
~ ❯❯❯

`zvm ls --all` doesn't sort versions correctly

When using zvm ls --all, the currently displayed order is not sorted according to semver. This is likely due to a requirement in semver.Sort that semantic version strings must begin with a leading "v", as in "v1.0.0".

Current Order -

master
0.1.1
0.10.0
0.10.1
0.11.0
0.2.0
0.3.0
0.4.0
0.5.0
0.6.0
0.7.0
0.7.1
0.8.0
0.8.1
0.9.0
0.9.1

Expected Order -

master
0.11.0
0.10.1
0.10.0
0.9.1
0.9.0
0.8.1
0.8.0
0.7.1
0.7.0
0.6.0
0.5.0
0.4.0
0.3.0
0.2.0
0.1.1

Using --zls flag gives an error

Not sure if I'm doing something wrong here, but on a fresh install of ZVM 0.3.0, I'm getting an error trying to use the new --zls flag. Below is a paste from my terminal output showing two failed tries with the flag and one successful try without.

❯ zvm install 0.10.1 --zls
2023/10/30 22:48:09 FATA unsupported Zig version: "--zls"

❯ zvm install -z 0.10.1
flag provided but not defined: -z
Usage of install:
  -D string
        Specify additional dependencies to install with Zig
        
❯ zvm install 0.10.1
Downloading 0.10.1: 100% |██████████████████████████████████████████████████████████████████████████████████| (42/42 MB, 23 MB/s)
Checking shasum...
Shasums match! 🎉
Extracting bundle...

Edit: Went back and read the doc. Using zvm -D zls <zig version> works fine. It's just the --zls/-z flag (mentioned in the help text) doesn't seem to be getting parsed properly.

Show message when option doesn't exist

First of all, thank you for your tool.

Can you improve your tool by adding message when option doesn't exist.
Example:

$ ./workspace/Perso/Zig/zvm/zvm u
$

Show help by example.

$ ./workspace/Perso/Zig/zvm/zvm u
$ Error: option not found
  Install
          zvm i/install <zig version>
  Use
          zmv use <zig version>
  Version
          version
  Help
          help

[BUG] ZVM on windows fails to make a symlink on windows for non-admin users

Describe the bug
ZVM is asking for administrative privileges to create a link on windows between an installed version and the common ~/.zvm/bin folder.

As both of these locations are within the users home folder (C:\users\USERNAME) these should not be required.

While Administrative privileges are available for personal computers, this is not always an option if your computer is managed by a company.

To Reproduce
Steps to reproduce the behavior:

  1. When running as a user that does not have Administrator priviledges
  2. Run zvm use ...
  3. See error

2024/02/22 10:34:50 ERRO unable to symlink as Administrator
symlink C:\Users\USERNAME.zvm\0.12.0 C:\Users\USERNAME.zvm\bin: A required privilege is not held by the client.

Expected behavior
Link from ~/.zvm/VERSION is created to ~/.zvm/bin

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 11
  • Architecture: amd64
  • Version: 0.6.7

Configuration:

  • VMU (Version Map URL) or alias: default

Additional context
Add any other context about the problem here.

Add ZVM to WebMan

Add a new package to WebMan to download ZVM.

I do see they already have Zig, but ZVM supports more than official Zig.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

[BUG] No zls is available for `0.12.0` and `0.11.0`

Describe the bug
No zls is available for 0.12.0 and 0.11.0

To Reproduce
Steps to reproduce the behavior:

  1. Run zvm install -D=zls 0.12.0(or use 0.11.0)
    2 Run zvm use 0.12.0
  2. No zls is on path

Expected behavior
zls is installed.

Desktop (please complete the following information):

  • OS: Linux mechrevo 6.8.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 17 Apr 2024 15:20:28 +0000 x86_64 GNU/Linux

Additional Context

It looks like there's no 0.12.0 release for zls on zls's repo yet. I think we can forward it to 0.11.0 for now?
ZLS 0.12.0 is already released, we still can't fetch it.

[BUG] FreeBSD reporting unsupported system for Zig

Describe the bug
Using NomadBSD which is a freeBSD derivative zvm returns unsupported system even though I can install zig perfectly fine using pkg.

To Reproduce

  1. Run zvm install master
  2. See error: unsupported system for Zig

Expected behavior
To install zig

Screenshots
error

Desktop (please complete the following information):

  • OS: NomadBSD
  • Architecture amd64
  • Version 140R-20240126

Configuration:

  • VMU (Version Map URL) default and mach

Additional context
NomadBSD is a live os, hense im booting from a usb.

Failed to open `zvm.tar`

Curl command returns this:

tar: Error opening archive: Failed to open 'zvm.tar'
rm: zvm.tar: No such file or directory

Add ZVM to Winget

Add ZVM as an installable software with WinGet.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

install zig in different drive (Fixed)

Is your feature request related to a problem? Please describe.
I'm on windows , zvm give no solution to where to install zig

Describe the solution you'd like
i would like zig to be installed to a different drive : D:\Application\zig instead of C:\

Describe alternatives you've considered
no alternative

Downloading large file, cURL

I'm currently working on a version manager for Zig https://github.com/tristanisham/zvm. I use cURL for my http requests.

While downloading smaller files (a resume) the program works 100% as expected. I use an ArrayList and an ArenaAllocator. But when the files get larger, like Zig's latest version at around 46mb the program spits out the following error.

error: FailedToPerformRequest
/home/tristan/Development/zvm/src/fetch-version.zig:85:9: 0x24ea32 in downloadFile (zvm)
        return CurlError.FailedToPerformRequest;
        ^
/home/tristan/Development/zvm/src/main.zig:68:17: 0x250303 in main (zvm)
                try version.downloadFile(tarball, "./out.tar.xz", &fba);
                ^
The following command exited with error code 1 (expected 0):
cd /home/tristan/Development/zvm && /home/tristan/Development/zvm/zig-out/bin/zvm install master 
error: UnexpectedExitCode
/home/tristan/.zig/lib/std/build/RunStep.zig:277:17: 0x30c77a in runCommand (build)
                return error.UnexpectedExitCode;
                ^
/home/tristan/.zig/lib/std/build/RunStep.zig:183:5: 0x2fa240 in make (build)
    try runCommand(
    ^
/home/tristan/.zig/lib/std/build.zig:3649:9: 0x2a5037 in make (build)
        try self.makeFn(self);
        ^
/home/tristan/.zig/lib/std/build.zig:509:9: 0x292c54 in makeOneStep (build)
        try s.make();
        ^
/home/tristan/.zig/lib/std/build.zig:503:17: 0x292bc2 in makeOneStep (build)
                return err;
                ^
/home/tristan/.zig/lib/std/build.zig:464:13: 0x292922 in make (build)
            try self.makeOneStep(s);
            ^
/home/tristan/.zig/lib/build_runner.zig:223:21: 0x29588a in main (build)
            else => return err

Here's the function code. My current theory is that it has something to do with not enough allocated memory? But I already tried allocating a large enough amount on the stack and the heap using FixedBufferAllocator and ArenaAllocator.

pub fn downloadFile(url: []const u8, path: []const u8, arena: *std.heap.ArenaAllocator) !void {
    var buf = std.ArrayList(u8).init(arena.*.allocator());
    defer buf.deinit();

    if (cURL.curl_global_init(cURL.CURL_GLOBAL_ALL) != cURL.CURLE_OK) {
        return CurlError.CURLGlobalInitFailed;
    }
    defer cURL.curl_global_cleanup();

    // curl easy handle init, or fail
    const handle = cURL.curl_easy_init() orelse return CurlError.CURLHandleInitFailed;
    defer cURL.curl_easy_cleanup(handle);

    // setup curl options
    if (cURL.curl_easy_setopt(handle, cURL.CURLOPT_URL, url.ptr) != cURL.CURLE_OK)
        return CurlError.CouldNotSetURL;

    if (cURL.curl_easy_setopt(handle, cURL.CURLOPT_USERAGENT, "zvm (Zig Version Manager)/v0.0.1") != cURL.CURLE_OK) {
        return CurlError.CouldNotSetUserAgent;
    }
    // set write function callbacks
    if (cURL.curl_easy_setopt(handle, cURL.CURLOPT_WRITEFUNCTION, writeToArrayListCallback) != cURL.CURLE_OK) {
        return CurlError.CouldNotSetWriteCallback;
    }
    if (cURL.curl_easy_setopt(handle, cURL.CURLOPT_WRITEDATA, &buf) != cURL.CURLE_OK) {
        return CurlError.CouldNotSetWriteCallback;
    }

    if (cURL.curl_easy_perform(handle) != cURL.CURLE_OK) {
        return CurlError.FailedToPerformRequest;
    }

    const file = try std.fs.cwd().createFile(path, .{ .read = true });
    defer file.close();
    try file.writeAll(buf.items);
}

How can I create a structure to store such a large amount in memory?

Error: bus error

When I use the command zvm use master, it mentions this error: 2024/03/07 14:07:17 WARN signal: bus error

image

build.ts has depreciating APIs

I use build.ts to build releases for all of ZVM's supported platforms, but the Deno.run() API is being depreciated in Deno 2. I need to update the call to use the new Deno.Command() API before Deno 2 releases.

A successful PR would follow the contributing guide by running deno fmt . before submission, and by not tweaking the functionality of the file, just replacing this particular API so the script behaves in the exact same way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.