[torqueusers] Error compiling 2.4.4 on Solaris 10
skip at pobox.com
skip at pobox.com
Thu Mar 11 11:12:14 MST 2010
It seems that Torque's configure execution doesn't detect the proper mojo on
Solaris 10 Intel (gcc 4.2.2) to compile code which makes calls to ntohs:
gcc -DHAVE_CONFIG_H -I. -I. -I../../../src/include -I../../../src/include -I../../../src/lib/Libdis -DIFF_PATH=\"/var/opt/torque/sbin/pbs_iff\" -DPBS_DEFAULT_FILE=\"/var/spool/torque/server_name\" -I/opt/app/nonc++/readline/include -g -O2 -W -Wall -Wno-unused-parameter -Wno-long-long -pedantic -Werror -MT tm.lo -MD -MP -MF .deps/tm.Tpo -c ../Libifl/tm.c -fPIC -DPIC -o .libs/tm.o
cc1: warnings being treated as errors
../Libifl/tm.c: In function 'localmom':
../Libifl/tm.c:508: warning: implicit declaration of function 'htons'
make[3]: *** [tm.lo] Error 1
make[3]: Leaving directory `/home/udesktop116/skipm/src/torque-2.4.4/src/lib/Libpbs'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/udesktop116/skipm/src/torque-2.4.4/src/lib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/udesktop116/skipm/src/torque-2.4.4/src'
make: *** [all-recursive] Error 1
A quick check of tm.c suggests that it imports netinet/in.h. On my system I
see this code in netinet/in.h:
/*
* Symbols such as htonl() are required to be exposed through this file,
* per XNS Issue 5. This is achieved by inclusion of <sys/byteorder.h>
*/
#if !defined(_XPG4_2) || defined(__EXTENSIONS__) || defined(_XPG5)
#include <sys/byteorder.h>
#endif
I don't believe there are any other guards preventing this file from being
included. sys/byteorder.h has this:
#if defined(_BIG_ENDIAN) && !defined(ntohl) && !defined(__lint)
/* big-endian */
#define ntohl(x) (x)
#define ntohs(x) (x)
#define htonl(x) (x)
#define htons(x) (x)
#elif !defined(ntohl) /* little-endian */
#ifndef _IN_PORT_T
#define _IN_PORT_T
typedef uint16_t in_port_t;
#endif
#ifndef _IN_ADDR_T
#define _IN_ADDR_T
typedef uint32_t in_addr_t;
#endif
#if !defined(_XPG4_2) || defined(__EXTENSIONS__) || defined(_XPG5)
extern uint32_t htonl(uint32_t);
extern uint16_t htons(uint16_t);
extern uint32_t ntohl(uint32_t);
extern uint16_t ntohs(uint16_t);
#else
extern in_addr_t htonl(in_addr_t);
extern in_port_t htons(in_port_t);
extern in_addr_t ntohl(in_addr_t);
extern in_port_t ntohs(in_port_t);
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) || defined(_XPG5) */
#endif
It does seem to me that this should define htonl and friends unless one of
the guards prevents sys/byteorder.h from being included.
I ran the gcc command with -E and output to tm.i. Sure enough, htons is
neither externed nor deleted via macro expansion. Any suggestions for
debugging this further?
Thx,
--
Skip Montanaro - skip at pobox.com - http://www.smontanaro.net/
More information about the torqueusers
mailing list