pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Windows 10 MSYS2-UCRT64 bootstrap fail



I haven't had pkgsrc on Windows since XP/Interix. I've set up Windows 10 to have the administrator account active, renamed root, with a system profile path of C:\export\home. I extracted the msys2 tarball in C:\, having used the installer previously to install to C:\POSVR4IX (lol) but it's just a mess that way. 



Between Tribblix and NetBSD on a Sun T5120, my iMac Pro with bootcamp'd Windows w/ Alpine Linux running under wsl2, a laptop running OmniOS in the global zone with Windows and MidnightBSD guest bhyve zones... well, pkgsrc comes closest to being my cross-platform solution, except for Windows. I've only set up the UCRT64 toolchain, from bash after a fresh msys2 install:



# whoami

root

// goto gotta check if it's really uid 500...

# pacman -Syu

# pacman -Su

# pacman -S base-devel gcc



Close the shell and re-launch a couple times, git the pkgsrc tarball with the correct flags as per the readme for Cygwin, extract to C:\usr\pkgsrc. Added the following to bootstrap script, I haven't tested Windows < 10 (which still have Interix, but that's kernel-in-a-kernel like WSL2) and I'm assuming this will work on 11:



MINGW64_NT1*)

     is_root () {

          if id -nG | grep -q 'Administrators'; then

          return 0

     fi

     return 1

}

root_user=root

root_group=None

opsys=`uname -o`

machine_arch=`uname -m`

# only used for unprivileged builds.

groupsprog='id -g'

;;



But that isn't a proper is_root() -- admin privileges can be assigned to, or revoked from, any user. We only want the actual administrator account to root-build pkgsrc, right? Also the wrong groupsprog. Get PATH sorted, then from cmd.exe:



C:\> wmic useraccount where name="%USERNAME%" get sid | awk '{print $NF}' FS=- | tr -dc '0-9'

500



500's the well-known SID marker for local sysadmin. But, I can't get this to work in non-MS shells, even if I use the literal username, without getting "Error: Invalid query" back from wmic. So I can't script it...? This is the sort of thing I'm after here... wmic.exe's in /Windows/System32/Wbem, awk.exe and tr.exe are in /usr/bin to make sysadmin life easier. I never got Interix working so smoothly.



# set PATH = "/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl"

# cd /usr/pkgsrc/pkgtools/bootstrap-mk-files/files/mods

# cp Cygwin.sys.mk Msys.sys.mk

# cp Cygwin.bsd.lib.mk Msys.bsd.lib.mk

# cd ../../../../bootstrap

# ./testbootstrap --unprivileged

...

===> building as unprivileged user username/197121



// ok, it recognized my OS, got username from whoami, and the random-# gid

// wmic can also tell us -544=Administrators, -545=Users, -547=Power Users etc.

// but, not at the end of the SID string where we find -500, or -1002 etc. if !root

// and, with the msys2-ucrt64 toolchain at least, ls -l always shows group=None

// building as root makes no difference, gid is still a random 6-digit #



...

===> running: (cd /usr/pkgsrc/bootstrap/work/bmake && /usr/bin/sh make-bootstrap.sh)

gcc -c -g -O2 -I. -I/usr/pkgsrc/bootstrap/work/bmake -DHAVE_CONFIG_H -DMAKE_NATIVE -DUSE_META -DBMAKE_PATH_MAX=1024 -DMAKE_VERSION="20200524" -DMACHINE="mingw64_nt-10.0-190453" -DPKGSRC_MACHINE_ARCH="x86_64" -D_PATH_DEFSYSPATH="/usr/pkgsrc/bootstrap/work/share/mk" -o main.o /usr/pkgsrc/bootstrap/work/bmake/main.c



// Here's where I'm stuck, this has gone off the rails because I don't know how to get

// -DMACHINE="x86_64-w64-mingw32" which should "just work" with mingw gcc


Home | Main Index | Thread Index | Old Index