Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't exec "proj": No such file or directory #499

Closed
shawnlaffan opened this issue Oct 3, 2024 · 7 comments
Closed

Can't exec "proj": No such file or directory #499

shawnlaffan opened this issue Oct 3, 2024 · 7 comments

Comments

@shawnlaffan
Copy link
Contributor

I've hit this error on a fresh Ubuntu 22.04.3 instance (via WSL2).

Can't exec "proj": No such file or directory at /home/shawn/.cpanm/work/1727936400.10110/PDL-2.093/Libtmp/Transform/Proj4/proj4.pd line 145.
ERROR from evaluation of /home/shawn/.cpanm/work/1727936400.10110/PDL-2.093/Libtmp/Makefile.PL: ERROR from evaluation of /home/shawn/.cpanm/work/1727936400.10110/PDL-2.093/Libtmp/Transform/Makefile.PL: ERROR from evaluation of /home/shawn/.cpanm/work/1727936400.10110/PDL-2.093/Libtmp/Transform/Proj4/Makefile.PL: proj -lP: No such file or directory at /home/shawn/.cpanm/work/1727936400.10110/PDL-2.093/Libtmp/Transform/Proj4/proj4.pd line 145.

The issue is that Alien::proj on this system is a share install. The proj utility is thus not in the system path and is not found.

my $text = do { open my $fh, '-|', qw(proj -lP) or die "proj -lP: $!"; local $/; <$fh> };

The fix is probably to check for Alien::proj->bin_dir and prepend it to the call if it is defined. Or it can be prepended to the path, which is currently done for Windows at Line 23.

@shawnlaffan
Copy link
Contributor Author

Actually, that line can be replaced by this:

my $text = Alien::proj->run_utility ("proj", "-lP");

The run_utility method works for either system or share installs.

@mohawk2
Copy link
Member

mohawk2 commented Oct 3, 2024

Perfect, I'll make that change now.

@mohawk2
Copy link
Member

mohawk2 commented Oct 3, 2024

Could you try HEAD with the above-linked change? If that works, could you then close this issue? Obviously #498 is a slightly different deal.

@shawnlaffan
Copy link
Contributor Author

This works now, but I should have added error checking to the suggested fix.

Something like this should do the trick:

my ($text, $stderr, $exit_code) = Alien::proj->run_utility ("proj", "-lP");
die "proj -lP error $exit_code. Error text is: $stderr" if $exit_code;

Errors should only happen when the installation has been messed with, e.g. system dependencies uninstalled after Alien::proj was built. Perhaps extra text could be added to that effect but I'll leave that call to you.

@mohawk2
Copy link
Member

mohawk2 commented Oct 4, 2024

I thought it would be too complicated to try to guess the cause of any such failure. I've gone for a compromise, where it always warns any stderr, but then dies if there was an error exit-code.

Do you think this is fixed now?

@shawnlaffan
Copy link
Contributor Author

That looks good to me.

@mohawk2
Copy link
Member

mohawk2 commented Oct 4, 2024

Great, and thanks for the help! Please close the issue :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants