bugPSPP - Bugs: bug #19003, need q2c to work while...

 
 

bug #19003: need q2c to work while cross-compiling

Submitter:  Ben Pfaff <blp>
Submitted:  Fri 09 Feb 2007 04:59:27 AM UTC
   
 
Category:  Compilation/Portability Severity:  5 - Average
Status:  Fixed Assigned to:  None
Open/Closed:  Closed Release:  None
Effort:  0.00
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 17 Feb 2007 01:35:44 AM UTC, comment #11: 

What advantage does setting $PATH to be all cross-compilers offer?  I've just been doing "configure --host=i586-mingw32msvc --build=i686-linux" and then configure picks up all the cross-tools that have names prefixed with i586-mingw32msvc-*.

If there's a better way to detect $CC_FOR_BUILD, then I'd be happy to adopt it.

Ben Pfaff <blp>
Group administrator
Sat 17 Feb 2007 12:36:44 AM UTC, comment #10: 

On 2/16/07, Ben Pfaff <INVALID.NOREPLY@gnu.org> wrote:

> Here's my proposed solution.  Comments?


It works, basically, but I have to be quite careful what I set CC_FOR_BUILD to.

  •  On my setup I set up the PATH for cross-compiling. Thus if I do not set CC_FOR_BUILD, I get the cc from my cross-compiling path. This only results in an error long after q2c has been built. Perhaps there should be no fallback if CC_FOR_BUILD does not exist, or even better if configure checks that CC_FOR_BUILD  builds binaries that can actually be run on the build host.


My second problem was that if I simply set CC_FOR_BUILD to /usr/bin/gcc, gcc picks up the "as" on the cross-compiling path, which leads to the error:

  /usr/bin/gcc ./src/language/lexer/q2c.c -o ./src/language/lexer/q2c
  as: unrecognized option `-Qy'

Thus I had to set CC_FOR_BUILD to cc_for_build.sh

---- cc_for_build.sh ---
export PATH=$HOST_PATH && $HOST_CC "$@"
---- END ---

In my cross.env I have

...
export CC_FOR_BUILD=`which \`pwd\`/cc_for_build.sh \`pwd\`/../cc_for_build.sh \`pwd\`/../../cc_for_build.sh`
export HOST_CC=`which gcc`
export HOST_PATH=$PATH
PATH="$PREFIX/bin:$PREFIX/$TARGET/bin:$PATH"
...

John C. McCabe-Dansted <gmatht>
Fri 16 Feb 2007 11:27:20 PM UTC, comment #9: 

I just built pspp successfully after doing a clean checkout of both pspp and gnulib, and the patch below. I'm not sure what was causing the trouble before. 'sorry for the noise.

Jason H Stover <jstover>
Group Member
Fri 16 Feb 2007 07:25:24 PM UTC, comment #8: 

I checked this in.

Jason's comments on the quote.c changes still presumably apply to that bug; I've linked to it from there.

Ben Pfaff <blp>
Group administrator
Fri 16 Feb 2007 05:13:40 PM UTC, comment #7: 

Yes. The problem showed after applying the patch and
then running make clean. Now it seems like another problem,
though, since I just saw mbchar.h in the gl/ directory on another machine.

I'll start with a new checkout of pspp and gnulib and see
if the problem persists.

Jason H Stover <jstover>
Group Member
Fri 16 Feb 2007 05:06:18 PM UTC, comment #6: 


>src/libpspp/quote.c:25:20: mbchar.h: No such file or directory


Jason: was this meant to be in response to bug #18860, which introduces libpspp/quote.c?

Ben Pfaff <blp>
Group administrator
Fri 16 Feb 2007 04:57:45 PM UTC, comment #5: 

After applying the patch, a clean build gave
me this error on OBSD 64 bit x86:

src/libpspp/quote.c:25:20: mbchar.h: No such file or directory

Jason H Stover <jstover>
Group Member
Fri 16 Feb 2007 07:57:29 AM UTC, comment #4: 

I think this is good.

The only other thing that needs to be done is to put a note about cross compiling in INSTALL.

In fact, looking at this file, I think there is a lot of generic information of limited usefulness.   I think INSTALL should be rewritten, and there are some things in README, which ought to be moved to INSTALL.

John Darrington <jmd>
Group administrator
Fri 16 Feb 2007 05:49:58 AM UTC, comment #3: 

Here's my proposed solution.  Comments?

CC'ing John M-D because he's been so helpful in this area.

(file #11982)

Ben Pfaff <blp>
Group administrator
Tue 13 Feb 2007 05:53:11 PM UTC, comment #2: 

Unsurprisingly, we are not the first to run into similar problems.  A little bit of looking around turned up common conventions for doing this with Autoconf and Automake:
  http://autoconf-archive.cryp.to/ac_prog_cc_for_build.html
  http://sources.redhat.com/ml/automake/2004-01/msg00152.html
  http://sourceware.org/autobook/autobook/autobook_270.html
Probably we should adopt the macro from that first link.

Ben Pfaff <blp>
Group administrator
Mon 12 Feb 2007 03:20:13 PM UTC, comment #1: 

Rewriting in perl might be a good idea for the longer term.

In the mean time, we could just assume that "cc" invokes a native compiler on the build machine. Or, we could have an extra autoconf option which is required, if autoconf detects that cross compiling is in effect.

John Darrington <jmd>
Group administrator
Fri 09 Feb 2007 04:59:27 AM UTC, original submission:  

The q2c program needs to run on the build architecture, not on the host architecture, but it's not obvious how to make Automake do what we want.  (Maybe we should rewrite q2c in Perl.)

Ben Pfaff <blp>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #11982:  cross-compile-q2c.patch added by blp (5KiB - text/x-patch - patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gmatht (Posted a comment)
  • -email is unavailable- added by jstover (Posted a comment)
  • -email is unavailable- added by jmd (Posted a comment)
  • -email is unavailable- added by blp (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-02-16 blp StatusReady for Test/Review Fixed
        Open/ClosedOpen Closed
    2007-02-16 blp Attached File- Added cross-compile-q2c.patch, #11982
        StatusNone Ready for Test/Review
        Carbon-Copy- Added "john mccabe-dansted" <gmatht@gmail.com>

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code