Bug 815600

Summary: s3_srvr.c build errors when cross-compiling for ARMv6l
Product: [Fedora] Fedora Reporter: Mr-4 <mr.dash.four>
Component: opensslAssignee: Tomas Mraz <tmraz>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: tmraz
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-17 14:14:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
ARMv6l cross-compilation patch none

Description Mr-4 2012-04-24 03:04:43 UTC
Created attachment 579737 [details]
ARMv6l cross-compilation patch

Description of problem:
When cross-compiling for the ARMv6l arch I get the following errors:

make[1]: Entering directory `/builddir/build/BUILD/openssl-1.0.1a/ssl'
[...]
armv6l-redhat-linux-uclibcgnueabi-gcc -I../crypto -I.. -I../include  -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIO -Wall -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv6j -mtune=arm1136jf-s -mthumb-interwork -mno-thumb -Wa,--noexecstack -march=armv6j -mtune=arm1136jf-s -mthumb-interwork -mno-thumb -DPURIFY  -c -o s3_srvr.o s3_srvr.c
s3_srvr.c: In function 'ssl_check_srp_ext_ClientHello':
s3_srvr.c:190:8: error: 'SSL' has no member named 'srp_ctx'
s3_srvr.c:192:7: error: 'SSL' has no member named 'srp_ctx'
s3_srvr.c:200:4: warning: implicit declaration of function 'SSL_srp_server_param_with_username' [-Wimplicit-function-declaration]
s3_srvr.c: In function 'ssl3_send_server_key_exchange':
s3_srvr.c:1806:10: error: 'SSL' has no member named 'srp_ctx'
s3_srvr.c:1807:7: error: 'SSL' has no member named 'srp_ctx'
s3_srvr.c:1808:7: error: 'SSL' has no member named 'srp_ctx'
s3_srvr.c:1809:7: error: 'SSL' has no member named 'srp_ctx'
s3_srvr.c:1814:10: error: 'SSL' has no member named 'srp_ctx'
s3_srvr.c:1815:10: error: 'SSL' has no member named 'srp_ctx'
s3_srvr.c:1816:10: error: 'SSL' has no member named 'srp_ctx'
s3_srvr.c:1817:10: error: 'SSL' has no member named 'srp_ctx'
s3_srvr.c: In function 'ssl3_get_client_key_exchange':
s3_srvr.c:2776:11: error: 'SSL' has no member named 'srp_ctx'
s3_srvr.c:2781:18: error: 'SSL_SESSION' has no member named 'srp_username'
s3_srvr.c:2782:5: error: 'SSL_SESSION' has no member named 'srp_username'
s3_srvr.c:2783:14: error: 'SSL_SESSION' has no member named 'srp_username'
s3_srvr.c:2783:43: error: 'SSL' has no member named 'srp_ctx'
s3_srvr.c:2784:18: error: 'SSL_SESSION' has no member named 'srp_username'
s3_srvr.c:2791:4: warning: implicit declaration of function 'SRP_generate_server_master_secret' [-Wimplicit-function-declaration]
make[1]: *** [s3_srvr.o] Error 1
make[1]: Leaving directory `/builddir/build/BUILD/openssl-1.0.1a/ssl'
make: *** [build_ssl] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.eiztM3 (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.eiztM3 (%build)

Version-Release number of selected component (if applicable):
1.0.1a with a cross-compilation patch applied (I am attaching this as well)

How reproducible:
Always

Steps to Reproduce:
1. rpmbuild -bb --target=armv6l openssl.spec
2.
3.
  
Actual results:
The above sequence of errors

Expected results:
Build to succeed.

Additional info:
Please note that I am not getting this error either when not cross-compiling or when cross-compiling for ARMv6l, but building 1.0.0i version of openssl. I also add the following (when cross-compiling for ARMv6l):

1. "--cross-compile-prefix=armv6l-redhat-linux-uclibcgnueabi-" to ./Configure:  
2. "$RPM_OPT_FLAGS -Wa,--noexecstack -march=armv6j -mtune=arm1136jf-s -mthumb-interwork -mno-thumb -DPURIFY" to RPM_OPT_FLAGS
3. As well as applying the cross-compilation patch I am attaching;

Comment 1 Tomas Mraz 2012-04-24 08:42:29 UTC
Apparently the code is trying to call SRP functions and reference SRP structures which are not available in our build due to patent issues. You have to ensure that OPENSSL_NO_SRP is defined - you have to find out why it is not defined in the cross build when on the regular build it is defined.

Comment 2 Mr-4 2012-04-25 22:55:43 UTC
OK, I modified RPM_OPT_FLAGS so that RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wa,--noexecstack -march=armv6j -mtune=arm1136jf-s -mthumb-interwork -mno-thumb -DPURIFY -DOPENSSL_NO_SRP"

I progress further, but make then chokes on the test directory:

make[1]: Entering directory `/builddir/build/BUILD/openssl-1.0.1a/test'
armv6l-redhat-linux-uclibcgnueabi-gcc -I.. -I../include  -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIO -Wall -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=armv6j -mtune=arm1136jf-s -mthumb-interwork -mno-thumb -Wa,--noexecstack -march=armv6j -mtune=arm1136jf-s -mthumb-interwork -mno-thumb -DPURIFY -DOPENSSL_NO_SRP   -c -o bntest.o bntest.c
bntest.c: In function 'test_gf2m_add':
bntest.c:1080:3: warning: implicit declaration of function 'BN_GF2m_add' [-Wimplicit-function-declaration]
bntest.c: In function 'test_gf2m_mod':
bntest.c:1131:2: warning: implicit declaration of function 'BN_GF2m_arr2poly' [-Wimplicit-function-declaration]
bntest.c:1139:4: warning: implicit declaration of function 'BN_GF2m_mod' [-Wimplicit-function-declaration]
bntest.c: In function 'test_gf2m_mod_mul':
bntest.c:1202:4: warning: implicit declaration of function 'BN_GF2m_mod_mul' [-Wimplicit-function-declaration]
bntest.c: In function 'test_gf2m_mod_sqr':
bntest.c:1267:4: warning: implicit declaration of function 'BN_GF2m_mod_sqr' [-Wimplicit-function-declaration]
bntest.c: In function 'test_gf2m_mod_inv':
bntest.c:1326:4: warning: implicit declaration of function 'BN_GF2m_mod_inv' [-Wimplicit-function-declaration]
bntest.c: In function 'test_gf2m_mod_div':
bntest.c:1384:4: warning: implicit declaration of function 'BN_GF2m_mod_div' [-Wimplicit-function-declaration]
bntest.c: In function 'test_gf2m_mod_exp':
bntest.c:1448:4: warning: implicit declaration of function 'BN_GF2m_mod_exp' [-Wimplicit-function-declaration]
bntest.c: In function 'test_gf2m_mod_sqrt':
bntest.c:1518:4: warning: implicit declaration of function 'BN_GF2m_mod_sqrt' [-Wimplicit-function-declaration]
bntest.c: In function 'test_gf2m_mod_solve_quad':
bntest.c:1575:4: warning: implicit declaration of function 'BN_GF2m_mod_solve_quad' [-Wimplicit-function-declaration]
make[2]: Entering directory `/builddir/build/BUILD/openssl-1.0.1a/test'
bntest.o: In function `test_gf2m_mod':
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1131: undefined reference to `BN_GF2m_arr2poly'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1132: undefined reference to `BN_GF2m_arr2poly'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1139: undefined reference to `BN_GF2m_mod'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1154: undefined reference to `BN_GF2m_add'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1155: undefined reference to `BN_GF2m_mod'
bntest.o: In function `test_gf2m_mod_mul':
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1192: undefined reference to `BN_GF2m_arr2poly'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1193: undefined reference to `BN_GF2m_arr2poly'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1202: undefined reference to `BN_GF2m_mod_mul'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1219: undefined reference to `BN_GF2m_add'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1220: undefined reference to `BN_GF2m_mod_mul'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1221: undefined reference to `BN_GF2m_mod_mul'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1222: undefined reference to `BN_GF2m_add'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1223: undefined reference to `BN_GF2m_add'
bntest.o: In function `test_gf2m_mod_sqr':
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1259: undefined reference to `BN_GF2m_arr2poly'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1260: undefined reference to `BN_GF2m_arr2poly'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1267: undefined reference to `BN_GF2m_mod_sqr'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1269: undefined reference to `BN_GF2m_mod_mul'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1286: undefined reference to `BN_GF2m_add'
bntest.o: In function `test_gf2m_mod_inv':
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1318: undefined reference to `BN_GF2m_arr2poly'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1319: undefined reference to `BN_GF2m_arr2poly'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1326: undefined reference to `BN_GF2m_mod_inv'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1327: undefined reference to `BN_GF2m_mod_mul'
bntest.o: In function `test_gf2m_mod_div':
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1375: undefined reference to `BN_GF2m_arr2poly'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1376: undefined reference to `BN_GF2m_arr2poly'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1384: undefined reference to `BN_GF2m_mod_div'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1385: undefined reference to `BN_GF2m_mod_mul'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1386: undefined reference to `BN_GF2m_mod_div'
bntest.o: In function `test_gf2m_mod_exp':
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1438: undefined reference to `BN_GF2m_arr2poly'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1439: undefined reference to `BN_GF2m_arr2poly'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1448: undefined reference to `BN_GF2m_mod_exp'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1449: undefined reference to `BN_GF2m_mod_exp'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1450: undefined reference to `BN_GF2m_mod_mul'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1452: undefined reference to `BN_GF2m_mod_exp'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1473: undefined reference to `BN_GF2m_add'
bntest.o: In function `test_gf2m_mod_sqrt':
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1509: undefined reference to `BN_GF2m_arr2poly'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1510: undefined reference to `BN_GF2m_arr2poly'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1517: undefined reference to `BN_GF2m_mod'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1518: undefined reference to `BN_GF2m_mod_sqrt'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1519: undefined reference to `BN_GF2m_mod_sqr'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1532: undefined reference to `BN_GF2m_add'
bntest.o: In function `test_gf2m_mod_solve_quad':
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1567: undefined reference to `BN_GF2m_arr2poly'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1568: undefined reference to `BN_GF2m_arr2poly'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1575: undefined reference to `BN_GF2m_mod_solve_quad'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1575: undefined reference to `BN_GF2m_mod_solve_quad'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1579: undefined reference to `BN_GF2m_mod_sqr'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1580: undefined reference to `BN_GF2m_add'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1581: undefined reference to `BN_GF2m_mod'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1596: undefined reference to `BN_GF2m_add'
bntest.o: In function `test_gf2m_add':
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1080: undefined reference to `BN_GF2m_add'
/builddir/build/BUILD/openssl-1.0.1a/test/bntest.c:1101: undefined reference to `BN_GF2m_add'
collect2: ld returned 1 exit status
make[2]: *** [link_app.gnu] Error 1
make[2]: Leaving directory `/builddir/build/BUILD/openssl-1.0.1a/test'
make[1]: *** [bntest] Error 2
make[1]: Leaving directory `/builddir/build/BUILD/openssl-1.0.1a/test'
make: *** [build_tests] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.cXtJeI (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.cXtJeI (%build)

I "fixed" that by executing "rm -rdf test/" in %prep as I have disabled the tests anyway (my BUILD arch is x86_64, so execution of ARMv6l won't be possible) and after this compilation succeeded, though I am not 100% sure whether setting -DOPENSSL_NO_SRP globally and then removing test/ completely is the right thing to do (any side effects?)...

Comment 3 Mr-4 2012-05-03 00:17:45 UTC
Update for 1.0.1b: The situation is exactly the same as I reported at the top of this bug, with getting exactly the same errors (Comment 2) when apply the workaround with -DOPENSSL_NO_SRP. 

Again, removing/wiping out the whole test/* directory does the trick, though my concern is still valid - should I really be doing this?

Comment 4 Tomas Mraz 2012-05-03 06:25:39 UTC
There is no sense in building the tests in a cross build as you cannot run them on the build host and they are not shipped in the package.
This is one of the reasons why cross builds should never be used for building regular Fedora packages.

Comment 5 Fedora End Of Life 2013-04-03 17:53:36 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 6 Fedora End Of Life 2015-01-09 17:08:00 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Fedora End Of Life 2015-02-17 14:14:25 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.