Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automake: only pass net-snmp cflags to snmp-ups #464

Merged
merged 1 commit into from Aug 23, 2017

Conversation

cpaelzer
Copy link
Contributor

Other than formerly assumed in the makefile cflags can be more than
includes. And some of them need to be in sync in regard to CFLAGS and
LDFLAGS - for example usage of -fPIE.

This conflicts with a current assumption in the makefile "In any case,
CFLAGS are only -I options, so there is no harm".

On a Distribution where PIE is enabled by default, but disabled for
special cases (like net-snmp) the configure detection gets them as:
LIBNETSNMP_CFLAGS = -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -g -O2
-fdebug-prefix-map=/build/net-snmp-nlMQSZ/net-snmp-5.7.3+dfsg=.
-specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong
-Wformat -Werror=format-security -DNETSNMP_USE_INLINE -Ulinux
-Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv
-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I/usr/lib/x86_64-linux-gnu/perl/5.26/CORE
-Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include
LIBNETSNMP_LIBS = -Wl,-Bsymbolic-functions
-specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now
-L/usr/lib/x86_64-linux-gnu -lnetsnmp -lcrypto -lm

Of importance are:
-specs=/usr/share/dpkg/no-pie-compile.specs
-specs=/usr/share/dpkg/no-pie-link.specs

Now when compiling the non-snmp objects incorrectly get the
"-specs=/usr/share/dpkg/no-pie-compile.specs" due to the assumption
that it is safe to add up all CFLAGS to the global one.

LDFLAGS imported that way are only added to snmp.
snmp_ups_LDADD = $(LDADD_DRIVERS) $(LIBNETSNMP_LIBS)
[...]
snmp-ups$(EXEEXT): $(snmp_ups_OBJECTS) $(snmp_ups_DEPENDENCIES)
$(EXTRA_snmp_ups_DEPENDENCIES)
@rm -f snmp-ups$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(snmp_ups_OBJECTS) $(snmp_ups_LDADD)
$(LIBS)

That leads to other (all non snmp_ups) objects in drivers failing to build.
They get the no-pie-compile.specs (incorrect) spec but not the
no-pie-link.specs on the link step.

Some other parts like mge_shut and nutdrv_qx already have custom
CFLAGS/LDFLAGS that are not added to the global CFLAGS. So despite the
commend in the makefile this doesn't seem to be new in general to nut.

I don't want to mess too much with your build system for now as I don't
know many of its implications. So I chose not the full drop of that
global CFLAGS merge, but a minimal patch for now which fixes the issue
described.

Thereby closes #463

Signed-off-by: Christian Ehrhardt christian.ehrhardt@canonical.com

Other than formerly assumed in the makefile cflags can be more than
includes. And some of them need to be in sync in regard to CFLAGS and
LDFLAGS - for example usage of -fPIE.

This conflicts with a current assumption in the makefile "In any case,
CFLAGS are only -I options, so there is no harm".

On a Distribution where PIE is enabled by default, but disabled for
special cases (like net-snmp) the configure detection gets them as:
LIBNETSNMP_CFLAGS = -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -g -O2
-fdebug-prefix-map=/build/net-snmp-nlMQSZ/net-snmp-5.7.3+dfsg=.
-specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong
-Wformat -Werror=format-security -DNETSNMP_USE_INLINE -Ulinux
-Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv
-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I/usr/lib/x86_64-linux-gnu/perl/5.26/CORE
-Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include
LIBNETSNMP_LIBS = -Wl,-Bsymbolic-functions
-specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now
-L/usr/lib/x86_64-linux-gnu -lnetsnmp -lcrypto -lm

Of importance are:
-specs=/usr/share/dpkg/no-pie-compile.specs
-specs=/usr/share/dpkg/no-pie-link.specs

Now when compiling the non-snmp objects incorrectly get the
"-specs=/usr/share/dpkg/no-pie-compile.specs" due to the assumption
that it is safe to add up all CFLAGS to the global one.

LDFLAGS imported that way are only added to snmp.
snmp_ups_LDADD = $(LDADD_DRIVERS) $(LIBNETSNMP_LIBS)
[...]
snmp-ups$(EXEEXT): $(snmp_ups_OBJECTS) $(snmp_ups_DEPENDENCIES)
$(EXTRA_snmp_ups_DEPENDENCIES)
        @rm -f snmp-ups$(EXEEXT)
        $(AM_V_CCLD)$(LINK) $(snmp_ups_OBJECTS) $(snmp_ups_LDADD)
