Coding for cross compilation

Coding for cross compilation

Post by Nathan Goin » Sat, 28 Jun 2003 15:57:52



what compiler directives can I use to determine the operating system the
program is being compiled on?

thanks,
nathan

 
 
 

Coding for cross compilation

Post by Ed L Cashi » Sun, 29 Jun 2003 13:02:34



> what compiler directives can I use to determine the operating system the
> program is being compiled on?

You mean pre-defined preprocessor macros like "__sun" and "Linux"?

I don't think there's an easier way than to run gcc on all
architectures you're interested in:


  #define __GCC_NEW_VARARGS__ 1
  #define __sparc 1
  #define __svr4__ 1
  #define __GNUC_MINOR__ 95
  #define __sun 1
  #define sparc 1
  #define __sun__ 1
  #define __unix 1
  #define __unix__ 1
  #define __SVR4 1
  #define sun 1
  #define __GNUC__ 2
  #define __sparc__ 1
  #define unix 1


  #define __linux__ 1
  #define linux 1
  #define __i386__ 1
  #define __i386 1
  #define __GNUC_MINOR__ 95
  #define i386 1
  #define __unix 1
  #define __unix__ 1
  #define __GNUC__ 2
  #define __linux 1
  #define __ELF__ 1
  #define unix 1

--
--Ed L Cashin     PGP public key: http://noserose.net/e/pgp/

 
 
 

Coding for cross compilation

Post by Bjorn Rees » Sun, 29 Jun 2003 23:46:14



> what compiler directives can I use to determine the operating system the
> program is being compiled on?

http://predef.sourceforge.net/
 
 
 

Coding for cross compilation

Post by Ed L Cashi » Mon, 30 Jun 2003 03:04:51




>> what compiler directives can I use to determine the operating system the
>> program is being compiled on?

> http://predef.sourceforge.net/

Hey, cool.  I forgot about that.

--
--Ed L Cashin     PGP public key: http://noserose.net/e/pgp/

 
 
 

Coding for cross compilation

Post by Geoff Clar » Thu, 03 Jul 2003 01:57:49




>> what compiler directives can I use to determine the operating system the
>> program is being compiled on?
>You mean pre-defined preprocessor macros like "__sun" and "Linux"?
>I don't think there's an easier way than to run gcc on all
>architectures you're interested in:

[snip]


>  #define __linux__ 1
>  #define linux 1
>  #define __i386__ 1
>  #define __i386 1
>  #define __GNUC_MINOR__ 95
>  #define i386 1
>  #define __unix 1
>  #define __unix__ 1
>  #define __GNUC__ 2
>  #define __linux 1
>  #define __ELF__ 1
>  #define unix 1

Note that the symbols that don't begin with "__" should not be
relied on, as they are not always defined.  Use the "__" equivalents
instead.

$ diff -u <(echo | gcc -E -dM -) <(echo | gcc -ansi -E -dM -)
--- /dev/fd/3   Tue Jul  1 17:50:28 2003

 #define __linux__ 1
-#define linux 1
+#define __STRICT_ANSI__ 1
 #define __i386__ 1
 #define __i386 1
 #define __GNUC_MINOR__ 95
-#define i386 1
 #define __unix 1
 #define __unix__ 1
 #define __GNUC__ 2
 #define __linux 1
 #define __ELF__ 1
-#define unix 1

--

 
 
 

1. Cross compilation compilation problems

I am trying to compile the binutils package in order to have a
Sun gcc executable that will create linux binaries.

I am on a Sun 4.1.3.

Some of the problems arise from (in binutils 9l.4) from a MISSING
getopt.h file and no demangle.h file.  Apparently SunOS doesn't
sidtribute getopt.h, or my local sysadmin's didn't think anyone
would require it.

Problems arising from binutils .9l.3 are the confusion with the
a.out.h file, either missing certain #define's, or being included
poorly.

The documentation for making the binutils package is rather obtuse.

If someone _has_ a binary distribution of a SunOS 4.1.x -> linux compiler,
that would be _great_, and if not, then how do I fix up the
makefiles and header files for either version of binutils?

Thanks.

(The traffic here is terrific)

-Will

http://www.rpi.edu/~pier1/

2. XENIX for the 8088

3. viewml cross compilation problem

4. /dev/cua0 not accessible with uucp / dialin bizarre ?

5. Kernel cross compilation?

6. why is my network running at 9600 baud?

7. Trouble with Cross compilation on Linux - i386

8. Free Copy

9. cross-compilation?

10. cross-compilation

11. sun solaris -> linux pc - gcc cross-compilation

12. Cross compilation/assembler for 11/73 under Ultrix

13. HELP: on "configure" utility for cross-compilation