Bug 787779 - hard-coded gcc/ld options in menuselect/Makefile & utils/Makefile prevents cross-compilation
Summary: hard-coded gcc/ld options in menuselect/Makefile & utils/Makefile prevents cr...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: asterisk
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jeffrey C. Ollie
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-06 17:43 UTC by Mr-4
Modified: 2015-02-17 14:05 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-17 14:05:28 UTC
Type: ---


Attachments (Terms of Use)
asterisk patch allowing cross-compilation (21.16 KB, patch)
2012-02-06 17:45 UTC, Mr-4
no flags Details | Diff
menuselect/Makefile & utils/Makefile corrections allowing cross-compilation (2.80 KB, patch)
2012-02-06 17:46 UTC, Mr-4
no flags Details | Diff

Description Mr-4 2012-02-06 17:43:44 UTC
Description of problem:
gcc/ld options in menuselect/Makefile & utils/Makefile are hard-coded (worse still, previously set CFLAGS/LDFLAGS/ASTFLAGS are completely ignored, even if they are included!) causing cross-compilation to fail.

Version-Release number of selected component (if applicable):
10.0.0 (RAWHIDE)

How reproducible:
Always

Steps to Reproduce:
1. rpmbuild --target=i686 asterisk.spec (assuming the build=x86_64 or anything other than the target - i686)
2.
3.
  
Actual results:
Output similar to the following:

/usr/bin/ld: i386 architecture of input file `mxml/libmxml.a(mxml-file.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `mxml/libmxml.a(mxml-node.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `mxml/libmxml.a(mxml-search.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `mxml/libmxml.a(mxml-private.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `mxml/libmxml.a(mxml-string.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `mxml/libmxml.a(mxml-entity.o)' is incompatible with i386:x86-64 output
collect2: ld returned 1 exit status
make[1]: *** [menuselect] Error 1
make[1]: Leaving directory `/home/mr-4/rpmbuild/BUILD/asterisk-10.0.0/menuselect'
make: *** [menuselect/menuselect] Error 2
make: *** Waiting for unfinished jobs....
main res addons 
error: Bad exit status from /var/tmp/rpm-tmp.qRUoKX (%build)

[...]

gcc -g -c -I/home/mr-4/rpmbuild/BUILD/asterisk-10.0.0/include -DSTANDALONE /home/mr-4/rpmbuild/BUILD/asterisk-10.0.0/main/ast_expr2f.c -o ast_expr2fz.o
gcc -g -c -I/home/mr-4/rpmbuild/BUILD/asterisk-10.0.0/include -DSTANDALONE2 /home/mr-4/rpmbuild/BUILD/asterisk-10.0.0/main/ast_expr2.c -o ast_expr2z.o
gcc -g -o check_expr2 ast_expr2fz.o ast_expr2z.o -lm

The above produces build arch binary (x86_64 instead of i686): "check_expr2" in this case.

Expected results:
menuselect & utils Makefile(s) to honour ASTCFLAGS/CFLAGS/LDFLAGS as set during build (better still, use Makefile.in and autoconf instead)

Additional info:

I am attaching two patches - asterisk-cross.patch, as well as asterisk-spec.patch. Together they should make cross-compilation of asterisk possible.

Please note that asterisk-spec.patch contains *all* changes I've made to the original asterisk.spec file - that includes what I reported in Bug 787389 as well as Bug 787387. 

Some necessary dependencies were also omitted from the original file (like SDL*), so they were added back in that patch.

With these two patches applied cross-compilation is enabled and made possible.

Comment 1 Mr-4 2012-02-06 17:45:03 UTC
Created attachment 559702 [details]
asterisk patch allowing cross-compilation

Comment 2 Mr-4 2012-02-06 17:46:28 UTC
Created attachment 559703 [details]
menuselect/Makefile & utils/Makefile corrections allowing cross-compilation

Comment 3 Jeffrey C. Ollie 2012-02-06 19:15:54 UTC
The changes to the Asterisk makefiles should be taken upstream.  I really don't want to be adding more patches that would need to be maintained locally, there are already too many as it is.  I'll take a look at the patches to the specfile soon as I need to get some updates out soon.

Comment 4 Mr-4 2012-02-06 19:32:13 UTC
I can't just "take them upstream" because both patches need to be applied in tandem - one without the other won't help much in cross-compilation environment, simply because the CFLAGS/ASTCFLAGS/LDFLAGS environment variables are not set/respected by a "vanilla" build (the build would simply fail).

The .spec patch first enables this and it also fixes some important dependency issues where cross-compilation is concerned (setting the correct bit-ness as well as host-arch libraries dependencies).

Comment 5 Jeffrey C. Ollie 2012-02-06 19:56:01 UTC
Obviously, the .spec file patch can't go upstream, but the changes to the Makefiles certainly can.  I'm sure that there are people that would like to cross-compile Asterisk on platforms other than Fedora that would appreciate the patches.

Comment 6 Fedora End Of Life 2013-04-03 15:11:42 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 7 Fedora End Of Life 2015-01-09 16:59:15 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 8 Fedora End Of Life 2015-02-17 14:05:28 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.


Note You need to log in before you can comment on or make changes to this bug.