k0kubun / hamlit

High Performance Haml Implementation
https://rubygems.org/gems/hamlit
Other
981 stars 59 forks source link

Can't compile hamlit with Rubinius #103

Closed mahemoff closed 7 years ago

mahemoff commented 7 years ago

Using rbx-3.73 on OSX, I see ST_CONTINUE and UNLIMITED_ARGUMENTS are undefined.

Building native extensions.  This could take a while...
ERROR:  Error installing hamlit:
        ERROR: Failed to build gem native extension.

creating Makefile

make "DESTDIR="
compiling hamlit.c
hamlit.c:153:3: warning: implicit declaration of function 'rb_ary_sort_bang' is invalid in C99 [-Wimplicit-function-declaration]
  rb_ary_sort_bang(buf);
  ^
hamlit.c:178:10: error: use of undeclared identifier 'ST_CONTINUE'
  return ST_CONTINUE;
         ^
hamlit.c:212:25: error: use of undeclared identifier 'ST_CONTINUE'
  if (!RTEST(v)) return ST_CONTINUE;
                        ^
hamlit.c:223:10: error: use of undeclared identifier 'ST_CONTINUE'
  return ST_CONTINUE;
         ^
hamlit.c:245:10: error: use of undeclared identifier 'ST_CONTINUE'
  return ST_CONTINUE;
         ^
hamlit.c:317:10: error: use of undeclared identifier 'ST_CONTINUE'
  return ST_CONTINUE;
         ^
hamlit.c:437:3: warning: implicit declaration of function 'rb_check_arity' is invalid in C99 [-Wimplicit-function-declaration]
  rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
  ^
hamlit.c:437:27: error: use of undeclared identifier 'UNLIMITED_ARGUMENTS'
  rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
                          ^
hamlit.c:448:27: error: use of undeclared identifier 'UNLIMITED_ARGUMENTS'
  rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
                          ^
hamlit.c:459:27: error: use of undeclared identifier 'UNLIMITED_ARGUMENTS'
  rb_check_arity(argc, 2, UNLIMITED_ARGUMENTS);
                          ^
hamlit.c:470:27: error: use of undeclared identifier 'UNLIMITED_ARGUMENTS'
  rb_check_arity(argc, 4, UNLIMITED_ARGUMENTS);
                          ^
2 warnings and 9 errors generated.
make: *** [hamlit.o] Error 1

make failed, exit code 2
k0kubun commented 7 years ago

Hmm, maybe I can fix this and I'll consider to do so.

By the way, all of them are also bugs of Rubinius's header for C API.

k0kubun commented 7 years ago

Ahhhh, while I did some work for that https://github.com/k0kubun/hamlit/pull/104, I remembered the fatal thing. Rubinius doesn't provide ripper https://github.com/rubinius/rubinius/issues/2377.

Hamlit uses Ripper to parse Hash literal statically, thus it's very hard to port it. And personally, I don't like to use parser gem because (1) it is not standard library and requires additional installation effort, (2) it takes cost to update the gem version manually and otherwise it prints noisy warnings in not-supported Ruby versions.

k0kubun commented 7 years ago

I recommend you to use Haml 5.0.0.beta.2 instead. I did many improvements like https://github.com/haml/haml/pull/904 for Haml, keeping backward compatibility.

Hamlit is designed to have better performance than Slim. I'm maintaining Haml for various compatibility for many other use cases, including ones like you.

I'll support Rubinius in Hamlit once it implements Ripper.

mahemoff commented 7 years ago

I see. I had similar issues with some other native libs too, so can't use Rubinius for now anyway. Thanks for checking it @k0kubun