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

luajit: Expose build options, enable JIT debug module #79194

Merged
merged 1 commit into from Feb 15, 2020

Conversation

Shados
Copy link
Member

@Shados Shados commented Feb 4, 2020

Motivation for this change

This change exposes various build options from luajit's makefile, many of which are useful when debugging Lua scripts. I've also enabled installing the JIT debug module files by default (used for -jbc, -jv, and -jdump CLI options).

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@teto

@teto
Copy link
Member

teto commented Feb 12, 2020

sorry for delay, I don't think we have to map every option in nix. Like not sure enableJIT would be common enough to warrant its own flag ?
Valgrind and Gdb could go under the same flag Debug. One cqn override XCFLAGS.

@Shados
Copy link
Member Author

Shados commented Feb 13, 2020

sorry for delay, I don't think we have to map every option in nix. Like not sure enableJIT would be common enough to warrant its own flag ?

There's no real reason not to expose all the options, though. They're not likely to change. As for enableJIT: running without the JIT compiler makes some debugging scenarios easier.

Valgrind and Gdb could go under the same flag Debug.

Come to think of it, pretty sure the valgrind option won't work as-is, IIRC it needs the valgrind header files to build. I'll have a poke at that later, but it should definitely be separate: the GDB JIT option causes a performance impact (even without GDB hooked up), and is mainly useful for debugging LuaJIT itself (whereas the valgrind option is potentially useful for debugging leaks in Lua scripts in general, at least insofar as ones that use C libraries).

'';

configurePhase = false;

buildFlags = [
"amalg" # Build highly optimized version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a downside to this ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my knowledge, the only downside is that the build process with amalg enabled consumes more memory. amalg is the recommended target for binary distribution.

@teto
Copy link
Member

teto commented Feb 13, 2020

There's no real reason not to expose all the options, though. They're not likely to change.

It makes the nix derivation harder to read for a usecase that may benefit 1% of the use cases. But you convinced me anyway and as you've been pretty helpful in the past, I know you'll make good use of these options. Let's fix the valgrind option and merge.

@Shados
Copy link
Member Author

Shados commented Feb 14, 2020

OK, fixed up the valgrind option.

@teto teto merged commit e34db5a into NixOS:master Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants