5

When I run a perl raku command-line program a lib directory (and precomp files) appear in the current working directory - how can I prevent/avoid this?

user2145475
  • 657
  • 3
  • 11
  • 1
    Can you give some pointers to what you're running? Generally Perl6 won't create a `/lib` folder by itself (Precompilation files yes but not `/lib`) – Scimon Proctor Mar 26 '19 at 09:42
  • 1
    I'm running the "jmp" command which is this module: https://github.com/nige123/jmp.nigelhamilton.com: `shell> which jmp ` returns `/home/nige/.rakudobrew/bin/jmp` – user2145475 Mar 26 '19 at 20:38
  • 1
    Looking at the code for that on my phone and the `jmp` script has use lib "lib" at the top. This is probably the issue. Tomorrow I shall look into it in more detail and include a patch. – Scimon Proctor Mar 26 '19 at 20:43

2 Answers2

4

Why would you want to do that? They are, effectively, precompilation files that will later on be used when you run it again. You can prevent from adding them to the repository by adding .precomp to your .gitignore file, but they are useful files that are inherent to running Raku. As indicated in this answer, that might be due to . being included in your PERL6LIB variable. You can delete it from there to prevent that from happening in the current directory. It can still happen somewhere else, though.

jjmerelo
  • 22,578
  • 8
  • 40
  • 86
  • 2
    Thanks @jjmerelo - I checked the contents of PERL6LIB and no `.`. I would like the benefits of precompilation but not the spurious lib/ directory. I suppose I'd like to make a feature request that precompilation files are stored under the user's $HOME/.precomp-files-go-here/ – user2145475 Mar 26 '19 at 07:01
  • 2
    @user2145475 the "lib" directory is weird, though. What are you exactly running? – jjmerelo Mar 26 '19 at 08:14
  • 4
    it's possible that there's a "lib" in PERL6LIB instead, which would probably create the lib folder to put a .precomp into it. I would recommend having PERL6LIB empty by default and only set it for very specific situations – timotimo Mar 26 '19 at 10:16
  • 2
    In my experience I don't see any "lib" directory when I tun a program normally, while I see that when I run a program through the debugger and quit it before it reaches its natural end. It also appears when the program (or Moar) crashes, even when it's run in the debugger. (Edit: my PERL6LIB is empty) – Fernando Santagata Apr 02 '19 at 09:23
3

Rakudo Perl 6 uses a chain of repositories for loading modules. If you load a module and it isn't in the top repository it will look in the next one, and so on.

It will also precompile modules for faster loading the second time they are used.

Typically if you install a module it will be used once in such a way that its precomp file will be placed in the repository where it is installed.
If it's not in there when you go to use it a new one will be created.
Since it doesn't necessarily know what other modules it relies on, this precomp file is always placed in the head of the repository chain.

So you obviously have a module that doesn't have a precomp, and you have ./lib somehow at the top of your repository chain.

It could be in PERL6LIB, a -I command-line argument, or a use lib './lib'; line in your code.

You could try reinstalling the module to see if that stops it from happening.

Brad Gilbert
  • 33,846
  • 11
  • 78
  • 129