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

sequel_pg: error: no member named 'flags' in 'struct RBasic' #1440

Closed
deepj opened this issue Oct 29, 2018 · 8 comments
Closed

sequel_pg: error: no member named 'flags' in 'struct RBasic' #1440

deepj opened this issue Oct 29, 2018 · 8 comments
Assignees
Milestone

Comments

@deepj
Copy link

deepj commented Oct 29, 2018

I've tried to install sequel_pg on truffle-ruby-1.0.0.rc8, and I got this issue

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

    current directory: ~/.gem/truffleruby/2.4.4/gems/sequel_pg-1.11.0/ext/sequel_pg
~/.rubies/truffleruby-1.0.0-rc8/bin/truffleruby -r ./siteconf20181029-47518-10xa5ts.rb extconf.rb
checking for -lpq... yes
checking for libpq-fe.h... yes
checking for PQsetSingleRowMode()... yes
checking for timegm()... yes
creating Makefile

current directory: ~/.gem/truffleruby/2.4.4/gems/sequel_pg-1.11.0/ext/sequel_pg
make "DESTDIR=" clean

current directory: ~/.gem/truffleruby/2.4.4/gems/sequel_pg-1.11.0/ext/sequel_pg
make "DESTDIR="
compiling sequel_pg.c
sequel_pg.c:30:9: warning: 'ntohll' macro redefined [-Wmacro-redefined]
#define ntohll(c) ((uint64_t)( \
        ^
/usr/include/sys/_endian.h:140:9: note: previous definition is here
#define ntohll(x)       __DARWIN_OSSwapInt64(x)
        ^
sequel_pg.c:185:11: error: no member named 'flags' in 'struct RBasic'
  int i = ENCODING_GET_INLINED(val);
          ^~~~~~~~~~~~~~~~~~~~~~~~~
~/.rubies/truffleruby-1.0.0-rc8/lib/cext/include/ruby/encoding.h:51:35: note: expanded from macro 'ENCODING_GET_INLINED'
#define ENCODING_GET_INLINED(obj) RB_ENCODING_GET_INLINED(obj)
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
~/.rubies/truffleruby-1.0.0-rc8/lib/cext/include/ruby/encoding.h:44:25: note: expanded from macro 'RB_ENCODING_GET_INLINED'
    (int)((RBASIC(obj)->flags & RUBY_ENCODING_MASK)>>RUBY_ENCODING_SHIFT)
           ~~~~~~~~~~~  ^
sequel_pg.c:278:15: warning: expression result unused [-Wunused-value]
  RB_GC_GUARD(array);
              ^~~~~
~/.rubies/truffleruby-1.0.0-rc8/lib/cext/include/ruby/ruby.h:528:25: note: expanded from macro 'RB_GC_GUARD'
#define RB_GC_GUARD(v) (v)
                        ^
sequel_pg.c:350:15: warning: expression result unused [-Wunused-value]
  RB_GC_GUARD(buf);
              ^~~
~/.rubies/truffleruby-1.0.0-rc8/lib/cext/include/ruby/ruby.h:528:25: note: expanded from macro 'RB_GC_GUARD'
#define RB_GC_GUARD(v) (v)
                        ^
3 warnings and 1 error generated.
make: *** [sequel_pg.bc] Error 1

make failed, exit code 2

Gem files will remain installed in ~/.gem/truffleruby/2.4.4/gems/sequel_pg-1.11.0 for inspection.
Results logged to ~/.gem/truffleruby/2.4.4/extensions/x86_64-darwin/2.4.0/sequel_pg-1.11.0/gem_make.out
@eregon
Copy link
Member

eregon commented Oct 30, 2018

sequel_pg directly calls ENCODING_GET_INLINED and it looks like we shoud redefine RB_ENCODING_GET_INLINED to use our own logic to fix this.

Should be a pretty trivial fix if anyone wants to give it a try.

@eregon eregon added the cexts label Oct 30, 2018
@deepj
Copy link
Author

deepj commented Nov 5, 2018

This seems to be similar issue like this with agoo.

$ gem install agoo
Fetching: agoo-2.5.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing agoo:
	ERROR: Failed to build gem native extension.

    current directory: ~/.gem/truffleruby/2.4.4/gems/agoo-2.5.1/ext/agoo
~/.rubies/truffleruby-1.0.0-rc8/bin/truffleruby -r ./siteconf20181105-91312-10xa5ts.rb extconf.rb
creating Makefile
>>>>> Created Makefile for truffleruby version 2.4.4 on x86_64-darwin <<<<<

current directory: ~/.gem/truffleruby/2.4.4/gems/agoo-2.5.1/ext/agoo
make "DESTDIR=" clean

current directory: ~/.gem/truffleruby/2.4.4/gems/agoo-2.5.1/ext/agoo
make "DESTDIR="
compiling agoo.c
compiling base64.c
compiling bind.c
compiling con.c
compiling debug.c
compiling dtime.c
compiling err.c
compiling error_stream.c
compiling hook.c
compiling http.c
compiling log.c
compiling page.c
compiling pub.c
compiling queue.c
compiling rack_logger.c
compiling request.c
compiling res.c
compiling response.c
compiling rhook.c
compiling rlog.c
compiling rserver.c
compiling server.c
compiling sha1.c
compiling sse.c
compiling sub.c
compiling subject.c
compiling text.c
compiling upgraded.c
upgraded.c:186:6: error: no member named 'flags' in 'struct RBasic'
        if (RB_ENCODING_IS_ASCII8BIT(msg)) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~/.rubies/truffleruby-1.0.0-rc8/lib/cext/include/ruby/encoding.h:47:40: note: expanded from macro 'RB_ENCODING_IS_ASCII8BIT'
#define RB_ENCODING_IS_ASCII8BIT(obj) (RB_ENCODING_GET_INLINED(obj) == 0)
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
~/.rubies/truffleruby-1.0.0-rc8/lib/cext/include/ruby/encoding.h:44:25: note: expanded from macro 'RB_ENCODING_GET_INLINED'
    (int)((RBASIC(obj)->flags & RUBY_ENCODING_MASK)>>RUBY_ENCODING_SHIFT)
           ~~~~~~~~~~~  ^
1 error generated.
make: *** [upgraded.bc] Error 1

make failed, exit code 2

Gem files will remain installed in ~/.gem/truffleruby/2.4.4/gems/agoo-2.5.1 for inspection.
Results logged to ~/.gem/truffleruby/2.4.4/extensions/x86_64-darwin/2.4.0/agoo-2.5.1/gem_make.out

@nouse
Copy link

nouse commented Nov 22, 2018

I can compile pg with LLVM 6, but sequel_pg fail with both LLVM 6 and LLVM 7

@eregon eregon self-assigned this Nov 23, 2018
@eregon eregon added this to the 1.0.0-rc10 milestone Nov 23, 2018
@dougxc dougxc closed this as completed in 2a8dd90 Nov 23, 2018
@eregon
Copy link
Member

eregon commented Nov 24, 2018

2a8dd90 fixes this and gem install sequel_pg now succeeds. It should be in the next release.

@deepj
Copy link
Author

deepj commented Nov 24, 2018

@eregon when will RC10 be released? :)

@eregon
Copy link
Member

eregon commented Nov 24, 2018

It should be in early December (we usually make a release each month, released around the beginning of the month). Take this as a hint though, it's just an estimation.

@deepj
Copy link
Author

deepj commented Nov 24, 2018

@eregon got it. Just a pity there are no nightly builds since there are several already fixed things blocking me in the current master. And Truffleruby is not easy to build on macOS. At least for me.

@eregon
Copy link
Member

eregon commented Nov 24, 2018

@deepj I agree nightly builds would be nice, and it's indeed not so trivial to build GraalVM or the TruffleRuby standalone. Could you file an issue for it?

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

No branches or pull requests

3 participants