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

"rake ragel" fails with "ragel: -C is an invalid argument" #2207

Closed
junaruga opened this issue Mar 27, 2020 · 3 comments
Closed

"rake ragel" fails with "ragel: -C is an invalid argument" #2207

junaruga opened this issue Mar 27, 2020 · 3 comments

Comments

@junaruga
Copy link
Contributor

Describe the bug

A clear and concise description of what the bug is.

rake ragel fails like this.

$ touch ext/puma_http11/http11_parser.c

$ bundle exec rake ragel
ragel ext/puma_http11/http11_parser.rl -C -G2 -I ext/puma_http11 -o ext/puma_http11/http11_parser.c
ragel: -C is an invalid argument
rake aborted!
Could not build wrapper using Ragel (it failed or not installed?)
/home/jaruga/git/puma/Rakefile:24:in `rescue in block in <top (required)>'
/home/jaruga/git/puma/Rakefile:21:in `block in <top (required)>'
/home/jaruga/git/puma/.bundle/puma/ruby/2.7.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/usr/local/ruby-2.7.0/bin/bundle:23:in `load'
/usr/local/ruby-2.7.0/bin/bundle:23:in `<main>'

Caused by:
Command failed with status (1): [ragel ext/puma_http11/http11_parser.rl -C ...]
/home/jaruga/git/puma/Rakefile:22:in `block in <top (required)>'
/home/jaruga/git/puma/.bundle/puma/ruby/2.7.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/usr/local/ruby-2.7.0/bin/bundle:23:in `load'
/usr/local/ruby-2.7.0/bin/bundle:23:in `<main>'
Tasks: TOP => ragel => ext/puma_http11/http11_parser.c
(See full trace by running task with --trace)

Puma config:

Please copy-paste your Puma config AND your command line options here.

I think Puma config is not related to this issue.

To Reproduce

Please add reproduction steps here.

According to the whitequark/parser#317 , ragel >= 7.0.0.9 supports Ruby again.

$ ragel --version
Ragel State Machine Compiler version 7.0.0.12 May 2019
Copyright (c) 2001-2019 by Adrian Thurston
$ bundle install --path=.bundle/puma
$ bundle exec rake compile
$ touch ext/puma_http11/http11_parser.c
$ bundle exec rake ragel

Expected behavior

A clear and concise description of what you expected to happen.

bundle exec rake ragel is executed successfully.

Desktop (please complete the following information):

  • OS: Linux Fedora 31
  • Puma Version: The latest master branch: 0b737cce42746d8226701520f35685e0624e061b

Note

When I changed the ragel -C with ragel -R seeing the help, it failed with "ragel: -R is an invalid argument".

$ ragel --help
...
host language:
   -C                   C, C++, Obj-C or Obj-C++ (default)
                        All code styles supported.
   --asm --gas-x86-64-sys-v
                        GNU AS, x86_64, System V ABI.
                        Generated in a code style equivalent to -G2
   -D                   D           All code styles supported
   -Z                   Go          All code styles supported
   -A                   C#          -T0 -T1 -F0 -F1 -G0 -G1
   -J                   Java        -T0 -T1 -F0 -F1
   -R                   Ruby        -T0 -T1 -F0 -F1
...

$ git diff
diff --git a/Rakefile b/Rakefile
index 231be50b..c39547a5 100644
--- a/Rakefile
+++ b/Rakefile
@@ -19,7 +19,7 @@ task :ragel
 
 file 'ext/puma_http11/http11_parser.c' => ['ext/puma_http11/http11_parser.rl'] do |t|
   begin
-    sh "ragel #{t.prerequisites.last} -C -G2 -I ext/puma_http11 -o #{t.name}"
+    sh "ragel #{t.prerequisites.last} -R -G2 -I ext/puma_http11 -o #{t.name}"
   rescue
     fail "Could not build wrapper using Ragel (it failed or not installed?)"
   end
$ bundle exec rake ragel
ragel ext/puma_http11/http11_parser.rl -R -G2 -I ext/puma_http11 -o ext/puma_http11/http11_parser.c
ragel: -R is an invalid argument
rake aborted!
Could not build wrapper using Ragel (it failed or not installed?)
/home/jaruga/git/puma/Rakefile:24:in `rescue in block in <top (required)>'
/home/jaruga/git/puma/Rakefile:21:in `block in <top (required)>'
/home/jaruga/git/puma/.bundle/puma/ruby/2.7.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/usr/local/ruby-2.7.0/bin/bundle:23:in `load'
/usr/local/ruby-2.7.0/bin/bundle:23:in `<main>'

Caused by:
Command failed with status (1): [ragel ext/puma_http11/http11_parser.rl -R ...]
/home/jaruga/git/puma/Rakefile:22:in `block in <top (required)>'
/home/jaruga/git/puma/.bundle/puma/ruby/2.7.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/usr/local/ruby-2.7.0/bin/bundle:23:in `load'
/usr/local/ruby-2.7.0/bin/bundle:23:in `<main>'
Tasks: TOP => ragel => ext/puma_http11/http11_parser.c
(See full trace by running task with --trace)
@junaruga
Copy link
Contributor Author

