public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Smith <paul@mad-scientist.net>
To: Jaya Pavan Bhattiprolu <pavanbhattiprolu@gmail.com>
Cc: Andrew Haley <aph@redhat.com>, gcc-help@gcc.gnu.org
Subject: Re: Compiling GCC for different machine on same Architecture
Date: Tue, 02 Sep 2014 16:45:00 -0000	[thread overview]
Message-ID: <1409676309.23200.118.camel@mad-scientist.net> (raw)
In-Reply-To: <CAABpWqfd=AYMphEczj3zyBAwxORfKqw2eTM_pzKedPkr7ph6UA@mail.gmail.com>

> On Tue, Sep 2, 2014 at 8:56 PM, Andrew Haley <aph@redhat.com> wrote:
> > On 09/02/2014 04:07 PM, Jaya Pavan Bhattiprolu wrote:
> >> Can Anyone provide solution or how to achieve this task.
> >
> > Install CentOS 7 in a virtual machine.  Anything else will only
> > and in tears.

On Tue, 2014-09-02 at 21:48 +0530, Jaya Pavan Bhattiprolu wrote:
> You mean its not achievable or its a difficult?

I didn't see the original question (missed it somehow) but it's pretty
straightforward to build software for "other" distributions using modern
versions of GCC... depending on how many dependencies the software has.

For basic system library requirements for a Red Hat system, for example,
you just need to get a copy of the base and "devel" RPMs for each of
those libraries from the release you want to target, unpack them into a
separate directory, then add the --sysroot flag to your invocation of
GCC pointing at that directory.

So for example if you get the glibc, glibc-common, glibc-devel,
glibc-headers, libgcc, and kernel-headers packages from RHEL5 then
unpack them into a directory like "/home/sysrooots/rhel5" (I use cpio
with the --no-absolute-filenames option to unpack the RPM) you'll get
stuff like:

  /home/sysroots/rhel5/usr/include/...
  /home/sysroots/rhel5/usr/lib/...
  /home/sysroots/rhel5/lib/...

etc.

Then run "gcc --sysroot /home/sysroot/rhel5 ..." for both compilation
AND linking.

Obviously if your software needs more libraries you'll have to add more
RPMs, and the farther up the "stack" you go, away from the base system
libraries, the more complex and less portable things become.

      reply	other threads:[~2014-09-02 16:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 15:08 Jaya Pavan Bhattiprolu
2014-09-02 15:26 ` Andrew Haley
2014-09-02 16:18   ` Jaya Pavan Bhattiprolu
2014-09-02 16:45     ` Paul Smith [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1409676309.23200.118.camel@mad-scientist.net \
    --to=paul@mad-scientist.net \
    --cc=aph@redhat.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=pavanbhattiprolu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).