Skip to content

[BUG]: ‘Monolithic' McStas/McXtrace Windows installers misses miniconda3\bin in path #2310

@willend

Description

@willend

Describe the bug
Adrien Perrichon from ESS has reported issues running with the ‘Monolithic' McStas Windows installer and not being able to compile with NCrystal

Analysing the situation I found that C:\mccode-x.y.z\miniconda3\bin is missing in the *.bat / etc. path

Document steps to reproduce the bug
Steps to reproduce the behavior:

  1. Download and install McStas-Metapackage-3.6.5-win64.exe
  2. Run the NCrystal_example.instr
  3. Compilation fails with:
mcrun -c NCrystal_example.instr --verbose
INFO: No output directory specified (--dir)
INFO: Using directory: "NCrystal_example_20260212_160611"
INFO: Regenerating c-file: NCrystal_example.c
WARNING: Full-path code-generator "C:\mcstas-3.6.5\bin\mcstas" not found!!
WARNING: Attempting replacement by "mcstas"
DEBUG: CMD: mcstas -t -o NCrystal_example.c NCrystal_example.instr

-----------------------------------------------------------

Generating single GPU kernel or single CPU section layout:
-> SPLIT N at component monochromator
-> SPLIT N at component powder_sample

-----------------------------------------------------------

Generating GPU/CPU -DFUNNEL layout:
Component monochromator is NOACC, CPUONLY=1
-> FUNNEL mode enabled, SPLIT within buffer.
-> SPLIT within buffer at component monochromator
-> GPU kernel from component mono_out
Component powder_sample is NOACC, CPUONLY=1
-> FUNNEL mode enabled, SPLIT within buffer.
-> SPLIT within buffer at component powder_sample
-> GPU kernel from component powder_pattern_detc

-----------------------------------------------------------
CFLAGS= @NCRYSTALFLAGS@ -DFUNNEL
DEBUG: CMD: mcstas finished
INFO: Recompiling: NCrystal_example.exe
   --> launching cmd: ncrystal-config --show libdir
Traceback (most recent call last):
  File "C:\mcstas-3.6.5\bin\\../lib/tools\Python\mcrun\mcrun.py", line 654, in <module>
    main()
    ~~~~^^
  File "C:\mcstas-3.6.5\bin\\../lib/tools\Python\mcrun\mcrun.py", line 540, in main
    mcstas.prepare(options)
    ~~~~~~~~~~~~~~^^^^^^^^^
  File "C:\mcstas-3.6.5\lib\tools\Python\mcrun\mccode.py", line 305, in prepare
    flags = mccodelib.cflags.evaluate_dependency_str(flags, options.verbose)
  File "C:\mcstas-3.6.5\lib\tools\Python\mcrun\..\mccodelib\cflags.py", line 99, in evaluate_dependency_str
    s = evalmarker( s, s_cmd, evalfct_cmd )
  File "C:\mcstas-3.6.5\lib\tools\Python\mcrun\..\mccodelib\cflags.py", line 55, in evalmarker
    return before + evalfct(content) + evalmarker(after,startmarker,evalfct)
                    ~~~~~~~^^^^^^^^^
  File "C:\mcstas-3.6.5\lib\tools\Python\mcrun\..\mccodelib\cflags.py", line 90, in evalfct_cmd
    raise RuntimeError(errmsg())
RuntimeError: Errors encountered while executing cmd: ncrystal-config --show libdir

Workaround
Adding to the shell path resolves the issue:

set PATH=%PATH%;C:\mcstas-3.6.5\miniconda3\bin
mcrun -c NCrystal_example.instr
INFO: No output directory specified (--dir)
INFO: Using directory: "NCrystal_example_20260212_160725"
INFO: Regenerating c-file: NCrystal_example.c
WARNING: Full-path code-generator "C:\mcstas-3.6.5\bin\mcstas" not found!!
WARNING: Attempting replacement by "mcstas"

-----------------------------------------------------------

Generating single GPU kernel or single CPU section layout:
-> SPLIT N at component monochromator
-> SPLIT N at component powder_sample

-----------------------------------------------------------

Generating GPU/CPU -DFUNNEL layout:
Component monochromator is NOACC, CPUONLY=1
-> FUNNEL mode enabled, SPLIT within buffer.
-> SPLIT within buffer at component monochromator
-> GPU kernel from component mono_out
Component powder_sample is NOACC, CPUONLY=1
-> FUNNEL mode enabled, SPLIT within buffer.
-> SPLIT within buffer at component powder_sample
-> GPU kernel from component powder_pattern_detc

-----------------------------------------------------------
CFLAGS= @NCRYSTALFLAGS@ -DFUNNEL
INFO: Recompiling: NCrystal_example.exe
INFO: ===
Instrument parameters for NCrystal_example (NCrystal_example.instr)
Set value of instrument parameter sample_cfg (string) [default='Y2O3_sg206_Yttrium_Oxide.ncmat;density=0.9x']:

[NCrystal_example] Initialize
NCrystal: McStas sample component(s) are using version 4.2.12 of the NCrystal library.
*** TRACE end ***

Save [NCrystal_example]
Detector: powder_pattern_detc_I=5.92655e-011 powder_pattern_detc_ERR=1.82705e-013 powder_pattern_detc_N=105307 "powder_pattern_detc.dat"

Finally [NCrystal_example: NCrystal_example_20260212_160725]. Time: 8 [s]
INFO: Placing instr file copy NCrystal_example.instr in dataset NCrystal_example_20260212_160725
INFO: Placing generated c-code copy NCrystal_example.c in dataset NCrystal_example_20260212_160725

OS and McStas/McXtrace version (please complete the following information):

  • OS: [Windows 11]
  • McCode variant [probably both of McStas, McXtrace]
  • Version [3.6.5 ‘Monolithic installer only']

Additional context
Likely just a matter of a small adjustment in Locations.cmake / PlatformDefaults.cmake

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions