External Email - Use Caution        

Hi,

Thanks for your response. Yes: the errors appear for the individual commands specified, for example:


alex@fmri-proc1:~$ mri_ca_label --help
error: No such file or directory
error: Could not set locale
sysname  Linux
hostname fmri-proc1
machine  x86_64

setenv SUBJECTS_DIR /data/working/freesurfer7/subjects
cd /home/alex
mri_ca_label --help

error: No such file or directory
error: Could not set locale
error: No such file or directory
error: Could not set locale
                                Help

[... normal help output follows]


alex@fmri-proc1:~$ mri_ca_normalize --help
error: No such file or directory
error: Could not set locale
error: No such file or directory
error: Could not set locale
error: No such file or directory
error: Could not set locale
                                Help
[... normal help output follows]

Our standard set of locales (note, no en_US variant):

alex@fmri-proc1:~$ locale -a
C
C.UTF-8
de_DE.utf8
en_AU.utf8
nb_NO.utf8
nn_NO.utf8
pl_PL.utf8
POSIX

Adding en_US.UTF-8, the errors go away:

alex@fmri-proc1:~$ sudo /bin/bash -c 'echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; locale-gen'
alex@fmri-proc1:~$ mri_ca_normalize --help
                                Help
[...normal help output...]


I'll re-iterate that the commands run to completion either way, so the problem is likely more aesthetic than anything else.

recon-all loops over a set of allinfocmds towards the start of the process; adding a line of debug info to the loop around line 703 yields the following (which is where my previous list of affected commands was derived); ARC prefix in the output denotes my additions. Note that some individual commands present the error multiple times; there's no obvious difference in library dependencies (reported by ldd) between these cases, so I believe this fault probably arises internally and not from any external dependency.


alex@fmri-proc1:~$ env SUBJECTS_DIR=/working/alex/fs_test /opt/freesurfer7/bin/recon-ac -i /data/current/xxxx/002_struct_T1.nii -subjid xxxx -all
Subject Stamp: freesurfer-linux-centos7_x86_64-7.1.1-20200723-8b40551
Current Stamp: freesurfer-linux-centos7_x86_64-7.1.1-20200723-8b40551
INFO: SUBJECTS_DIR is /working/alex/fs_test
Actual FREESURFER_HOME /opt/freesurfer7
Linux fmri-proc1 4.9.110-arc #1 SMP Tue Aug 14 17:45:49 CEST 2018 x86_64 GNU/Linux
ARC: 'lta_convert'
ARC: 'mri_and'
ARC: 'mri_annotation2label'
ARC: 'mri_aparc2aseg'
ARC: 'mri_surf2volseg'
ARC: 'mri_binarize'
ARC: 'mri_ca_label'
error: No such file or directory
error: Could not set locale
ARC: 'mri_ca_normalize'
error: No such file or directory
error: Could not set locale
ARC: 'mri_ca_register'
error: No such file or directory
error: Could not set locale
error: No such file or directory
error: Could not set locale
error: No such file or directory
error: Could not set locale
ARC: 'mri_cc'
ARC: 'mri_compute_overlap'
ARC: 'mri_compute_seg_overlap'
ARC: 'mri_concat'
ARC: 'mri_concatenate_lta'
ARC: 'mri_convert'
error: No such file or directory
error: Could not set locale
error: No such file or directory
error: Could not set locale
error: No such file or directory
error: Could not set locale
ARC: 'mri_diff'
ARC: 'mri_edit_wm_with_aseg'
ARC: 'mri_em_register'
error: No such file or directory
error: Could not set locale
ARC: 'mri_fill'
ARC: 'mri_fuse_segmentations'
ARC: 'mri_fwhm'
ARC: 'mri_gcut'
ARC: 'mri_info'
ARC: 'mri_label2label'
ARC: 'mri_label2vol'
ARC: 'mri_log_likelihood'
ARC: 'mri_mask'
ARC: 'mri_matrix_multiply'
ARC: 'mri_normalize'
ARC: 'mri_normalize_tp2'
ARC: 'mri_or'
ARC: 'mri_relabel_hypointensities'
ARC: 'mri_relabel_nonwm_hypos'
ARC: 'mri_remove_neck'
error: No such file or directory
error: Could not set locale
error: No such file or directory
error: Could not set locale
ARC: 'mri_robust_register'
ARC: 'mri_robust_template'
ARC: 'mris_anatomical_stats'
ARC: 'mris_ca_label'
ARC: 'mris_calc'
error: No such file or directory
error: Could not set locale
error: No such file or directory
error: Could not set locale
ARC: 'mris_convert'
ARC: 'mris_curvature'
ARC: 'mris_curvature_stats'
ARC: 'mris_diff'
ARC: 'mris_divide_parcellation'
ARC: 'mri_segment'
ARC: 'mri_segstats'
ARC: 'mris_euler_number'
ARC: 'mris_fix_topology'
ARC: 'mris_topo_fixer'
ARC: 'mris_jacobian'
ARC: 'mris_label2annot'
ARC: 'mris_left_right_register'
ARC: 'mris_place_surface'
ARC: 'mrisp_paint'
ARC: 'mris_register'
ARC: 'mris_smooth'
ARC: 'mris_sphere'
ARC: 'mris_surface_stats'
ARC: 'mri_stats2seg'
ARC: 'mris_thickness'
ARC: 'mris_thickness_diff'
ARC: 'mris_topo_fixer'
ARC: 'mri_surf2surf'
ARC: 'mri_surf2vol'
ARC: 'mri_surfcluster'
ARC: 'mris_volmask'
ARC: 'mri_tessellate'
ARC: 'mri_vol2surf'
ARC: 'mri_vol2vol'
ARC: 'mri_voldiff'
ARC: 'mri_watershed'
ARC: 'tkregister2_cmdl'


