msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.25k stars 1.21k forks source link

gcc trying to write a temporary file to C:\WINDOWS\ when no env #5794

Closed Hattshire closed 3 years ago

Hattshire commented 5 years ago

This thing came up when trying to build MXE using msys2's mingw64, however something odd happens when trying to 'make' anything: for some reason instead of compiling or giving a compiler/pre-processor/etc error, it bails out with:

Cannot create temporary file in C:\WINDOWS\: Permission denied


Reproducing:

Way 1: clone mxe/mxe.git@github and run make nonet-lib

Way 2: Tracing down the making hole I came across this: /usr/bin/env --ignore-environment /mingw64/bin/gcc /home It should complain about "/home" being a dir, missing libraries(as msys's /usr/bin/gcc does) or something, but it errors on the tempfile thing 😢.


Here is the environment I have from within the makefile (for Way 1)

LANG=en_US.UTF-8
MAKE_TERMOUT=/dev/pty1
MFLAGS=
SYSTEMROOT=C:\WINDOWS
PWD=/home/user/lightspark-0.8.1/build/mxe
HOME=/home/user
TERM=vt340
SHELL=/usr/bin/bash
WINDIR=C:\WINDOWS
MAKELEVEL=1
SHLVL=1
MAKE_TERMERR=/dev/pty1
ACLOCAL_PATH=/mingw64/share/aclocal:/usr/share/aclocal
MSYSTEM=MINGW64
PATH=/home/user/lightspark-0.8.1/build/mxe/usr/x86_64-pc-mingw64/bin:/home/user/lightspark-0.8.1/build/mxe/usr/bin:/mingw64/bin:/mingw64/bin/site_perl/5.28.0:/mingw64/bin/vendor_perl:/mingw64/bin/core_perl:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/opt/xtensa-esp32-elf/bin
MAKEFLAGS=
_=/usr/bin/env
revelator commented 4 years ago

newer had any luck building MXE with MSYS2 you are probably better of building in win10 wsl environment since this package is geared more towards crosscompiling from linux to windows.

Not really sure why you need it though since Msys2 allready supports most of what MXE holds ?.

MyNameIsTrez commented 2 years ago

I was also getting Cannot create temporary file in C:\WINDOWS\: Permission denied whenever C:/msys64/mingw64/bin/gcc.exe was being run by a Makefile, where I manually ran the Makefile with C:/msys64/usr/bin/make.exe inside of a terminal.

Whenever I manually ran C:/msys64/mingw64/bin/gcc.exe inside of a terminal it ran just fine however!

I just had to go into VS Code's properties to always run it as an administrator, see here.

thautwarm commented 2 months ago

Rebooting my machine works for this issue..