clamav icon indicating copy to clipboard operation
clamav copied to clipboard

gem not building with clamav 0.101.1

Open smithjp opened this issue 6 years ago • 6 comments

on centos7, version 0.101.1, release 1.e17

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

smithjp avatar Feb 01 '19 15:02 smithjp

full error message:

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

    current directory: /home/vagrant/.gem/ruby/gems/clamav-0.4.1/ext/clamav
/opt/rh/rh-ruby24/root/usr/bin/ruby -r ./siteconf20190201-17963-3u753k.rb extconf.rb
checking for clamav.h... yes
checking for cl_engine_compile() in -lclamav... yes
creating Makefile

current directory: /home/vagrant/.gem/ruby/gems/clamav-0.4.1/ext/clamav
make "DESTDIR=" clean
rm -f 
rm -f clamav.so  *.o  *.bak mkmf.log .*.time

current directory: /home/vagrant/.gem/ruby/gems/clamav-0.4.1/ext/clamav
make "DESTDIR="
gcc -I. -I/opt/rh/rh-ruby24/root/usr/include -I/opt/rh/rh-ruby24/root/usr/include/ruby/backward -I/opt/rh/rh-ruby24/root/usr/include -I. -DHAVE_CLAMAV_H    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -mtune=generic -fPIC -m64 -o clamav.o -c clamav.c
In file included from /opt/rh/rh-ruby24/root/usr/include/ruby.h:33:0,
                 from clamav.c:2:
clamav.c: In function ‘clamavr_new’:
clamav.c:32:25: error: ‘CL_SCAN_STDOPT’ undeclared (first use in this function)
     v_options = INT2FIX(CL_SCAN_STDOPT); /* default value */
                         ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
clamav.c:32:17: note: in expansion of macro ‘INT2FIX’
     v_options = INT2FIX(CL_SCAN_STDOPT); /* default value */
                 ^
clamav.c:32:25: note: each undeclared identifier is reported only once for each function it appears in
     v_options = INT2FIX(CL_SCAN_STDOPT); /* default value */
                         ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
clamav.c:32:17: note: in expansion of macro ‘INT2FIX’
     v_options = INT2FIX(CL_SCAN_STDOPT); /* default value */
                 ^
clamav.c: In function ‘clamavr_countsigs’:
clamav.c:197:5: warning: pointer targets in passing argument 3 of ‘cl_countsigs’ differ in signedness [-Wpointer-sign]
     ret = cl_countsigs(dbdir, FIX2INT(v_options), &signo);
     ^
In file included from clamav.c:1:0:
/usr/include/clamav.h:1000:12: note: expected ‘unsigned int *’ but argument is of type ‘int *’
 extern int cl_countsigs(const char *path, unsigned int countoptions, unsigned int *sigs);
            ^
In file included from /opt/rh/rh-ruby24/root/usr/include/ruby.h:33:0,
                 from clamav.c:2:
clamav.c: In function ‘clamavr_scanfile’:
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:1208:30: warning: passing argument 5 of ‘cl_scanfile’ makes pointer from integer without a cast [enabled by default]
 #define RSTRING(obj) (R_CAST(RString)(obj))
                              ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:1203:30: note: in definition of macro ‘R_CAST’
 #define R_CAST(st)   (struct st*)
                              ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:985:6: note: in expansion of macro ‘RSTRING’
      RSTRING(str)->as.heap.ptr)
      ^
clamav.c:227:23: note: in expansion of macro ‘RSTRING_PTR’
     ret = cl_scanfile(RSTRING_PTR(v_fname), &virname, NULL, ptr->root, FIX2INT(v_options));
                       ^
In file included from clamav.c:1:0:
/usr/include/clamav.h:874:12: note: expected ‘struct cl_scan_options *’ but argument is of type ‘int’
 extern int cl_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_engine *engine, struct cl_scan_options* scanoptions);
            ^
In file included from /opt/rh/rh-ruby24/root/usr/include/ruby.h:33:0,
                 from clamav.c:2:
