gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-users] Raspberry Pi C11 compile issue


From: Neil Green
Subject: Re: [gpsd-users] Raspberry Pi C11 compile issue
Date: Sun, 12 Mar 2017 23:41:45 +0000

Gary,

Compiling GPSD without C11 gives the less than satisfactory warning "No memory 
barriers - SHM export and time hinting may not be reliable” Hence my desire to 
compile with C11. GPSD, with the minor fiddling I described in my original post 
can, will and does compile with C11 and works just fine.

I’m pretty sure I’ve tested this with fresh git clones of GPSD (I’d noticed 
that scons tends to cache a lot of things) but, to be sure, I’ve just retested 
with a fresh clone each time.

Without C11 in .bashrc:
scons timeservice=yes magic_hat=yes nmea0183=yes fixed_port_speed=9600 
fixed_stop_bits=1
    Checking if compiler is C11... no
sudo scons install
    Checking if compiler is C11... (cached) no
Behaves as expected, 'scons install' installs without recompiling.

With C11 in .bashrc:
scons timeservice=yes magic_hat=yes nmea0183=yes fixed_port_speed=9600 
fixed_stop_bits=1
    Checking if compiler is C11... yes
    Checking if compiler supplies __STDC_NO_ATOMICS__... no
    Checking for C header file stdatomic.h... yes
sudo scons install
    Checking if compiler is C11... no
'scons install' then recompiles GPSD, undoing the initial configuration.

With C11 in .bashrc:
scons timeservice=yes magic_hat=yes nmea0183=yes fixed_port_speed=9600 
fixed_stop_bits=1
    Checking if compiler is C11... yes
    Checking if compiler supplies __STDC_NO_ATOMICS__... no
    Checking for C header file stdatomic.h… yes
sudo CFLAGS=-std=gnu11 scons install
    Checking if compiler is C11... (cached) yes
    Checking if compiler supplies __STDC_NO_ATOMICS__... (cached) no
    Checking for C header file stdatomic.h... (cached) yes
Behaves as expected, 'scons install' installs without recompiling.

It appears from its build.txt file that GPSD depends on one C11 feature:

"C99 conformance is required in the compiler. The C code depends on one
C11 feature (supported by GCC, clang, and pretty much any C compiler
that also speaks C++): anonymous unions.  We could eliminate these,
but the cost would be source-level interface breakage if we have to
move certain structure members in and out of unions.

Some portions of the code using shared-memory segments are improved by
the C11 stdatomic.h features for lockless concurrency.  These are: the
SHM export mode in shmexport.c, the code for writing clock corrections
to NTP in ntpshmwrite.c, and the code for reading NTP corrections in
ntpshmread.c. These features have been supported in GCC since 4.7 and
clang since 3.1.”

Don’t get me wrong - I have little experience of GCC beyond compiling and am 
more than willing to believe I’m doing something wrong but it seems to me that, 
whether I’m right or wrong, scons or GPSD (I suspect scons) is not behaving 
consistently. Either it should ignore/reject any attempt to compile with C11 or 
scons and scons install should both acknowledge the C11 flag.

Cheers,
Neil.

— 

> On 12 Mar 2017, at 10:40 pm, Gary E. Miller <address@hidden> wrote:
> 
> Yo Neil!
> 
> On Sun, 12 Mar 2017 13:36:46 +0000
> Neil Green <address@hidden> wrote:
> 
>> Then, if I add "export CFLAGS=-std=gnu11” to my .bashrc and run
> 
> gpsd is coded to c99 standards, not gnu11 standards.  To get this to work
> you will have to do a lot of work.
> 
> As for you scons session, Did you do an scons clean between runs?  Even
> that is not good enough, best to reclone a new gpsd if you change the
> build environment.  Scons caches a lot of things and does not alwsys
> clean up nicely.
> 
> RGDS
> GARY
> ---------------------------------------------------------------------------
> Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
>       address@hidden  Tel:+1 541 382 8588
> 
>           Veritas liberabit vos. -- Quid est veritas?
>    "If you can’t measure it, you can’t improve it." - Lord Kelvin


reply via email to

[Prev in Thread] Current Thread [Next in Thread]