MiKTeX / miktex-packaging

the MiKTeX package factory
MIT License
19 stars 6 forks source link

How to set MIKTEX_PREFERMIKTEXGHOSTSCRIPT=no #309

Closed pomomayu closed 1 year ago

pomomayu commented 1 year ago

The issue below addresses the known problem of MikTex using the older bundled version of Ghostscript, and instructs the user to set MIKTEX_PREFERMIKTEXGHOSTSCRIPT=no if they prefer using the system-wide installation of Ghostscript.

https://github.com/MiKTeX/miktex-packaging/issues/275

But how is this value set? Using the initexmf utility in an Adminstrator Powershell terminal with -set-config-value=MIKTEX_PREFERMIKTEXGHOSTSCRIPT=no fails with or without the --admin flag.

This prevents Asymptote from compiling .asy files as MikTex uses the older Ghostscript v9.25 as shown:

MiKTeX GPL Ghostscript 9.25: Unrecoverable error, exit code 1 _shipout(prefix,f,currentpatterns,format,wait,view,t);

Strangely all of this was tested on a dummy Windows 10 laptop and the system-wide Ghostscript v9.56.1 was set without any configuration. But now on a different PC with Windows 10 MikTex chooses the bundled Ghostscript v9.25.

How do we set MIKTEX_PREFERMIKTEXGHOSTSCRIPT=no?

OS: Windows 10 Miktex v22.10 Asymptote v2.83 Ghostscript v9.56.1

Command: initexmf --admin --set-config-value=MIKTEX_PREFERMIKTEXGHOSTSCRIPT=no

Terminal output: Sorry, but "MiKTeX Configuration Utility" did not succeed. The log file hopefully contains the information to get MiKTeX going again: C:\ProgramData\MiKTeX\miktex\log\initexmf_admin.log

Admin log output: 2022-11-27 13:23:49,730-0800 INFO initexmf - this is MiKTeX Configuration Utility 5.2 (MiKTeX 22.10) 2022-11-27 13:23:49,730-0800 INFO initexmf - this process (4680) started by powershell in directory C:\WINDOWS\system32 with command line: "C:\Program Files\MiKTeX\miktex\bin\x64\initexmf.exe" --admin --set-config-value=MIKTEX_PREFERMIKTEXGHOSTSCRIPT=no 2022-11-27 13:23:49,730-0800 INFO initexmf.core - turning on administrator mode 2022-11-27 13:23:49,730-0800 INFO initexmf - Operating on the shared (system-wide) MiKTeX setup 2022-11-27 13:23:49,730-0800 INFO initexmf - Setting config value: []MIKTEX_PREFERMIKTEXGHOSTSCRIPT=no 2022-11-27 13:23:49,734-0800 FATAL initexmf.core - The configuration value could not be changed. Possible reason: an environment variable definition is in the way. 2022-11-27 13:23:49,734-0800 FATAL initexmf.core - Data: valueName="MIKTEX_PREFERMIKTEXGHOSTSCRIPT" 2022-11-27 13:23:49,734-0800 FATAL initexmf.core - Source: Libraries\MiKTeX\Core\Session\config.cpp:482 2022-11-27 13:23:49,780-0800 FATAL initexmf - The configuration value could not be changed. Possible reason: an environment variable definition is in the way. 2022-11-27 13:23:49,780-0800 FATAL initexmf - Info: valueName="MIKTEX_PREFERMIKTEXGHOSTSCRIPT" 2022-11-27 13:23:49,780-0800 FATAL initexmf - Source: Libraries\MiKTeX\Core\Session\config.cpp 2022-11-27 13:23:49,780-0800 FATAL initexmf - Line: 482 2022-11-27 13:23:49,787-0800 INFO initexmf - this process (4680) finishes with exit code 1

edocevoli commented 1 year ago

You should try `initexmf --admin --set-config-value=[COre]PREFERMIKTEXGHOSTSCRIPT=no