ruby-1.8.5 and openssl and gcc 3.2

B

Bil Kleb

I'm trying to compile ruby-1.8.5 on a rather old Linux box,
and it's failing in ext/openssl,

gcc -I. -I../.. -I../../. -I../.././ext/openssl -DRUBY_EXTCONF_H=\"extconf.h\" -I/users/kleb/local/openssl/include -fPIC -g -O2 -c ossl_bio.c
ossl_bio.c: In function `ossl_obj2bio':
ossl_bio.c:23: called object is not a function
make: *** [ossl_bio.o] Error 1

Does this error look familiar to anyone?

21 if (TYPE(obj) == T_FILE) {
22 OpenFile *fptr;
23 GetOpenFile(obj, fptr);
24 rb_io_check_readable(fptr);
25 bio = BIO_new_fp(fptr->f, BIO_NOCLOSE);
26 }

As you can see, I tried supplying a fresh openssl (0.9.7k),
but the error didn't change.

Here's the state of gcc on this box,

gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --host=i386-redhat-linux --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)

Thanks,
 
N

Nobuyoshi Nakada

Hi,

At Sun, 17 Sep 2006 06:06:16 +0900,
Bil Kleb wrote in [ruby-talk:214786]:
ossl_bio.c: In function `ossl_obj2bio':
ossl_bio.c:23: called object is not a function
make: *** [ossl_bio.o] Error 1

Does this error look familiar to anyone?

21 if (TYPE(obj) == T_FILE) {
22 OpenFile *fptr;
23 GetOpenFile(obj, fptr);
24 rb_io_check_readable(fptr);
25 bio = BIO_new_fp(fptr->f, BIO_NOCLOSE);
26 }

Can't you show the preprocessed result?

$ gcc -I. -I../.. -I../../. -I../.././ext/openssl \
-DRUBY_EXTCONF_H=\"extconf.h\" \
-I/users/kleb/local/openssl/include -fPIC -g -O2 \
-E ossl_bio.c | sed -n /^ossl_obj2bio/,/^}/p

would show the corresponding portion.
 
B

Bil Kleb

Nobuyoshi said:
Hi,
Hello.

