Error de compilación apcupsd-3.14.8-r1

From Luniwiki
Jump to: navigation, search

Error

snmp.h:82:10: error: expected unqualified-id before numeric constant
snmp.h:82:9: error: expected ';' at end of member declaration
snmp.h:82:10: error: expected unqualified-id before numeric constant
drv_rfc1628.c: In function 'int rfc_1628_check_alarms(UPSINFO*)':
drv_rfc1628.c:35:40: error: expected unqualified-id before numeric constant
drv_rfc1628.c:35:40: error: expected ',' or ';' before numeric constant
drv_rfc1628.c: In function 'int rfc1628_snmp_ups_read_static_data(UPSINFO*)':
drv_rfc1628.c:79:40: error: expected unqualified-id before numeric constant
drv_rfc1628.c:79:40: error: expected ',' or ';' before numeric constant
drv_rfc1628.c: In function 'int rfc1628_snmp_ups_read_volatile_data(UPSINFO*)':
drv_rfc1628.c:101:40: error: expected unqualified-id before numeric constant
drv_rfc1628.c:101:40: error: expected ',' or ';' before numeric constant
 CXX   src/drivers/snmplite/mib.cpp
make[4]: *** [.obj/drv_rfc1628.o] Error 1
make[3]: *** [all] Error 2
make[2]: *** [snmp_DIR] Error 2
make[2]: *** Waiting for unfinished jobs....
 CXX   src/drivers/snmplite/asn.cpp
 CXX   src/drivers/snmplite/snmplite.cpp
 CXX   src/drivers/snmplite/snmp.cpp
snmplite.cpp: In function 'int snmplite_ups_open(UPSINFO*)':
snmplite.cpp:62:18: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       src/cgi
 CXX   src/cgi/upsfetch.c
make[1]: *** [drivers_DIR] Error 2
make[1]: *** Waiting for unfinished jobs....
 CXX   src/cgi/cgilib.c
 CXX   src/cgi/multimon.c
 CXX   src/cgi/upsstats.c
 CXX   src/cgi/upsfstats.c
 CXX   src/cgi/upsimage.c
 LD    src/cgi/multimon.cgi
 LD    src/cgi/upsstats.cgi
 LD    src/cgi/upsfstats.cgi
 LD    src/cgi/upsimage.cgi
make: *** [src_DIR] Error 2
emake failed
* ERROR: sys-power/apcupsd-3.14.8-r1 failed (compile phase):
*   emake failed
*
* Call stack:
*     ebuild.sh, line  93:  Called src_compile
*   environment, line 3044:  Called die
* The specific snippet of code:
*       MANPAGER=$(type -p cat) emake || die "emake failed"
*
* If you need support, post the output of `emerge --info '=sys-power/apcupsd-3.14.8-r1'`,
* the complete build log and the output of `emerge -pqv '=sys-power/apcupsd-3.14.8-r1'`.
* The complete build log is located at '/var/tmp/portage/sys-power/apcupsd-3.14.8-r1/temp/build.log'.
* The ebuild environment file is located at '/var/tmp/portage/sys-power/apcupsd-3.14.8-r1/temp/environment'.
* Working directory: '/var/tmp/portage/sys-power/apcupsd-3.14.8-r1/work/apcupsd-3.14.8'
* S: '/var/tmp/portage/sys-power/apcupsd-3.14.8-r1/work/apcupsd-3.14.8'
>>> Failed to emerge sys-power/apcupsd-3.14.8-r1, Log file:
>>>  '/var/tmp/portage/sys-power/apcupsd-3.14.8-r1/temp/build.log'
* Messages for package sys-power/apcupsd-3.14.8-r1:
* ERROR: sys-power/apcupsd-3.14.8-r1 failed (compile phase):
*   emake failed
*
* Call stack:
*     ebuild.sh, line  93:  Called src_compile
*   environment, line 3044:  Called die
* The specific snippet of code:
*       MANPAGER=$(type -p cat) emake || die "emake failed"
*
* If you need support, post the output of `emerge --info '=sys-power/apcupsd-3.14.8-r1'`,
* the complete build log and the output of `emerge -pqv '=sys-power/apcupsd-3.14.8-r1'`.
* The complete build log is located at '/var/tmp/portage/sys-power/apcupsd-3.14.8-r1/temp/build.log'.
* The ebuild environment file is located at '/var/tmp/portage/sys-power/apcupsd-3.14.8-r1/temp/environment'.
* Working directory: '/var/tmp/portage/sys-power/apcupsd-3.14.8-r1/work/apcupsd-3.14.8'
* S: '/var/tmp/portage/sys-power/apcupsd-3.14.8-r1/work/apcupsd-3.14.8'

El error se debe a un cambio en los header de snmp que no ha sido reflejado en apcupsd (variable en mayusculas MIB a mib.

Parche

Existe un parche que permite modificar el código de apcupsd, para corregir la variable en minúsculas en vez de mayúsculas. Lo ponemos como parche de usuario. Hay que obligar a emerge a parchear el código ver User patch no llamado por portage. El parche esta disponible File:Change MIB to mib to build with latest net-snmp.patch. El parche lo colocamos en la arborescencia siguiente:

# pwd
/etc/portage/patches/sys-power/apcupsd-3.14.8-r1
# ls
Change_MIB_to_mib_to_build_with_latest_net-snmp.patch
#

Compilación

# emerge -av apcupsd
* IMPORTANT: 1 news items need reading for repository 'gentoo'.
* Use eselect news to read news items.
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild   R    ] sys-power/apcupsd-3.14.8-r1  USE="cgi nls snmp usb -gnome" 0 kB
Total: 1 package (1 reinstall), Size of downloads: 0 kB
Would you like to merge these packages? [Yes/No] y
>>> Verifying ebuild manifests
>>> Emerging (1 of 1) sys-power/apcupsd-3.14.8-r1
* apcupsd-3.14.8.tar.gz SHA256 SHA512 WHIRLPOOL size ;-) ...      [ ok ]
* Determining the location of the kernel source code
* Found kernel source directory:
*     /usr/src/linux
* Found kernel object directory:
*     /lib/modules/3.8.13-gentoo/build
* Found sources for kernel version:
*     3.8.13-gentoo
* Checking for suitable kernel configuration options...            [ ok ]
>>> Unpacking source...
>>> Unpacking apcupsd-3.14.8.tar.gz to /var/tmp/portage/sys-power/apcupsd-3.14.8-r1/work
>>> Source unpacked in /var/tmp/portage/sys-power/apcupsd-3.14.8-r1/work
>>> Preparing source in /var/tmp/portage/sys-power/apcupsd-3.14.8-r1/work/apcupsd-3.14.8 ...
>>> Source prepared.
* Applying user patches from /etc/portage/patches//sys-power/apcupsd-3.14.8-r1 ...
*   Change_MIB_to_mib_to_build_with_latest_net-snmp.patch ...      [ ok ]
* Done with patching
 >>> Configuring source in /var/tmp/portage/sys-power/apcupsd-3.14.8-r1/work/apcupsd-3.14.8 ...

Aplicando el parche la compilación es correcta.

Referencias

--Daniel Simao (Talk) 11:16 16 jun 2013 (UTC)