public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Compiling GCC for different machine on same Architecture
@ 2014-09-02 15:08 Jaya Pavan Bhattiprolu
  2014-09-02 15:26 ` Andrew Haley
  0 siblings, 1 reply; 4+ messages in thread
From: Jaya Pavan Bhattiprolu @ 2014-09-02 15:08 UTC (permalink / raw)
  To: gcc-help

Hi,

We are trying to build our code base for CentOS 7 machine with x86_64
architecture on CentOS6 with x86_64.

For that we are trying to build a centos7 Toolchain. All the gcc/ld/ar
should be statically linked, so that we are ensuring that it will not
uses any native centos6 stuff.

In this process, we are able to generate statically linked GCC/AR/LD.
But problem was this GCC not generating a statically linked binaries
and fails while checking flags during configure at "checking static
flag -static ".
Due to this while running those binaries it refers to native libgcc and fails.

We are using the below command for configure.
../gcc../configure -prefix=/mnt/data0/toolchain-vm-temp2
--build=x86_64-CentOS7-linux-gnu
-with-sysroot=/mnt/data0/tools/gnutools/toolchain-vm --disable-nls
--disable-multilib --enable-languages=c,c++ --disable-sim
--enable-symvers=gnu --enable__cxa_atexit  --enable-lto --with-gnu-ld
--enable-static

Can Anyone provide solution or how to achieve this task.

--
Thanks,
Pavan Bhattiprolu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiling GCC for different machine on same Architecture
  2014-09-02 15:08 Compiling GCC for different machine on same Architecture Jaya Pavan Bhattiprolu
@ 2014-09-02 15:26 ` Andrew Haley
  2014-09-02 16:18   ` Jaya Pavan Bhattiprolu
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Haley @ 2014-09-02 15:26 UTC (permalink / raw)
  To: Jaya Pavan Bhattiprolu, gcc-help

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.

Andrew.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiling GCC for different machine on same Architecture
  2014-09-02 15:26 ` Andrew Haley
@ 2014-09-02 16:18   ` Jaya Pavan Bhattiprolu
  2014-09-02 16:45     ` Paul Smith
  0 siblings, 1 reply; 4+ messages in thread
From: Jaya Pavan Bhattiprolu @ 2014-09-02 16:18 UTC (permalink / raw)
  To: Andrew Haley; +Cc: gcc-help

Hi Andrew,

You mean its not achievable or its a difficult?

Thanks,
Pavan

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.
>
> Andrew.
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiling GCC for different machine on same Architecture
  2014-09-02 16:18   ` Jaya Pavan Bhattiprolu
@ 2014-09-02 16:45     ` Paul Smith
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Smith @ 2014-09-02 16:45 UTC (permalink / raw)
  To: Jaya Pavan Bhattiprolu; +Cc: Andrew Haley, gcc-help

> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-02 16:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-02 15:08 Compiling GCC for different machine on same Architecture 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 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).