Project

General

Profile

Actions

Bug #5432

closed

ruby 1.9.2-p290 ext/openssl build failure on Solaris 10 with Sun Workshop 12.1 or 12.2

Added by enchanter (Tim Mooney) over 12 years ago. Updated over 12 years ago.

Status:
Closed
Target version:
-
ruby -v:
1.9.2-p290
Backport:
[ruby-core:40088]

Description

I've tried building ruby 1.9.2-p290 and ruby 1.8.7-p352 on x86_64-sun-solaris2.10 (Solaris 10 10/08, update 6) with the no-cost Sun/Oracle Workshop toolchain. I've tried both the Workshop 12.1 and the latest, 12.2, with the same results.

The compiler objects to anywhere that ossl_str_adjust is called. Example:

gmake[1]: Entering directory /local/src/RPM/BUILD/ruby-1.9.2-p290/ext/openssl' cc -I. -I../../.ext/include/x86_64-solaris2.10 -I../.././include -I../.././ext/openssl -DRUBY_EXTCONF_H=\"extconf.h\" -I/local/include -I/local/gnu/include -I/local/openssl/include -D_FILE_OFFSET_BITS=64 -KPIC -Xa -xc99=all -xO0 -g -xs -xstrconst -mt -xtarget=native -I/loca/include -I/local/gnu/include -I/local/openssl/include -I/local/openssl/include -o ossl_asn1.o -c ossl_asn1.c "ossl_asn1.c", line 579: warning: statement not reached "ossl_asn1.c", line 708: improper member use: ptr "ossl_asn1.c", line 708: improper member use: len "ossl_asn1.c", line 991: improper member use: ptr "ossl_asn1.c", line 991: improper member use: len cc: acomp failed for ossl_asn1.c gmake[1]: *** [ossl_asn1.o] Error 2 gmake[1]: Leaving directory /local/src/RPM/BUILD/ruby-1.9.2-p290/ext/openssl'
gmake: *** [mkmain.sh] Error 1

The same issue happens in other files (e.g. ossl_ext509.c). If I preprocess the file, the macro

ossl_str_adjust(der, p);

on line 708 of ossl_asn1.c (near the end of the function ossl_asn1data_to_der) turns into

 do { int len = ( ! ( ( ( struct RBasic * ) ( der ) ) -> flags & ( ( ( VALUE ) 1 ) << ( 12 + 1 ) ) ) ? ( long ) ( ( ( ( struct RBasic * ) ( der ) ) -> flags >> ( 12 + 2 ) ) & ( ( ( ( ( VALUE ) 1 ) << ( 12 + 2 ) ) | ( ( ( VALUE ) 1 ) << ( 12 + 3 ) ) | ( ( ( VALUE ) 1 ) << ( 12 + 4 ) ) | ( ( ( VALUE ) 1 ) << ( 12 + 5 ) ) | ( ( ( VALUE ) 1 ) << ( 12 + 6 ) ) ) >> ( 12 + 2 ) ) ) : ( ( struct RString * ) ( der ) ) -> as . heap . len ) ; int newlen = ( p ) - ( unsigned char * ) ( ! ( ( ( struct RBasic * ) ( der ) ) -> flags & ( ( ( VALUE ) 1 ) << ( 12 + 1 ) ) ) ? ( ( struct RString * ) ( der ) ) -> as . ary : ( ( struct RString * ) ( der ) ) -> as . heap . ptr ) ; ( void ) ( ( newlen <= len ) || ( __assert_c99 ( "newlen <= len" , "ossl_asn1.c" , 708 , __func__ ) , 0 ) ) ; do { ( ( struct RString * ) ( der ) ) -> ptr [ newlen ] = 0 ; ( ( struct RString * ) ( der ) ) -> len = newlen ; } while ( 0 ) ; } while ( 0 );

I understand that gcc is the typical compiler for most platforms, but the Oracle Workshop toolchain often produces more efficient code on Solaris, so it's what I typically use for building opensource software on Solaris.

Updated by MartinBosslet (Martin Bosslet) over 12 years ago

  • Status changed from Open to Assigned
  • Assignee set to MartinBosslet (Martin Bosslet)

Updated by ngoto (Naohisa Goto) over 12 years ago

On my machine running Solaris 10 on sparc, with Oracle Solaris Studio 12.2 and openssl 1.0.0d, the issue does not occur, and "make test" is finished without error.

% export PATH=/opt/solstudio12.2/bin:$PATH
% ./configure --prefix=/XXX/XXX
CC=cc LDSHARED="cc -G"
CPPFLAGS="-I/usr/local/lib/libffi-3.0.9/include -I/usr/local/include"
LDFLAGS="-xtarget=native -L/usr/local/lib -R/usr/local/lib"
CFLAGS="-Xa -xc99=all -xO0 -g -xs -xstrconst -mt -xtarget=native"
% make
% make test

(The above CFLAGS are copied from the issue report for checking the effects of compile options.)

I suppose the error may occur when trying to compile ruby 1.9 components with Ruby 1.8 header files. Could you clean up the build directory and try again?

Updated by enchanter (Tim Mooney) over 12 years ago

Thanks for confirming that it works for you Naohisa. With the clue you've provided and some additional work I have done in the interim, I now have two ways around this issue.

The build directory was clean, as it gets removed and recreated before every attempted software build. I use rpm to build & package all local software on my Solaris systems, and the spec file handles making certain that the build steps and build environment are always the exactly same.

I did have ruby 1.8.5 installed on the system, though, so I uninstalled that package and then re-tried the build of ruby 1.9.2-p290, and it did indeed work.

That, however, implies that there's a problem in the ruby build process, as it shouldn't be the case that a ruby build will fail because a previous version of ruby is installed on the system. When that happens, generally it indicates that one or more of the Makefiles is not correctly added the source & build directory before any system directories, when searching for header files or libraries.

In addition, before I saw your response, I found another solution to the problem. The errors I was getting all seemed to be pointing to issues with the rb_str_set_len macro from ruby_missing.h. On a hunch, I started searching other parts of the ruby sources for that text, and found that string.c has a definition for rb_str_set_len that differs from the macro in ruby_missing.h, and that the compiler has no complaints about.

Since string.c has a defintion for it and that's what actually gets compiled into the library that other parts of ruby link with, I just commented out the #define for rb_str_set_len in ruby_missing.h, and that also allowed ruby to build.

I think that it would be advisable to either completely remove the #define for rb_str_set_len in ruby_missing.h, or at least make it match the definition that's being used in string.c.

Although I now have workarounds, both of the issues brought up in this bug should probably be investigated and changes made. I'm happy to help with that, if others agree that work should continue on it.

Actions #4

Updated by Anonymous over 12 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r33843.
Tim, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/openssl/extconf.rb: remove checks for available functions.
  • ext/openssl/missing.h: ditto.
    Thanks, Tim Mooney for reporting this!
    [Bug #5432] [ruby-core:40088]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0