$(LIBS)

That leads to other (all non snmp_ups) objects in drivers failing to build.
They get the no-pie-compile.specs (incorrect) spec but not the
no-pie-link.specs on the link step.

Some other parts like mge_shut and nutdrv_qx already have custom
CFLAGS/LDFLAGS that are not added to the global CFLAGS. So despite the
commend in the makefile this doesn't seem to be new in general to nut.

I don't want to mess too much with your build system for now as I don't
know many of its implications. So I chose not the full drop of that
global CFLAGS merge, but a minimal patch for now which fixes the issue
described.

Thereby closes networkupstools#463

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
@aquette aquette merged commit c71f342 into networkupstools:master Aug 23, 2017
jimklimov pushed a commit to jimklimov/nut that referenced this pull request Aug 25, 2017
Other than formerly assumed in the makefile cflags can be more than
includes. And some of them need to be in sync in regard to CFLAGS and
LDFLAGS - for example usage of -fPIE.

This conflicts with a current assumption in the makefile "In any case,
CFLAGS are only -I options, so there is no harm".

On a Distribution where PIE is enabled by default, but disabled for
special cases (like net-snmp) the configure detection gets them as:
LIBNETSNMP_CFLAGS = -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -g -O2
-fdebug-prefix-map=/build/net-snmp-nlMQSZ/net-snmp-5.7.3+dfsg=.
-specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong
-Wformat -Werror=format-security -DNETSNMP_USE_INLINE -Ulinux
-Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv
-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I/usr/lib/x86_64-linux-gnu/perl/5.26/CORE
-Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include
LIBNETSNMP_LIBS = -Wl,-Bsymbolic-functions
-specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now
-L/usr/lib/x86_64-linux-gnu -lnetsnmp -lcrypto -lm

Of importance are:
-specs=/usr/share/dpkg/no-pie-compile.specs
-specs=/usr/share/dpkg/no-pie-link.specs

Now when compiling the non-snmp objects incorrectly get the
"-specs=/usr/share/dpkg/no-pie-compile.specs" due to the assumption
that it is safe to add up all CFLAGS to the global one.

LDFLAGS imported that way are only added to snmp.
snmp_ups_LDADD = $(LDADD_DRIVERS) $(LIBNETSNMP_LIBS)
[...]
snmp-ups$(EXEEXT): $(snmp_ups_OBJECTS) $(snmp_ups_DEPENDENCIES)
$(EXTRA_snmp_ups_DEPENDENCIES)
        @rm -f snmp-ups$(EXEEXT)
        $(AM_V_CCLD)$(LINK) $(snmp_ups_OBJECTS) $(snmp_ups_LDADD)
$(LIBS)

That leads to other (all non snmp_ups) objects in drivers failing to build.
They get the no-pie-compile.specs (incorrect) spec but not the
no-pie-link.specs on the link step.

Some other parts like mge_shut and nutdrv_qx already have custom
CFLAGS/LDFLAGS that are not added to the global CFLAGS. So despite the
commend in the makefile this doesn't seem to be new in general to nut.

I don't want to mess too much with your build system for now as I don't
know many of its implications. So I chose not the full drop of that
global CFLAGS merge, but a minimal patch for now which fixes the issue
described.

Thereby closes networkupstools#463

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
aquette pushed a commit that referenced this pull request Aug 25, 2017
* gitlog2changelog: Date header only occurs at start of line

Alternative to #427

* gitlog2changelog: log parse errors for Author and Date

Suggested by Jim Klimov.

* configure.ac : move comment to a more relevant line

* docs/man/Makefile.am : small typo in comment

* configure.ac : refer to detailed doc from --with-doc help text; preset explicit nut_with_doc=man=auto value

* m4/nut_check_asciidoc.m4 configure.ac : parametrize the required minimum versions (asciidoc/a2x, dblatex)

* configure.ac docs/man/Makefile.am : track DOC_INSTALL_DISTED_MANS fallback behavior

* docs/man/Makefile.am : do not rebuild docs and do not error out if a prebuilt copy is among sources (not only in builddir as before)

* docs/Makefile.am : make sure the builddir copy of docbook-xsl.css is writeable (file is copied from OS, some distros have it 444 and not 644)