Best regards,
Alex.


On 12/10/20 22:59, fsbuild wrote:
Hello Alex,

After you have set FREESURFER_HOME and source’d the shell setup script, please try running the binaries you suspect directly from the command line, e.g., with —help option, and see if you get the same error, e.g.

$ mri_ca_label —help
<help output deleted>

$ mri_ca_normalize —help
<help output deleted>

It would also be interesting to know what locales have been setup/installed on your machine from the output of the locale command, which might display something like,

$ locale -a
C
C.utf8
en_AU
en_AU.utf8
en_BW
en_BW.utf8
en_CA
en_CA.utf8
en_DK
en_DK.utf8
en_GB
en_GB.iso885915
en_GB.utf8
… many other countries …
POSIX

- R.

On Oct 12, 2020, at 06:58, Alex Craven <alex.craven@uib.no> wrote:

        External Email - Use Caution        


Greetings,

Several binaries in the Freesurfer 7.1.1 release appear to ignore (or misinterpret) system-wide locale settings. This causes a large number of errors to be reported throughout the recon process, particularly on startup. The commands appear to complete successfully despite the reported errors.

The errors are displayed as:

error: No such file or directory
error: Could not set locale

...repeated dozens of times.


A probably not exhaustive list of affected components:

  • mri_ca_label
  • mri_ca_normalize
  • mri_ca_register
  • mri_convert
  • mri_em_register
  • mri_remove_neck
  • mris_calc


strace output for one such command suggests that it's attempting to load the en_US locale, on a system where that is locale is not configured, and where system-wide settings indicate the something else should be used (eg: LANG=en_AU.UTF-8)


openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=8896640, ...}) = 0
mmap(NULL, 8896640, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f727c65d000
close(3)                                = 0
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2995, ...}) = 0
read(3, "# Locale name alias data base.\n#"...., 4096) = 2995
read(3, "", 4096)                       = 0
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/locale/en_US/LC_NUMERIC", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en/LC_NUMERIC", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_NUMERIC", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en.utf8/LC_NUMERIC", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
write(2, "error: ", 7error: )                  = 7
write(2, "No such file or directory", 25No such file or directory) = 25
write(2, "\n", 1
)                       = 1
write(2, "error: ", 7error: )                  = 7
write(2, "Could not set locale\0", 21Could not set locale^@)  = 21
write(2, "\n", 1
)                       = 1


System info:

Debian 9.1.0 base system, using freesurfer-linux-centos7_x86_64-7.1.1

Linux fmri-proc1 4.9.110-arc #1 SMP Tue Aug 14 17:45:49 CEST 2018 x86_64 GNU/Linux


Workaround:

Generating the en_US.UTF-8 locale, by adding/uncommenting the line "en_US.UTF-8 UTF-8" in /etc/locale.gen and re-running locale-gen effectively hides this problem.


Best regards,

Alex.

_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer