Issue #5432 has been updated by Naohisa Goto.


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?
----------------------------------------
Bug #5432: ruby 1.9.2-p290 ext/openssl build failure on Solaris 10 with Sun Workshop 12.1 or 12.2
http://redmine.ruby-lang.org/issues/5432

Author: Tim Mooney
Status: Assigned
Priority: Normal
Assignee: Martin Bosslet
Category: build
Target version: 
ruby -v: 1.9.2-p290


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.



-- 
http://redmine.ruby-lang.org