./const.h: In function ‘Init_clamav’:
./const.h:61:53: error: ‘CL_SCAN_RAW’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_RAW", INT2FIX(CL_SCAN_RAW));
                                                     ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:61:45: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_RAW", INT2FIX(CL_SCAN_RAW));
                                             ^
./const.h:62:57: error: ‘CL_SCAN_ARCHIVE’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_ARCHIVE", INT2FIX(CL_SCAN_ARCHIVE));
                                                         ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:62:49: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_ARCHIVE", INT2FIX(CL_SCAN_ARCHIVE));
                                                 ^
./const.h:63:54: error: ‘CL_SCAN_MAIL’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_MAIL", INT2FIX(CL_SCAN_MAIL));
                                                      ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:63:46: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_MAIL", INT2FIX(CL_SCAN_MAIL));
                                              ^
./const.h:64:54: error: ‘CL_SCAN_OLE2’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_OLE2", INT2FIX(CL_SCAN_OLE2));
                                                      ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:64:46: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_OLE2", INT2FIX(CL_SCAN_OLE2));
                                              ^
./const.h:65:64: error: ‘CL_SCAN_BLOCKENCRYPTED’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_BLOCKENCRYPTED", INT2FIX(CL_SCAN_BLOCKENCRYPTED));
                                                                ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:65:56: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_BLOCKENCRYPTED", INT2FIX(CL_SCAN_BLOCKENCRYPTED));
                                                        ^
./const.h:66:54: error: ‘CL_SCAN_HTML’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_HTML", INT2FIX(CL_SCAN_HTML));
                                                      ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:66:46: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_HTML", INT2FIX(CL_SCAN_HTML));
                                              ^
./const.h:67:52: error: ‘CL_SCAN_PE’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_PE", INT2FIX(CL_SCAN_PE));
                                                    ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:67:44: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_PE", INT2FIX(CL_SCAN_PE));
                                            ^
./const.h:68:61: error: ‘CL_SCAN_BLOCKBROKEN’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_BLOCKBROKEN", INT2FIX(CL_SCAN_BLOCKBROKEN));
                                                             ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:68:53: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_BLOCKBROKEN", INT2FIX(CL_SCAN_BLOCKBROKEN));
                                                     ^
./const.h:69:57: error: ‘CL_SCAN_MAILURL’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_MAILURL", INT2FIX(CL_SCAN_MAILURL)); /*  ignored  */
                                                         ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:69:49: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_MAILURL", INT2FIX(CL_SCAN_MAILURL)); /*  ignored  */
                                                 ^
./const.h:70:58: error: ‘CL_SCAN_BLOCKMAX’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_BLOCKMAX", INT2FIX(CL_SCAN_BLOCKMAX)); /*  ignored  */
                                                          ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:70:50: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_BLOCKMAX", INT2FIX(CL_SCAN_BLOCKMAX)); /*  ignored  */
                                                  ^
./const.h:71:61: error: ‘CL_SCAN_ALGORITHMIC’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_ALGORITHMIC", INT2FIX(CL_SCAN_ALGORITHMIC));
                                                             ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:71:53: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_ALGORITHMIC", INT2FIX(CL_SCAN_ALGORITHMIC));
                                                     ^
./const.h:72:67: error: ‘CL_SCAN_PHISHING_BLOCKSSL’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_PHISHING_BLOCKSSL", INT2FIX(CL_SCAN_PHISHING_BLOCKSSL)); /*  ssl mismatches, not ssl by itself */
                                                                   ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:72:59: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_PHISHING_BLOCKSSL", INT2FIX(CL_SCAN_PHISHING_BLOCKSSL)); /*  ssl mismatches, not ssl by itself */
                                                           ^
./const.h:73:69: error: ‘CL_SCAN_PHISHING_BLOCKCLOAK’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_PHISHING_BLOCKCLOAK", INT2FIX(CL_SCAN_PHISHING_BLOCKCLOAK));
                                                                     ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:73:61: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_PHISHING_BLOCKCLOAK", INT2FIX(CL_SCAN_PHISHING_BLOCKCLOAK));
                                                             ^
./const.h:74:53: error: ‘CL_SCAN_ELF’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_ELF", INT2FIX(CL_SCAN_ELF));
                                                     ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:74:45: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_ELF", INT2FIX(CL_SCAN_ELF));
                                             ^
