Module path lookup isn't robust enough for NixOS and some "portable" setups (Bug #872)
Description
Hello Alexis,
AMC on NixOS behaves like a "portable" distribution, where the whole package (including libs, docs, and so on) is stored isolated in a single directory (this is how Nix/NixOS works: there is no global state, no globally shared modules, but a "store" of packages and a ton of symlinks and env variables to bring all that together).
This causes an issue: if for some reason, the system on which AMC runs has a /lib
directory, AMC will try to load its modules there, and fail. Changing the MODSDIR
variable at compilation doesn't help, because it also changes the installation directory's name, but AFAICT the main executable hardcodes the lib
name:
51 $mods_dir=catfile($base_dir,'lib');
Idk enough Perl to offer a patch, but a simple fix could be to improve the test at line 44:
44 if(! -d $mods_dir) {
By checking for the full path of, say, AMC-gui.pl
, so $MODSDIR/perl/AMC-gui.pl
Thanks!
Best regards,
Thibault