Skip to content

Error on Ruby 3.2.2: "error: ‘rb_cData’ undeclared" #82

Description

@jordan-brough

When I try to build the following Dockerfile, which uses Ruby 3.2.2:

FROM amazon/aws-lambda-ruby:3.2.2023.06.12.17

RUN curl -O https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN rpm -ivh epel-release-latest-7.noarch.rpm
RUN yum -y update
RUN yum -y install git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison sqlite-devel
RUN yum -y install firebird firebird-devel
RUN gem install fb

I get an error like:

#10 3.196 fb.c:2944:61: error: ‘rb_cData’ undeclared (first use in this function); did you mean ‘rb_cDate’?
#10 3.196   rb_cFbDatabase = rb_define_class_under(rb_mFb, "Database", rb_cData);
#10 3.196                                                              ^~~~~~~~
Click here to show full error details
#10 [7/7] RUN gem install fb
#10 1.041 Building native extensions. This could take a while...
#10 3.147 ERROR:  Error installing fb:
#10 3.147 	ERROR: Failed to build gem native extension.
#10 3.147 
#10 3.147     current directory: /var/lang/lib/ruby/gems/3.2.0/gems/fb-0.9.3
#10 3.147 /var/lang/bin/ruby extconf.rb
#10 3.147 checking for isc_attach_database() in -lfbclient... yes
#10 3.147 creating Makefile
#10 3.147 
#10 3.147 current directory: /var/lang/lib/ruby/gems/3.2.0/gems/fb-0.9.3
#10 3.147 make DESTDIR\= sitearchdir\=./.gem.20230623-1-v2p295 sitelibdir\=./.gem.20230623-1-v2p295 clean
#10 3.147 
#10 3.147 current directory: /var/lang/lib/ruby/gems/3.2.0/gems/fb-0.9.3
#10 3.147 make DESTDIR\= sitearchdir\=./.gem.20230623-1-v2p295 sitelibdir\=./.gem.20230623-1-v2p295
#10 3.147 compiling fb.c
#10 3.147 fb.c: In function ‘fb_cursor_fields_ary’:
#10 3.147 fb.c:1675:11: warning: implicit declaration of function ‘rb_tainted_str_new’; did you mean ‘rb_utf8_str_new’? [-Wimplicit-function-declaration]
#10 3.147     name = rb_tainted_str_new(var->aliasname, var->aliasname_length);
#10 3.147            ^~~~~~~~~~~~~~~~~~
#10 3.147            rb_utf8_str_new
#10 3.147 fb.c: In function ‘Init_fb’:
#10 3.147 fb.c:2938:6: warning: old-style function definition [-Wold-style-definition]
#10 3.147  void Init_fb()
#10 3.147       ^~~~~~~
#10 3.147 fb.c:2944:61: error: ‘rb_cData’ undeclared (first use in this function); did you mean ‘rb_cDate’?
#10 3.147   rb_cFbDatabase = rb_define_class_under(rb_mFb, "Database", rb_cData);
#10 3.147                                                              ^~~~~~~~
#10 3.147                                                              rb_cDate
#10 3.147 fb.c:2944:61: note: each undeclared identifier is reported only once for each function it appears in
#10 3.147 fb.c: At top level:
#10 3.147 cc1: warning: unrecognized command line option ‘-Wno-self-assign’
#10 3.147 cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
#10 3.147 cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
#10 3.147 cc1: warning: unrecognized command line option ‘-Wno-cast-function-type’
#10 3.147 make: *** [fb.o] Error 1
#10 3.147 
#10 3.147 make failed, exit code 2
#10 3.147 
#10 3.147 Gem files will remain installed in /var/lang/lib/ruby/gems/3.2.0/gems/fb-0.9.3 for inspection.
#10 3.147 Results logged to /var/lang/lib/ruby/gems/3.2.0/extensions/x86_64-linux/3.2.0/fb-0.9.3/gem_make.out
#10 ERROR: process "/bin/sh -c gem install fb" did not complete successfully: exit code: 1
------
 > [7/7] RUN gem install fb:
#10 3.147 cc1: warning: unrecognized command line option ‘-Wno-self-assign’
#10 3.147 cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
#10 3.147 cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
#10 3.147 cc1: warning: unrecognized command line option ‘-Wno-cast-function-type’
#10 3.147 make: *** [fb.o] Error 1
#10 3.147 
#10 3.147 make failed, exit code 2
#10 3.147 
#10 3.147 Gem files will remain installed in /var/lang/lib/ruby/gems/3.2.0/gems/fb-0.9.3 for inspection.
#10 3.147 Results logged to /var/lang/lib/ruby/gems/3.2.0/extensions/x86_64-linux/3.2.0/fb-0.9.3/gem_make.out
------
Dockerfile:57
--------------------
  55 |     RUN yum -y install git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison sqlite-devel
  56 |     RUN yum -y install firebird firebird-devel
  57 | >>> RUN gem install fb
--------------------
ERROR: failed to solve: process "/bin/sh -c gem install fb" did not complete successfully: exit code: 1

In case it's helpful, if you comment out the final line of the Dockerfile, you can build the image and start a bash shell to experiment with installing the gem:

$ docker build --platform linux/amd64 --tag ruby-firebird .
$ docker run --platform linux/amd64 --rm -it --entrypoint='' ruby-firebird /bin/bash

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions