On Mon, Apr 14, 2014 at 9:36 PM, chris <chgans@xxxxxxxxxxxxxx> wrote:
> On 15/04/14 02:55, Unidata UDUNITS Support wrote:
>>
>> Chris,
>>
>> [I've driven your inquiry into our support-email system so that others can
>> benefit.]
>>
>>> Hi there,
>>>
>>> Using master or d98f047 (v2.2.3), I ran into build problems. For some
>>> reason libudunits2.so isn't build with -lm, causing the build of the
>>> udunits2 bin to fail.
>>
>>
>> I belive the "-lm" option should be used when you build an application and
>> not when the UDUNITS sharable library is built.
>>
>>> My quick workaround was to rebuild the lib "manually" by appending "-lm"
>>> to
>>> the original CC command.
>>
>>
>> You've likely just added the math library to the UDUNITS library. You can
>> check for this via the nm(1) utility.
>
>
> My point is: The latest udunits doesn't build on ubuntu:
>
> $ rm -Rf build && mkdir build && cd build
> $ cmake ..
> $ make
> Scanning dependencies of target udunits2_doc
> [ 5%] Built target udunits2_doc
> Scanning dependencies of target libudunits2
> [ 10%] Building C object lib/CMakeFiles/libudunits2.dir/converter.c.o
> [ 15%] Building C object lib/CMakeFiles/libudunits2.dir/error.c.o
> [ 21%] Building C object lib/CMakeFiles/libudunits2.dir/formatter.c.o
> [ 26%] Building C object lib/CMakeFiles/libudunits2.dir/idToUnitMap.c.o
> [ 31%] Building C object lib/CMakeFiles/libudunits2.dir/parser.c.o
> [ 36%] Building C object lib/CMakeFiles/libudunits2.dir/prefix.c.o
> [ 42%] Building C object lib/CMakeFiles/libudunits2.dir/status.c.o
> [ 47%] Building C object lib/CMakeFiles/libudunits2.dir/systemMap.c.o
> [ 52%] Building C object lib/CMakeFiles/libudunits2.dir/unitAndId.c.o
> [ 57%] Building C object lib/CMakeFiles/libudunits2.dir/unitcore.c.o
> [ 63%] Building C object lib/CMakeFiles/libudunits2.dir/unitToIdMap.c.o
> [ 68%] Building C object lib/CMakeFiles/libudunits2.dir/ut_free_system.c.o
> [ 73%] Building C object lib/CMakeFiles/libudunits2.dir/xml.c.o
> Linking C shared library libudunits2.so
> [ 84%] Built target libudunits2
> Scanning dependencies of target udunits2lib_doc
> [ 89%] Built target udunits2lib_doc
> Scanning dependencies of target udunits2
> [ 94%] Building C object prog/CMakeFiles/udunits2.dir/udunits2.c.o
> Linking C executable udunits2
> ../lib/libudunits2.so: undefined reference to `fmod'
> ../lib/libudunits2.so: undefined reference to `exp'
> ../lib/libudunits2.so: undefined reference to `log'
> ../lib/libudunits2.so: undefined reference to `pow'
> ../lib/libudunits2.so: undefined reference to `log10'
> ../lib/libudunits2.so: undefined reference to `floor'
> collect2: error: ld returned 1 exit status
> make[2]: *** [prog/udunits2] Error 1
> make[1]: *** [prog/CMakeFiles/udunits2.dir/all] Error 2
> make: *** [all] Error 2
>
> The only way to fix it is to tell gcc that libudunits depends on libm while
> generating the .so:
>
> Original command:
> /usr/bin/cc -fPIC -shared -Wl,-soname,libudunits2.so -o libudunits2.so
> [...] -lexpat
> Fixed command:
> /usr/bin/cc -fPIC -shared -Wl,-soname,libudunits2.so -o libudunits2.so
> [...] -lexpat -lm
>
> After the fix:
> $ make
> [ 5%] Built target udunits2_doc
> [ 84%] Built target libudunits2
> [ 89%] Built target udunits2lib_doc
> Linking C executable udunits2
> [ 94%] Built target udunits2
> Scanning dependencies of target udunits2prog_doc
> [100%] Built target udunits2prog_doc
>
This may be related to this:
https://wiki.ubuntu.com/NattyNarwhal/ToolchainTransition