NetBSD Problem Report #44434

From www@NetBSD.org  Sat Jan 22 05:19:06 2011
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id C650B63B883
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 22 Jan 2011 05:19:06 +0000 (UTC)
Message-Id: <20110122051905.7DA9063B873@www.NetBSD.org>
Date: Sat, 22 Jan 2011 05:19:05 +0000 (UTC)
From: jxraynor@gmail.com
Reply-To: jxraynor@gmail.com
To: gnats-bugs@NetBSD.org
Subject: openssl from pkgsrc-2010Q4 fails to build on aix 5.3
X-Send-Pr-Version: www-1.0

>Number:         44434
>Category:       pkg
>Synopsis:       openssl from pkgsrc-2010Q4 fails to build on aix 5.3
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    aix-pkg-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 22 05:20:00 +0000 2011
>Last-Modified:  Thu Apr 26 13:42:12 +0000 2012
>Originator:     J Raynor
>Release:        aix 5.3
>Organization:
>Environment:
AIX testsys 3 5
>Description:
Building openssl fails with the following errors (just showing tail end of them):

cc -I../crypto -I.. -I../include  -DOPENSSL_THREADS -qthreaded -DDSO_DLFCN -DHAVE_DLFCN_H -O -q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst   -c -o ssl_err.o ssl_err.c
gcc: unrecognized option `-qthreaded'
gcc: unrecognized option `-q32'
gcc: unrecognized option `-qmaxmem=16384'
gcc: unrecognized option `-qro'
gcc: unrecognized option `-qroconst'
cc -I../crypto -I.. -I../include  -DOPENSSL_THREADS -qthreaded -DDSO_DLFCN -DHAVE_DLFCN_H -O -q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst   -c -o kssl.o kssl.c
gcc: unrecognized option `-qthreaded'
gcc: unrecognized option `-q32'
gcc: unrecognized option `-qmaxmem=16384'
gcc: unrecognized option `-qro'
gcc: unrecognized option `-qroconst'
cc -I../crypto -I.. -I../include  -DOPENSSL_THREADS -qthreaded -DDSO_DLFCN -DHAVE_DLFCN_H -O -q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst   -c -o t1_reneg.o t1_reneg.c
gcc: unrecognized option `-qthreaded'
gcc: unrecognized option `-q32'
gcc: unrecognized option `-qmaxmem=16384'
gcc: unrecognized option `-qro'
gcc: unrecognized option `-qroconst'
ar -X 32 r ../libssl.a s2_meth.o  s2_srvr.o  s2_clnt.o  s2_lib.o  s2_enc.o s2_pkt.o s3_meth.o  s3_srvr.o  s3_clnt.o  s3_lib.o  s3_enc.o s3_pkt.o s3_both.o s23_meth.o s23_srvr.o s23_clnt.o s23_lib.o          s23_pkt.o t1_meth.o   t1_srvr.o t1_clnt.o  t1_lib.o  t1_enc.o d1_meth.o   d1_srvr.o d1_clnt.o  d1_lib.o  d1_pkt.o d1_both.o d1_enc.o ssl_lib.o ssl_err2.o ssl_cert.o ssl_sess.o ssl_ciph.o ssl_stat.o ssl_rsa.o ssl_asn1.o ssl_txt.o ssl_algs.o bio_ssl.o ssl_err.o kssl.o t1_reneg.o
ar: creating an archive file ../libssl.a
/usr/bin/ranlib ../libssl.a || echo Never mind.
gmake[1]: Leaving directory `/jxr/pkgsrc/security/openssl/work/openssl-0.9.8q/ssl'
gmake[1]: Entering directory `/jxr/pkgsrc/security/openssl/work/openssl-0.9.8q'
gmake[2]: Entering directory `/jxr/pkgsrc/security/openssl/work/openssl-0.9.8q'
gcc: unrecognized option `-qthreaded'
gcc: unrecognized option `-q32'
gcc: unrecognized option `-qmaxmem=16384'
gcc: unrecognized option `-qro'
gcc: unrecognized option `-qroconst'
gcc: unrecognized option `-q32'
gcc: unrecognized option `-G'
ld: 0706-027 The -R /jxr/lib flag is ignored.
ld: 0711-317 ERROR: Undefined symbol: .main
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status
gmake[2]: *** [link_a.aix] Error 1
gmake[2]: Leaving directory `/jxr/pkgsrc/security/openssl/work/openssl-0.9.8q'
gmake[1]: *** [do_aix-shared] Error 2
gmake[1]: Leaving directory `/jxr/pkgsrc/security/openssl/work/openssl-0.9.8q'
gmake: *** [libcrypto.so.0.9.8] Error 2
*** Error code 2

Stop.
bmake: stopped in /jxr/pkgsrc/security/openssl
*** Error code 1

Stop.
bmake: stopped in /jxr/pkgsrc/security/openssl





>How-To-Repeat:
Run bmake in security/openssl with gcc as your compiler.
>Fix:
The problem is with openssl's config script.  When run on aix, it checks to see if cc is available.  If so, it assumes it is IBM's cc and not gcc.  The cc command that it actually finds is the pkgsrc wrappers for gcc.  Because it assumes cc is IBM's cc, it sets the LDFLAGS incorrectly and the build fails.

I've submitted a patch to openssl-bugs@openssl.org, but I don't know if my patch will be accepted.  In the mean time, I'm submitting a patch here.  The patch still keeps openssl config's behavior of choosing IBM's cc over gcc, but it will make sure cc isn't gcc before doing so. 

Also, I changed the "not found" check for cc slightly.  The way that it was written caused "config" and "sh -x config" to give different results, which isn't nice for troubleshooting.

Below is my patch against the extracted-but-unpatched config file.  I see that the config file is patched in patch-aa, and that I should combine my patch with the patches there, but when I tried to combine them, "bmake patch" wouldn't apply it.  So, I'm afraid I'll need some help in combining my patch with patch-aa.


--- config.orig 2011-01-21 21:37:42.000000000 -0600
+++ config      2011-01-21 21:37:45.000000000 -0600
@@ -474,7 +474,9 @@
 fi

 if [ "${SYSTEM}" = "AIX" ]; then       # favor vendor cc over gcc
-    (cc) 2>&1 | grep -iv "not found" > /dev/null && CC=cc
+    if ! (cc) 2>&1 | grep -qi "not found" ; then
+        (cc -v) 2>&1 | grep -qi gcc || CC=cc
+    fi
 fi

 CCVER=${CCVER:-0}







>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->aix-pkg-people
Responsible-Changed-By: obache@NetBSD.org
Responsible-Changed-When: Thu, 26 Apr 2012 13:42:12 +0000
Responsible-Changed-Why:
problem on AIX.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.