[GRASS5] Re: pg grass darwin - working

Glynn Clements glynn.clements at virgin.net
Wed Sep 11 20:07:35 EDT 2002


andy agena wrote:

> I won't be able to try config/make/install until tomorrow with  
> --with-gdal, but I'll let you know how it goes.
> 
> I did try the 'gcc -E -dM foo.c', but the only output was '# 1  
> "foo.c"'.  I'm not sure what your '-dM' tag was supposed to do and it  
> doesn't seem to be an option in my gcc, so I've included the options I  
> have for gcc (3.1) below.

OK, on gcc 2.9x, the options are:

`-E'
     Run only the C preprocessor.  Preprocess all the C source files
     specified and output the results to standard output or to the
     specified output file.

`-dM'
     Tell the preprocessor to output only a list of the macro
     definitions that are in effect at the end of preprocessing.  Used
     with the `-E' option.

Both are listed in the "gcc" Info file, under "Preprocessor Options". 
If they've changed in a later version, any equivalent functionality
should be described in the same place.

However, the online docs at:

	http://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Preprocessor-Options.html

suggest that "-dM" should work:

: -dCHARS 
:       CHARS is a sequence of one or more of the following characters, and must not be preceded by a space. Other characters are
:       interpreted by the compiler proper, or reserved for future versions of GCC, and so are silently ignored. If you specify characters
:       whose behavior conflicts, the result is undefined. 
:       M 
:             Instead of the normal output, generate a list of #define directives for all the macros defined during the execution of the
:             preprocessor, including predefined macros. This gives you a way of finding out what is predefined in your version of the
:             preprocessor. Assuming you have no file foo.h, the command 
: 
:             touch foo.h; cpp -dM foo.h
: 
:             will show all the predefined macros. 

BTW, "gcc --help" only displays a tiny fraction of the supported options.

> this is the output from nm LIB.powerpc-apple-darwin6.0/libgeo.a; do I  
> just need to [somehow] get rid of the underscores before the ax, etc?:
> 
> <snip>
> libgeo.a(vars.o):
> 00000050 C _ax
> 00000050 C _ay
> 00000050 C _bx
> 00000050 C _by
> 00000004 C _reg_cnt
> 00000050 C _residuals
> 00000008 C _rms
> 00000028 C _use

I don't think so; if you note, the undefined variables from the error
message included the underscores.

This looks like another MacOS X linking peculiarity. I'm guessing that
it only takes account of *function* definitions (and not variables)
when deciding which object files to include.

It may be possible to work around the problem by adding vars.o to the
list of object files in the relevant Gmakefiles.

Ultimately we should consider moving the variables into some other
file. However, this will only fix the problem if we can be sure that
file will be included due to the functions which it contains. This
requires analysing the way in which libgeo is likely to be used.

> what do I need to do for this 'malloc.h' bug?

AFAICT, simply removing the line:

	#include <malloc.h>

should suffice.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list