[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
20050314: compiling udunits requires -lm on mandrake
- Subject: 20050314: compiling udunits requires -lm on mandrake
- Date: Mon, 14 Mar 2005 09:17:55 -0700
Patrice,
> To: address@hidden
> From: Patrice Dumas <address@hidden>
> Subject: compiling udunits requires -lm on mandrake
> Organization: ?
> Keywords: 200503111801.j2BI1uv2007313 UDUNITS Mandrake Linux
The above message contained the following:
> I tried to rebuild udunits 1.12.4 on mandrake 10.1. First I had to add
> CPPFLAGS='-Df2cFortran'. No trouble so far.
That C macro is necessary for Linux systems that use the gcc(1) and
f77(1) compilers. The file INSTALL contains an example of this.
> I had the following error when building with the default:
> [dumas@patoune src]$ ./configure CPPFLAGS='-Df2cFortran'
> ...
> make[1]: Entering directory `/home/dumas/src/udunits-1.12.4/src/udunits'
> make[2]: Entering directory `/home/dumas/src/udunits-1.12.4/src/udunits'
> c89 -c -g -O2 -I../lib -I../port/misc -Df2cFortran udunits.c
Your c89(1) compiler accepts the "-O2" option. Interesting. It
shouldn't.
> udunits.c: In function `main':
> udunits.c:95: error: `_POSIX_MAX_INPUT' undeclared (first use in this
> function)
> udunits.c:95: error: (Each undeclared identifier is reported only once
> udunits.c:95: error: for each function it appears in.)
> make[2]: *** [udunits.o] Erreur 1
It's likely that a C macro must be defined in order for the c89(1)
compiler to see the Standard UNIX definitions. I wonder if
CPPFLAGS='-Df2cFortran -D_XOPEN_SOURCE=500'
would work?
> With CC='gcc' it passes that point, and I get an error during linking:
> gcc -o udunits -g -O2 udunits.o -L/home/dumas/src/udunits-1.12.4/src/lib
> -ludunits -L/home/dumas/src/udunits-1.12.4/src/port/misc -ludport
> /home/dumas/src/udunits-1.12.4/src/lib/libudunits.a(utlib.o)(.text+0x45a): In
> function `dectime':
> /home/dumas/src/udunits-1.12.4/src/lib/utlib.c:366: undefined reference to
> `fmod'
> /home/dumas/src/udunits-1.12.4/src/lib/libudunits.a(utlib.o)(.text+0xc36): In
> function `utRaise':
> /home/dumas/src/udunits-1.12.4/src/lib/utlib.c:807: undefined reference to
> `pow'
> /home/dumas/src/udunits-1.12.4/src/lib/libudunits.a(utlib.o)(.text+0x1096):
> In function `utPrint':
> /usr/include/bits/mathinline.h:541: undefined reference to `log10'
> collect2: ld returned 1 exit status
>
> It doesn't find libm. There wasn't a way to give arguments to the link
> command for udunits. Therefore I added to udunits/Makefile.in the line
>
> LDFLAGS = @LDFLAGS@
>
> and called
> ./configure CPPFLAGS='-Df2cFortran' LDFLAGS='-lm' CC='gcc'
You could have also set the environment variable LIBS before executing
the configure(1) script. For example
LIBS=-lm ./configure ...
The file INSTALL has examples of this.
> Everything seems right now.
Great!
Thanks for the feedback.
> Pat
Regards,
Steve Emmerson
> NOTE: All email exchanges with Unidata User Support are recorded in the
> Unidata inquiry tracking system and then made publicly available
> through the web. If you do not want to have your interactions made
> available in this way, you must let us know in each email you send to us.