gpsd-users
[Top][All Lists]
Advanced

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

Re: Question about gpsd library/linking for an external gpsd client?


From: Gary E. Miller
Subject: Re: Question about gpsd library/linking for an external gpsd client?
Date: Thu, 4 Jun 2020 11:20:29 -0700

Yo Curtis!

On Thu, 4 Jun 2020 11:20:34 -0500
Curtis Olson <curtolson@flightgear.org> wrote:

> Here is my dumb question for today:

More coffee for you then,

> I would like to write a simple gpsd client, but I would like the code
> to be completely outside of the gpsd source tree and built completely
> independently.

Many do that.  How depends on your language.

> Does 'scons install' for gpsd install enough libs/headers for me to
> compile an external, independent client?

By definition you need NOTHING to build and external and independent
client.  If you need scons install to do something them it is not
independent.

> When I look at my system, I see that libgpsdpacket.so is installed in
> /usr/local/lib.

That location by default. easy to change.

My buuild log shows:

rm -f //usr/local/lib/libgps.*
Install file: "libgps.so.27.0.0" as "/usr/local/lib/libgps.so.27.0.0"
strip /usr/local/lib/libgps.so.27.0.0

So you should also have:

/usr/local/lib/libgps.so.27.0.0

Odd, my build log says it was installed, but it did not.  I'm guessing the
recent lib changes broke the libs again.

Looks like you found a bug.  That shows you that no one bethers to link
in libgps.

> There is a bunch of python stuff installed (which is
> cool, but I'm ignoring for now.)  I see the gps.h file in
> /usr/local/include.

By default.  That is all you need.  If you have Qt, you also get:

/usr/local/include/libgpsmm.h

> But when I try to do something 'simple' like compile gpxlogger.c
> outside of the gpsd devel tree I get missing symbols for things like
> gps_open(), gps_close(), etc.

Of course, not designed to be built out of tree.  Those symbols are in
libgps.a or libgps.so.  Which are not installed by default.

If you want to know how gpxlogger is built, then build it with scons
and see what scons does.  No magic:

gcc -o gpxlogger.o -c -pthread -Wall -Wcast-align -Wextra 
-Wimplicit-fallthrough -Wmissing-declarations -Wmissing-prototypes 
-Wno-missing-field-initializers -Wno-uninitialized -Wpointer-arith 
-Wreturn-type -Wstrict-prototypes -Wvla -O2 -pthread -I/usr/include/dbus-1.0 
-I/usr/lib64/dbus-1.0/include gpxlogger.c
gcc -o gpxlogger -pthread gpxlogger.o -L. -lgps_static -lm -lrt -lnsl -ldbus-1
gcc -o lcdgps.o -c -pthread -Wall -Wcast-align -Wextra -Wimplicit-fallthrough 
-Wmissing-declarations -Wmissing-prototypes -Wno-missing-field-initializers 
-Wno-uninitialized -Wpointer-arith -Wreturn-type -Wstrict-prototypes -Wvla -O2 
-pthread -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include lcdgps.c

Notice it uses libgps_static.a  I'm not sure why they did that.

Maybe that should be installed by default, but I'm not sure why it used static
instead of shared as shared is the default.  I should look into that too.

> I tried linking with -lgpsdpacket
> because that is the only library that got installed (as far as I can
> tell) but that doesn't seem to be the right thing:

libgpsdpacket is for Python, you said you would ignore Python, then did
not.

> It seems like all the supporting libs for writing client code are
> compiled staticly, exist only in the gpsd source tree, and are never
> installed system wide?

"never" is a big word.  It used to be the default, not sure why it is
not now.

> Did I make a mistake in running "scons
> install"?

No, any mistakes "scons install" perpetrates were made earlier, during
config and build.  You neglected to say how you did those.  Things
like debug=true turn off shared liraries, so many ways to go wrong.

> Is there additional scons commands to run to install
> client devel libraries?

No, but a ton of build options.

> Way back in the way back I wrote a gpsd
> client using pure socket calls (no gpsd libs at all).  Would that
> approach still work?

That part has not changed, many do that.

> Is there a recommended approach for what I'm
> trying to do?

Nope.  That is why there are so many gpsd sample clients, everyone has
their own idea of best.

> I feel like I've missed something here, so I'm taking
> a break from exploring the code and build system and asking the dumb
> questions.

Maybe dumb, but even a blind squirrel finds an acorn once in a while.
Looks like you found a recent lib install bug.  The way diff arches and
ditros use shared libraries varies wildly.  Every time somone "improves
the libs on their host, they break it for someone else.  There has been
trhashing in that area this cycle.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        gem@rellim.com  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin

Attachment: pgpp3YhqUVdTE.pgp
Description: OpenPGP digital signature


reply via email to

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