* docs/man/Makefile.am : Fix up manpage source timestamps when dist-ing

* docs/man/Makefile.am : Fix up dist-ed manpage source timestamps regardless of DOC_INSTALL_DISTED_MANS value

* docs/man/Makefile.am : Suffice to have prebuilt docs in dist-ed sources only if DOC_INSTALL_DISTED_MANS is enabled

* usbhid-ups: only check iOEMInformation once for openups2

This prevents the 'libusb_get_string: invalid argument' message from being
logged continously.

Patch provided by Alphonse <alphsteiner@gmail.com>

http://lists.alioth.debian.org/pipermail/nut-upsdev/2017-July/007314.html

* snmp-ups: Introduce values lookup functions

As already used in other drivers, such as usbhid-ups, introduce optional
values lookup functions, beside from values lookup mapping. This allows to have
a more powerful and generic values processing before publication

Signed-off-by: Arnaud Quette <ArnaudQuette@Eaton.com>

* CPS HID: add input.frequency and output.frequency (0.5)

Suggested by Andy Jan:
http://lists.alioth.debian.org/pipermail/nut-upsuser/2017-August/010856.html

* snmp-ups: Fix the phase of outlet groups for Eaton PDU

Compute the phase to which an outlet group is connected WRT the total number of
phase(s) and the considered outlet group number.

Signed-off-by: Arnaud Quette <ArnaudQuette@Eaton.com>

* Extend namespace for iPDU and outlets

Extend NUT namespace to also publish the name of an outlet, using
"outlet.n.name", beside from the existing "outlet.n.desc"

Signed-off-by: Arnaud Quette <ArnaudQuette@Eaton.com>

* snmp-ups: Publish outlet.n.name for Eaton ePDU

Signed-off-by: Arnaud Quette <ArnaudQuette@Eaton.com>

* NUT namespace: fix an extraneous character insertion

A character was wrongly inserted during the previous commit, triggering a
spellcheck error

Signed-off-by: Arnaud Quette <ArnaudQuette@Eaton.com>

* Remove exec bits on SNMP subdrivers

Signed-off-by: Arnaud Quette <ArnaudQuette@Eaton.com>

* apcupsd-ups: interpret "SHUTTING DOWN" as "LB"

Fix issue #460 so NUT with
apcupsd-ups driver will correctly initiate a shut down on low battery.

Bump version to 0.5

Closes: #460
Closes: #461

* snmp-ups: fix the rounding / truncation of some values

The multiplier system of the snmp-ups driver resulted in some values being
rounded to the nearby integer value, thus causing a loss of the decimals and
the value precision in general. This was mainly visible on the value of
currents, but also on some voltages

Signed-off-by: Arnaud Quette <ArnaudQuette@Eaton.com>

* snmp-subdrivers.txt : reference the multitude of eaton subdrivers

* eaton-mib.h renamed into separate constituent headers

* eaton-mib.c renamed into separate constituent sources, earlier history retained in eaton-pdu-genesis2-mib.c

* Re-merged drivers/eaton-mib.c from upstream/master and regenerated DMF

* eaton-pdu-revelation-mib.c eaton-pdu-pulizzi-mib.c eaton-pdu-genesis2-mib.c : no use to include dstate.h here

* eaton-pdu-marlin-mib.c eaton-pdu-revelation-mib.c : port the renamed structure names from original eaton-mib.c evolution

* Integrate recent upstream changes into DMF

* WIP remerge DMF to master so it can compile

