public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Compilation problem
@ 1999-11-05 16:40 Bogus User
  1999-11-06  2:11 ` Martin v. Loewis
  1999-11-30 23:37 ` Bogus User
  0 siblings, 2 replies; 4+ messages in thread
From: Bogus User @ 1999-11-05 16:40 UTC (permalink / raw)
  To: gcc

Hi,

I have a project that has two parts, a server and a client, that we're 
trying to port to Linux.  We need to compile the server on a newer version 
of Linux, so we're using RedHat 6.0.  However, we want to compile the client 
so that it runs on older versions of Linux as well.  The odd twist in all of 
this is that we need to be able to compile for both versions of Linux from 
the same source tree, on the same computer, without dual-booting.

The decision was made to compile on RedHat 6.0, so that's what we're using 
for the build machine.  What I tried to do so far is to copy the compiler 
executables from a RedHat 5.2 machine (gcc-2.7) and use the --nostdinc and 
--nostdlib options.  I then copied over the necessary header and library 
files.  It did finally compile using that setup, but when I try to run the 
executables on a RedHat 5.2 machine it seg faults on startup.  My guess is 
that it's still linking against something on the RedHat 6.0 machine that's 
causing the problem.

I did notice that even though I used the --nostdlib options, if I used 
-lpthread it would still link ok.  I don't have libpthread in any of the 
directories that I list during compilation using -L, so I guess that it is 
still picking up some system stuff from the build machine.  I tried copying 
libpthread from the RedHat 5.2 machine and putting it in one of the listed 
paths, but it didn't fix the problem.

Has anybody tried something similar to this and gotten it to work?

Thanks,
Rich

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

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

* Re: Compilation problem
  1999-11-05 16:40 Compilation problem Bogus User
@ 1999-11-06  2:11 ` Martin v. Loewis
  1999-11-30 23:37   ` Martin v. Loewis
  1999-11-30 23:37 ` Bogus User
  1 sibling, 1 reply; 4+ messages in thread
From: Martin v. Loewis @ 1999-11-06  2:11 UTC (permalink / raw)
  To: bogus_user; +Cc: gcc

> Has anybody tried something similar to this and gotten it to work?

This is, essentially, a cross-compilation. Please read about
installing gcc as a cross compiler. You have to configure gcc for a
different architecture (e.g. i586-redhat52-linux), and then provide
tools and libraries for that architecture (including binutils).

One problem is that you still use the startup files from /usr/lib, use
-nostartfiles to avoid this, use -v to see what else gets linked.

Another problem is that ld *knows* to find things in /lib and
/usr/lib, that's why you need the cross-binutils. I believe you could
avoid building cross-binutils by writing a linker spec file; check out
SEARCH_DIR in the /usr/lib/ldscripts files.

DISCLAIMER: I never installed a cross-compiler myself, so this is all
theory.

Hope this helps,
Martin

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

* Re: Compilation problem
  1999-11-06  2:11 ` Martin v. Loewis
@ 1999-11-30 23:37   ` Martin v. Loewis
  0 siblings, 0 replies; 4+ messages in thread
From: Martin v. Loewis @ 1999-11-30 23:37 UTC (permalink / raw)
  To: bogus_user; +Cc: gcc

> Has anybody tried something similar to this and gotten it to work?

This is, essentially, a cross-compilation. Please read about
installing gcc as a cross compiler. You have to configure gcc for a
different architecture (e.g. i586-redhat52-linux), and then provide
tools and libraries for that architecture (including binutils).

One problem is that you still use the startup files from /usr/lib, use
-nostartfiles to avoid this, use -v to see what else gets linked.

Another problem is that ld *knows* to find things in /lib and
/usr/lib, that's why you need the cross-binutils. I believe you could
avoid building cross-binutils by writing a linker spec file; check out
SEARCH_DIR in the /usr/lib/ldscripts files.

DISCLAIMER: I never installed a cross-compiler myself, so this is all
theory.

Hope this helps,
Martin

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

* Compilation problem
  1999-11-05 16:40 Compilation problem Bogus User
  1999-11-06  2:11 ` Martin v. Loewis
@ 1999-11-30 23:37 ` Bogus User
  1 sibling, 0 replies; 4+ messages in thread
From: Bogus User @ 1999-11-30 23:37 UTC (permalink / raw)
  To: gcc

Hi,

I have a project that has two parts, a server and a client, that we're 
trying to port to Linux.  We need to compile the server on a newer version 
of Linux, so we're using RedHat 6.0.  However, we want to compile the client 
so that it runs on older versions of Linux as well.  The odd twist in all of 
this is that we need to be able to compile for both versions of Linux from 
the same source tree, on the same computer, without dual-booting.

The decision was made to compile on RedHat 6.0, so that's what we're using 
for the build machine.  What I tried to do so far is to copy the compiler 
executables from a RedHat 5.2 machine (gcc-2.7) and use the --nostdinc and 
--nostdlib options.  I then copied over the necessary header and library 
files.  It did finally compile using that setup, but when I try to run the 
executables on a RedHat 5.2 machine it seg faults on startup.  My guess is 
that it's still linking against something on the RedHat 6.0 machine that's 
causing the problem.

I did notice that even though I used the --nostdlib options, if I used 
-lpthread it would still link ok.  I don't have libpthread in any of the 
directories that I list during compilation using -L, so I guess that it is 
still picking up some system stuff from the build machine.  I tried copying 
libpthread from the RedHat 5.2 machine and putting it in one of the listed 
paths, but it didn't fix the problem.

Has anybody tried something similar to this and gotten it to work?

Thanks,
Rich

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

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

end of thread, other threads:[~1999-11-30 23:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-05 16:40 Compilation problem Bogus User
1999-11-06  2:11 ` Martin v. Loewis
1999-11-30 23:37   ` Martin v. Loewis
1999-11-30 23:37 ` Bogus User

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