At Sun, 17 Sep 2006 06:06:16 +0900,
Bil Kleb wrote in [ruby-talk:214786]:
ossl_bio.c: In function `ossl_obj2bio':
ossl_bio.c:23: called object is not a function
make: *** [ossl_bio.o] Error 1

Can't you show the preprocessed result?

ossl_obj2bio(VALUE obj)
{
BIO *bio;

if (rb_type((VALUE)(obj)) == 0x0e) {
OpenFile *fptr;
rb_io_check_closed((fptr) = ".rnd"(rb_io_taint_check(obj))->fptr);
rb_io_check_readable(fptr);
bio = BIO_new_fp(fptr->f, 0x00);
}
else {
rb_string_value(&(obj));
bio = BIO_new_mem_buf(((struct RString*)(obj))->ptr, ((struct RString*)(obj))->len);
}
if (!bio) ossl_raise(eOSSLError, ((void *)0));

return bio;
}

Regards,
 
N

Nobuyoshi Nakada

Hi,

At Sun, 17 Sep 2006 23:21:09 +0900,
Bil Kleb wrote in [ruby-talk:214845]:
if (rb_type((VALUE)(obj)) == 0x0e) {
OpenFile *fptr;
rb_io_check_closed((fptr) = ".rnd"(rb_io_taint_check(obj))->fptr);

This line has to be:

rb_io_check_closed((fptr) = ((struct RFile*)(rb_io_taint_check(obj)))->fptr);

In ext/openssl/ossl.h:
/*
* OpenSSL has defined RFILE and Ruby has defined RFILE - so undef it!
*/
#if defined(RFILE) /*&& !defined(OSSL_DEBUG)*/
# undef RFILE
#endif
#include <ruby.h>
#include <rubyio.h>

RFILE seems redefined somewhere after here.
 
B

Bil Kleb

Nobuyoshi said:
Hi,

At Sun, 17 Sep 2006 23:21:09 +0900,
Bil Kleb wrote in [ruby-talk:214845]:
if (rb_type((VALUE)(obj)) == 0x0e) {
OpenFile *fptr;
rb_io_check_closed((fptr) = ".rnd"(rb_io_taint_check(obj))->fptr);

This line has to be:

rb_io_check_closed((fptr) = ((struct RFile*)(rb_io_taint_check(obj)))->fptr);

In ext/openssl/ossl.h:
/*
* OpenSSL has defined RFILE and Ruby has defined RFILE - so undef it!
*/
#if defined(RFILE) /*&& !defined(OSSL_DEBUG)*/
# undef RFILE
#endif
#include <ruby.h>
#include <rubyio.h>

I have this in my ossl.h too:

20 /*
21 * OpenSSL has defined RFILE and Ruby has defined RFILE - so undef it!
22 */
23 #if defined(RFILE) /*&& !defined(OSSL_DEBUG)*/
24 # undef RFILE
25 #endif
26 #include <ruby.h>
27 #include said:
RFILE seems redefined somewhere after here.

But I can't find another RFILE in /ext/openssl or below...

$ cd /ext/openssl && grep -nr RFILE *
ossl.h:21:* OpenSSL has defined RFILE and Ruby has defined RFILE - so undef it!
ossl.h:23:#if defined(RFILE) /*&& !defined(OSSL_DEBUG)*/
ossl.h:24:# undef RFILE

Suggestions?

I tried removing the comment from the "#if defined" line
and just putting "#undef RFILE' with no apparent effect.

Thanks,
 
N

Nobuyoshi Nakada

Hi,

At Mon, 18 Sep 2006 01:06:07 +0900,
Bil Kleb wrote in [ruby-talk:214856]:
But I can't find another RFILE in /ext/openssl or below...

`Somewhere' inside said:
$ cd /ext/openssl && grep -nr RFILE *
ossl.h:21:* OpenSSL has defined RFILE and Ruby has defined RFILE - so undef it!
ossl.h:23:#if defined(RFILE) /*&& !defined(OSSL_DEBUG)*/
ossl.h:24:# undef RFILE

Suggestions?

Moving the code block after #include lines of openssl. Try
this patch.


Index: ext/openssl/ossl.h
===================================================================
RCS file: /cvs/ruby/src/ruby/ext/openssl/ossl.h,v
retrieving revision 1.14.2.4
diff -p -u -2 -r1.14.2.4 ossl.h
--- ext/openssl/ossl.h 27 Jul 2006 07:45:33 -0000 1.14.2.4
+++ ext/openssl/ossl.h 18 Sep 2006 02:49:17 -0000
@@ -16,14 +16,13 @@
#if defined(__cplusplus)
extern "C" {
+#elif 0
+}
#endif

/*
-* OpenSSL has defined RFILE and Ruby has defined RFILE - so undef it!
-*/
-#if defined(RFILE) /*&& !defined(OSSL_DEBUG)*/
-# undef RFILE
-#endif
-#include <ruby.h>
-#include <rubyio.h>
+ *_FILE_OFFSET_BITS needs to be defined before some system headers on
+ * Solaris.
+ */
+#include "config.h"

/*
@@ -70,4 +69,13 @@ extern "C" {

/*
+* OpenSSL has defined RFILE and Ruby has defined RFILE - so undef it!
+*/
+#if defined(RFILE) /*&& !defined(OSSL_DEBUG)*/
+# undef RFILE
+#endif
+#include <ruby.h>
+#include <rubyio.h>
+
+/*
* Common Module
*/
@@ -212,5 +220,7 @@ void ossl_debug(const char *, ...);
void Init_openssl(void);

-#if defined(__cplusplus)
+#if 0
+{
+#elif defined(__cplusplus)
}
#endif
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top