Bug 6669 - Xlib won't cross compile
Summary: Xlib won't cross compile
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xlib (show other bugs)
Version: git
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords: patch
: 6214 13463 16484 20981 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-04-20 05:38 UTC by Ian Romanick
Modified: 2010-12-03 16:39 UTC (History)
6 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Ugly patch to build makekeys when crosscompiling (687 bytes, patch)
2006-04-20 05:40 UTC, Ian Romanick
no flags Details | Splinter Review
libX11-cross-fix-1.2.2.patch (827 bytes, patch)
2009-09-11 08:24 UTC, Pierre Ossman
no flags Details | Splinter Review

Description Ian Romanick 2006-04-20 05:38:17 UTC
There are numerous problems with trying to cross compile Xlib (either the old
version in CVS or the new version in git).  In all cases --target was specified
with the desired target architecture.  I have a correctly installed cross
compiler (yay crosstools) installed called ${TARGET}-gcc, etc.

1. Specifying --host to autogen.sh results in the warning:

configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.

2. Specifying either --build alone or with --host to autogen.sh results in the
error:

checking whether the C compiler works... configure: error: cannot run C compiled
programs.
If you meant to cross compile, use `--host'.

3. When --host is specified and CC, AR, RANLIB, and CCLD are over-ridden to
specify the desicred cross tools, building in src/util incorrectly uses that
compiler for the target system instead of the compiler for the host system.

I've tried various gymnastics in src/util/Makefile.am, but I just can't get it
to do the right thing.  I managed to hack something up that will at least build
right, but, since it doesn't use the proper macros, the clean targets are not
properly generated.  I will attach that patch shortly.

I have literally spent 2 days trying to get this to work.  I'm so frustrated
with it that I want imake back!!! :(  It is a tragic mistake that we have zero
documentation (at least zero that I could find) on how to actually *use* our
build system.  The little bit that is in
http://wiki.x.org/wiki/ModularDevelopersGuide is no where near sufficient for
anyone trying to modify or create either Makefile.am or configure.ac files in
this project.

Ugh.
Comment 1 Ian Romanick 2006-04-20 05:40:00 UTC
Created attachment 5388 [details] [review]
Ugly patch to build makekeys when crosscompiling

This the patch mentioned in the initial bug report.
Comment 2 Daniel Stone 2006-04-20 05:49:23 UTC
Cross-compiling is a bit of a horror show minefield that is incredibly difficult
to get right, with any build system.

If Scratchbox continues to annoy me here, I'll start looking into making the
whole stack cross-compilable.
Comment 3 Ian Romanick 2006-04-25 11:41:34 UTC
See also http://xorg.freedesktop.org/wiki/CrossCompilingXorg
Comment 4 Donnie Berkholz 2006-06-05 12:39:07 UTC
*** Bug 6214 has been marked as a duplicate of this bug. ***
Comment 5 Daniel Stone 2007-02-27 01:31:40 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 6 Julien Cristau 2009-02-17 05:53:58 UTC
should be fixed since 1.1.99.2
Comment 7 Julien Cristau 2009-02-17 06:16:23 UTC
*** Bug 13463 has been marked as a duplicate of this bug. ***
Comment 8 Julien Cristau 2009-02-17 06:28:29 UTC
*** Bug 16484 has been marked as a duplicate of this bug. ***
Comment 9 Julien Cristau 2009-03-31 12:56:51 UTC
*** Bug 20981 has been marked as a duplicate of this bug. ***
Comment 10 Pierre Ossman 2009-09-11 07:31:35 UTC
This is still broken. It uses the native gcc, but it uses LIBS and CFLAGS for the host system.

LIBS can probably be forced to "", but CFLAGS is another matter. We need to access the X11 headers, but we want the native stdio and such. Not sure how to solve it.
Comment 11 Pierre Ossman 2009-09-11 08:24:25 UTC
Created attachment 29415 [details] [review]
libX11-cross-fix-1.2.2.patch

I managed to fix this. It appears that the dependency on the X11 libs is very superficial, and we can avoid the dependency by pulling in the relevant portions directly into makekeys.c.

Included is a patch that clears out CFLAGS and LIB and modifies makekeys.c to build without the X11 headers.
Comment 12 Matt Turner 2010-12-03 16:39:41 UTC
I think this is fixed. Please send a patch to xorg-devel@lists.x.org if it is not. Putting patches on bugzilla is a great way for them to get lost.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.