* Eaton ePDU SNMP MIB file split in four (#465)

* snmp-subdrivers.txt : reference the multitude of eaton subdrivers

* eaton-mib.h renamed into separate constituent headers

* eaton-mib.c renamed into separate constituent sources, earlier history retained in eaton-pdu-genesis2-mib.c

* eaton-pdu-revelation-mib.c eaton-pdu-pulizzi-mib.c eaton-pdu-genesis2-mib.c : no use to include dstate.h here

* eaton-pdu-marlin-mib.c eaton-pdu-revelation-mib.c : port the renamed structure names from original eaton-mib.c evolution

* automake: only pass net-snmp cflags to snmp-ups (#464)

Other than formerly assumed in the makefile cflags can be more than
includes. And some of them need to be in sync in regard to CFLAGS and
LDFLAGS - for example usage of -fPIE.

This conflicts with a current assumption in the makefile "In any case,
CFLAGS are only -I options, so there is no harm".

On a Distribution where PIE is enabled by default, but disabled for
special cases (like net-snmp) the configure detection gets them as:
LIBNETSNMP_CFLAGS = -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -g -O2
-fdebug-prefix-map=/build/net-snmp-nlMQSZ/net-snmp-5.7.3+dfsg=.
-specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong
-Wformat -Werror=format-security -DNETSNMP_USE_INLINE -Ulinux
-Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv
-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I/usr/lib/x86_64-linux-gnu/perl/5.26/CORE
-Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include
LIBNETSNMP_LIBS = -Wl,-Bsymbolic-functions
-specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now
-L/usr/lib/x86_64-linux-gnu -lnetsnmp -lcrypto -lm

Of importance are:
-specs=/usr/share/dpkg/no-pie-compile.specs
-specs=/usr/share/dpkg/no-pie-link.specs

Now when compiling the non-snmp objects incorrectly get the
"-specs=/usr/share/dpkg/no-pie-compile.specs" due to the assumption
that it is safe to add up all CFLAGS to the global one.

LDFLAGS imported that way are only added to snmp.
snmp_ups_LDADD = $(LDADD_DRIVERS) $(LIBNETSNMP_LIBS)
[...]
snmp-ups$(EXEEXT): $(snmp_ups_OBJECTS) $(snmp_ups_DEPENDENCIES)
$(EXTRA_snmp_ups_DEPENDENCIES)
        @rm -f snmp-ups$(EXEEXT)
        $(AM_V_CCLD)$(LINK) $(snmp_ups_OBJECTS) $(snmp_ups_LDADD)
$(LIBS)

That leads to other (all non snmp_ups) objects in drivers failing to build.
They get the no-pie-compile.specs (incorrect) spec but not the
no-pie-link.specs on the link step.

Some other parts like mge_shut and nutdrv_qx already have custom
CFLAGS/LDFLAGS that are not added to the global CFLAGS. So despite the
commend in the makefile this doesn't seem to be new in general to nut.

I don't want to mess too much with your build system for now as I don't
know many of its implications. So I chose not the full drop of that
global CFLAGS merge, but a minimal patch for now which fixes the issue
described.

Thereby closes #463

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>

* snmp-ups: add support for input.phase.shift (#433)

* snmp-ups: add support for input.phase.shift

ATS can now publish the electrical dephasing between input sources

Signed-off-by: Arnaud Quette <ArnaudQuette@Eaton.com>

* Make spellchecker happy about "dephasing"

* Expel the helper function that interacts with dstate from eaton-pdu-marlin-mib.c to eaton-pdu-marlin-helpers.c/.h

* eaton-pdu-marlin-helpers.c : update comments for marlin_outlet_group_phase_fun()

* snmp-ups / eaton-marlin : introduce WITH_SNMP_LKP_FUN to separate codebases that support these callbacks from those that currently do not

* eaton-marlin : cosmetic whitespace fixes

* snmp-ups : update copyrights from Eaton staffers

* eaton-ats16-mib.dmf : updated to include phase.shift from new C MIB mapping

* dstate.h : use our timehead.h to have "struct timeval" defined

* eaton-pdu-marlin-helpers.c/h fix

* snmp-ups / eaton-marlin : introduce WITH_SNMP_LKP_FUN to separate codebases that support these callbacks from those that currently do not

* drivers/Makefile.am : adapt to solution of #464 / #463

* scripts/DMF/Makefile.am : use WITH_DMFMIB to trigger WITH_SNMP_LKP_FUN in snmp-ups codebase, in particular

* scripts/DMF/Makefile.am : rearrange long line for readability

* scripts/DMF/Makefile.am : revert the magic with dstate.o in DMF selftests

* jsonify-mib.py : pass LDFLAGS after the output and original source file

* Add newly reorganized and generated eaton-pdu-*-mib.dmf files to SCM

* drivers/Makefile.am : adapt to solution of #464 / #463

* drivers/Makefile.am : adapt to solution of #464 / #463

* drivers/Makefile.am : cosmetic fix in DMF branch

* scripts/DMF/dmf-test.c : introduce and comment WITH_SNMP_LKP_FUN to separate codebases that support these callbacks from those that currently do not

* configure.ac : make sure to remove temp dir from dmfify tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

automake fails to correctly pass snmp cflags/ldflags
2 participants