Hi Richard,

the clock_nanosleep test fails in 6 of 49 built targets of Buildroot: 
br-arm-full-nothread, br-bfin-full, br-m68k-68040-full, 
br-microblazeel-full, br-openrisc-uclibc, br-sparc-uclibc.
They all use uclibc.

I'm not a uclibc expert, so I can't answer under what conditions 
clock_nanosleep is defined. TYou would need to ask the uclibc authors.
But I don't see any configuration options for uclibc in Buildroot, the 
existence of clock_nanosleep seems to be rather uclibc version and 
platform dependent.

This is the error why it fails in all 6 cases:

/tmp/br-testpkg1/br-arm-full-nothread/host/usr/bin/arm-linux-gcc -Wall 
-DVER=1.8  -D_GNU_SOURCE -DHAVE_CLOCK_ADJTIME -DHAVE_POSIX_SPAWN 
-DHAVE_ONESTEP_SYNC  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 
-D_FILE_OFFSET_BITS=64  -Os    -c -o phc_ctl.o phc_ctl.c
phc2sys.c: In function ‘do_loop’:
phc2sys.c:618:3: warning: implicit declaration of function 
‘clock_nanosleep’ [-Wimplicit-function-declaration]
    clock_nanosleep(CLOCK_MONOTONIC, 0, &interval, NULL);
    ^

phc2sys.o: In function `do_loop':
phc2sys.c:(.text+0xdb0): undefined reference to `clock_nanosleep'


On some targets clock_nanosleep doesn't exist in time.h at all, on some 
it's defined there but is conditioned by either:


# ifdef __USE_POSIX199309


or


#  if defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__
#   ifdef __UCLIBC_HAS_THREADS_NATIVE__



I neither understand or share your aversion to the autoconf approach. It 
is a standard and well working solution. In my view it is the best 
possible approach when running on a potentially unknown system.
I've just brought my two cents in the form of a pragmatic and working 
proposal. If you have a better idea, feel free to implement it. 
Currently linuxptp seems to rather fail with uclibc.

Regards
Petr



On 21/05/17 21:10, Richard Cochran wrote:
> On Mon, May 15, 2017 at 11:37:05PM +0200, Petr Kulhavy wrote:
>> However it is too weak. On some targets clock_nanosleep is defined
>> conditionally in #if preprocessor directives.
>> There is no way to detect that with grep.
> Is this a configuration option for uClibc?  If so, then correct
> solution is to enable that option in the library.
>
> Or is clock_nanosleep always available starting with a particular
> uClibc version?  In that case, a version check in linuxptp would be
> acceptable.
>
>> I'm trying to get linuxptp into Buildroot so that it compiles on all 49
>> targets.
> I'll try to accommodate you, but:
>
>>> We are not going to start compiling fragments like autotools.
> Thanks,
> Richard



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to