./const.h:75:53: error: ‘CL_SCAN_PDF’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_PDF", INT2FIX(CL_SCAN_PDF));
                                                     ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:75:45: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_PDF", INT2FIX(CL_SCAN_PDF));
                                             ^
./const.h:76:60: error: ‘CL_SCAN_STRUCTURED’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_STRUCTURED", INT2FIX(CL_SCAN_STRUCTURED));
                                                            ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:76:52: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_STRUCTURED", INT2FIX(CL_SCAN_STRUCTURED));
                                                    ^
./const.h:77:71: error: ‘CL_SCAN_STRUCTURED_SSN_NORMAL’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_STRUCTURED_SSN_NORMAL", INT2FIX(CL_SCAN_STRUCTURED_SSN_NORMAL));
                                                                       ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:77:63: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_STRUCTURED_SSN_NORMAL", INT2FIX(CL_SCAN_STRUCTURED_SSN_NORMAL));
                                                               ^
./const.h:78:73: error: ‘CL_SCAN_STRUCTURED_SSN_STRIPPED’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_STRUCTURED_SSN_STRIPPED", INT2FIX(CL_SCAN_STRUCTURED_SSN_STRIPPED));
                                                                         ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:78:65: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_STRUCTURED_SSN_STRIPPED", INT2FIX(CL_SCAN_STRUCTURED_SSN_STRIPPED));
                                                                 ^
./const.h:79:65: error: ‘CL_SCAN_PARTIAL_MESSAGE’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_PARTIAL_MESSAGE", INT2FIX(CL_SCAN_PARTIAL_MESSAGE));
                                                                 ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:79:57: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_PARTIAL_MESSAGE", INT2FIX(CL_SCAN_PARTIAL_MESSAGE));
                                                         ^
./const.h:80:70: error: ‘CL_SCAN_HEURISTIC_PRECEDENCE’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_HEURISTIC_PRECEDENCE", INT2FIX(CL_SCAN_HEURISTIC_PRECEDENCE));
                                                                      ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:80:62: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_HEURISTIC_PRECEDENCE", INT2FIX(CL_SCAN_HEURISTIC_PRECEDENCE));
                                                              ^
./const.h:83:56: error: ‘CL_SCAN_STDOPT’ undeclared (first use in this function)
     rb_define_const(cClamAV, "CL_SCAN_STDOPT", INT2FIX(CL_SCAN_STDOPT));
                                                        ^
/opt/rh/rh-ruby24/root/usr/include/ruby/ruby.h:231:33: note: in definition of macro ‘RB_INT2FIX’
 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
                                 ^
./const.h:83:48: note: in expansion of macro ‘INT2FIX’
     rb_define_const(cClamAV, "CL_SCAN_STDOPT", INT2FIX(CL_SCAN_STDOPT));
                                                ^
make: *** [clamav.o] Error 1

make failed, exit code 2

smithjp avatar Feb 01 '19 15:02 smithjp

I had to downgrade to get this working on Mac Mojave. If you're using brew:

brew unlink clamav
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/ee7114856bafbfac500a4d039d7d5bf26511158a/Formula/clamav.rb

Make sure you're using the --with-cppflags=-I/usr/local/opt/openssl/include when you install the gem. I suspect that the configuration isn't honoring --with-cppflags anymore, but I could be wrong.

awead avatar Feb 19 '19 19:02 awead

I tried building the gem on centos7 with bundle config build.clamav --with-cppflags=-I/usr/local/opt/openssl/include before the bundle install, but it is still not compiling.

smithjp avatar Mar 01 '19 20:03 smithjp

This not only the case on centos but also in the stable docker image (since Debian released Buster).

Any work solutions?

johan-smits avatar Jul 23 '19 13:07 johan-smits

Still nothing here?

johan-smits avatar Aug 23 '19 14:08 johan-smits

We have not been able to get this gem to work on recent centos builds, so we switched to using the clamby gem (https://github.com/kobaltz/clamby).

smithjp avatar Aug 23 '19 16:08 smithjp