[Nut-upsdev] Makefiles driving me NUTs
Peter Selinger
selinger at mathstat.dal.ca
Fri Jan 12 22:10:14 CET 2007
P.S. to my previous message:
Looking at upsclient.c, ideally it should should not even #include
"common.h" (for the reason described below). However, this is
currently necessary because common.h contains #defines that do not
really belong there (SMALLBUF, LARGEBUF), and even some stuff that
definitely does not belong there (include getopt.h, optarg, optind).
Also, error reporting in upsclient.c should be done by returning -1
and setting ups->upserror (and in some cases ups->syserrno), and not
by setting errno as I said.
-- Peter
Peter Selinger wrote:
> What you are compiling is the libupsclient.a library, which is
> intended to be a stand-alone library used by other programs (including
> some standard NUT clients).
>
> IMHO, it would be wrong to use NUT-specific error reporting functions
> in a library. Instead, the library should communicate errors through
> its API, preferably by returning documented exit codes from its
> functions, perhaps setting errno, etc. It should be up to the client
> programs to decide how to report these errors.
>
> At least I assume that his the reason that libcommon.a is not linked
> into libupsclient.a; when I wrote the Makefile.am, I simply copied the
> behavior that existed in the pre-automake Makefile.in.
>
> -- Peter
>
>
> Arjen de Korte wrote:
> >
> > I want to use upsdebugx, upslogx in 'clients/upsclient.c', however this
> > fails with the following error messages (I trimmed the path to the build
> > directory to <path> in order to prevent line wrapping):
> >
> > <path>/clients/upsclient.c:941: undefined reference to `upsdebugx'
> > <path>/clients/upsclient.c:910: undefined reference to `upslogx'
> > <path>/clients/upsclient.c:927: undefined reference to `upslogx'
> > <path>/clients/upsclient.c:917: undefined reference to `upslogx'
> >
> > Apparently, the library ../common/libcommon.a is not linked in. Why not?
> > Can this be fixed somehow? And where?
> >
> > Best regards, Arjen
More information about the Nut-upsdev
mailing list