I got the answer here.
whitequark/parser#317 (comment)

The workaround is to use Ragel version 7.0.0.9.

I also found this ticket on Fedora ragel package about this issue.
https://bugzilla.redhat.com/show_bug.cgi?id=1734038

@voxik
Copy link
Contributor

voxik commented Aug 7, 2020

I think this whole is misunderstanding. The upstream Ragel changed their CLI options and they have removed the -C option. So it it is removed from here, the newest Ragel can be used just fine (testing with 7.0.0.12).

But "Ruby support" is out of question, because the parser is in C not in Ruby.

@voxik
Copy link
Contributor

voxik commented Aug 7, 2020

BTW the -C option is still listed among options, while it is not recognized.

$ rpm -q ragel
ragel-7.0.0.12-4.fc33.x86_64

$ ragel -C ext/puma_http11/http11_parser.rl 
ragel: -C is an invalid argument

$ ragel -h
usage: ragel [options] file
general:
   -h, -H, -?, --help   Print this usage and exit
   -v, --version        Print version information and exit
   -o <file>            Write output to <file>
   -s                   Print some statistics and compilation info to stderr
   -d                   Do not remove duplicates from action lists
   -I <dir>             Add <dir> to the list of directories to search
                        for included an imported files
   --rlhc               Show the rlhc command used to compile
   --save-temps         Do not delete intermediate file during compilation
   --no-intermediate    Disable call to rlhc, leave behind intermediate
error reporting format:
   --error-format=gnu   file:line:column: message (default)
   --error-format=msvc  file(line,column): message
fsm minimization:
   -n                   Do not perform minimization
   -m                   Minimize at the end of the compilation
   -l                   Minimize after most operations (default)
   -e                   Minimize after every operation
visualization:
   -V                   Generate a dot file for Graphviz
   -p                   Display printable characters on labels
   -S <spec>            FSM specification to output (for graphviz output)
   -M <machine>         Machine definition/instantiation to output (for
                        graphviz output)
host language:
   -C                   C, C++, Obj-C or Obj-C++ (default)
                        All code styles supported.
   --asm --gas-x86-64-sys-v
                        GNU AS, x86_64, System V ABI.
                        Generated in a code style equivalent to -G2
   -D                   D           All code styles supported
   -Z                   Go          All code styles supported
   -A                   C#          -T0 -T1 -F0 -F1 -G0 -G1
   -J                   Java        -T0 -T1 -F0 -F1
   -R                   Ruby        -T0 -T1 -F0 -F1
   -O                   OCaml       -T0 -T1 -F0 -F1
   -U                   Rust        -T0 -T1 -F0 -F1
   -Y                   Julia       -T0 -T1 -F0 -F1
   -K                   Crack       -T0 -T1 -F0 -F1
   -P                   JavaScript  -T0 -T1 -F0 -F1
line directives:
   -L                   Inhibit writing of #line directives
code style:
   -T0                  Binary search (default)
   -T1                  Binary search with expanded actions 
   -F0                  Flat table
   -F1                  Flat table with expanded actions
   -G0                  Switch-driven
   -G1                  Switch-driven with expanded actions
   -G2                  Goto-driven with expanded actions
large machines:
   --integral-tables    Use integers for table data (default)
   --string-tables      Encode table data into strings for faster host lang
                        compilation
analysis:
   --prior-interaction          Search for condition-based general repetitions
                                that will not function properly due to state mod
                                overlap and must be NFA reps. 
   --conds-depth=D              Search for high-cost conditions inside a prefix
                                of the machine (depth D from start state).
   --state-limit=L              Report fail if number of states exceeds this
                                during compilation.
   --breadth-check=E1,E2,..     Report breadth cost of named entry points and
                                the start state.
   --input-histogram=FN         Input char histogram for breadth check. If
                                unspecified a flat histogram is used.
testing:
   --kelbt-frontend        Compile using original ragel + kelbt frontend
                           Requires ragel be built with ragel + kelbt support
   --colm-frontend         Compile using a colm-based recursive descent
                           frontend
   --reduce-frontend       Compile using a colm-based reducer (default)
   --var-backend           Use the variable-based backend even if the host lang
                           supports goto-based
   --supported-host-langs  Show supported host languages by command line arg
   --supported-frontends   Show supported frontends
   --supported-backends    Show supported backends
   --force-libragel        Cause mainline to behave like libragel

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

3 participants