Errror building libdivecomputer

Jef Driesen jefdriesen at telenet.be
Mon Sep 10 07:11:28 PDT 2012


On 2012-09-10 15:41, Lubomir I. Ivanov wrote:
> On 10 September 2012 16:25, Jef Driesen <jefdriesen at telenet.be> 
> wrote:
>> Try running:
>>
>> autoreconf --install --force
>>
>> I noticed that sometimes after a distribution upgrade, some of the 
>> autoconf
>> generated file are still at an old versions. With the --force flag 
>> you get
>> the latest again. No idea is that is the problem here, but it's 
>> worth a try.
>>
>
> thanks, but i remember trying that as well.
> i'm quite happy with the "build.sh" except that i have to make
> modifications after each "git pull".
> on the other hand don't really have much time to find solutions or
> re-install.
> also haven't tried using autreconf for other libraries recently...
>
>> Not sure what you mean with exotic macros and functions. There is 
>> mainly
>> standard termios stuff, with a few Linux and Mac OS X specific 
>> extra's. But
>> those are all inside #ifdef's. In theory it should compile on most 
>> unix like
>> systems.
>>
>> The only macros I see in this thread, are the ones you instructed to 
>> add:
>>
>>
>> #define HAVE_LINUX_SERIAL_H
>> #define __USE_BSD
>> #define __USE_POSIX199309
>>
>> I don't know why these would make any difference. Hence my question.
>
> without the macros:
>
> serial_posix.c: In function ‘serial_configure’:
> serial_posix.c:372: error: storage size of ‘ss’ isn’t known
> serial_posix.c:380: error: ‘ASYNC_SPD_MASK’ undeclared (first use in
> this function)
> serial_posix.c:380: error: (Each undeclared identifier is reported 
> only once
> serial_posix.c:380: error: for each function it appears in.)
> serial_posix.c:381: error: ‘ASYNC_SPD_CUST’ undeclared (first use in
> this function)
> serial_posix.c: In function ‘serial_read’:
> serial_posix.c:480: warning: implicit declaration of function 
> ‘timeradd’
> serial_posix.c:483: warning: implicit declaration of function 
> ‘timercmp’
> serial_posix.c:483: error: expected expression before ‘<’ token
> serial_posix.c:484: warning: implicit declaration of function 
> ‘timersub’
> serial_posix.c:486: warning: implicit declaration of function 
> ‘timerclear’
> serial_posix.c: In function ‘serial_sleep’:
> serial_posix.c:771: warning: implicit declaration of function 
> ‘nanosleep’
>
> gcc version 4.4.5 (Debian 4.4.5-8)

The ASYNC_SPD_MASK error is probably because you are not using 
autotools to build the library. Normally, the <linux/serial.h> header is 
autodetected and the HAVE_LINUX_SERIAL_H gets defined (or not).

For the implicit declarations, I suspect that is because you are using 
the -std=c99 option, while autotools defaults to -std=gnu99. Thus the 
required GNU, BSD and/or posix extensions are automatically enabled with 
autotools, but not with your custom build script.

BTW, the __USE_XXX macros are definitely the wrong choice. You should 
be using the _XXX_SOURCE feature test macros. See "man 
feature_test_macros" for more details.

I think that if you use -std=gnu99 and -DHAVE_LINUX_SERIAL_H it will 
work fine without any changes to source code. Of course the preferred 
way is still to build with autotools. There might be more changes in the 
future that will break your custom script.

Jef


More information about the subsurface mailing list