www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples

Archive Index This month's Index

Subject: requested change for Sun/Solaris compatibility

requested change for Sun/Solaris compatibility

From: Michael Maciolek <michael.maciolek_at_tufts.edu>
Date: Thu, 11 Feb 2010 14:07:46 -0500

A request to the libssh2 code maintainers:

Please consider renaming the variable 'sun' used in the file 'agent.c',
as the name conflicts with the predefined macro 'sun' that appears on
Sun Microsystems computers running the Solaris operating system. The
conflict causes libssh2 builds to fail on such systems:

Excerpt from 'make' on a Sun/Solaris system showing how it fails:

        libtool: compile: gcc -DHAVE_CONFIG_H -I../include -I../src -g -O2 -MT agent.lo -MD -MP -MF .deps/agent.Tpo -c agent.c -fPIC -DPIC -o .libs/agent.o
        agent.c: In function `agent_connect_unix':
        agent.c:145: error: syntax error before numeric constant
        agent.c:157: error: request for member `sun_family' in something not a structure or union
        agent.c:158: error: request for member `sun_path' in something not a structure or union
        agent.c:158: error: request for member `sun_path' in something not a structure or union
        agent.c:159: error: invalid lvalue in unary `&'
        make[2]: *** [agent.lo] Error 1
        make[2]: Leaving directory `/tmp/libssh2-1.2.3/src'
        make[1]: *** [all] Error 2
        make[1]: Leaving directory `/tmp/libssh2-1.2.3/src'
        make: *** [all-recursive] Error 1

Specific location of 'sun' variable:

        bash# pwd
        /tmp/libssh2-1.2.3
        bash# grep -n sun src/agent.c
        145: struct sockaddr_un sun;
        157: sun.sun_family = AF_UNIX;
        158: strncpy (sun.sun_path, path, sizeof sun.sun_path);
        159: if (connect(agent->fd, (struct sockaddr*)(&sun), sizeof sun) != 0) {

Demonstration of conflicting constant 'sun' that is produced by cpp:

        bash# echo "" | cpp -dM|grep -i sun
        #define __sun 1
        #define sun 1
        #define __sun__ 1
        bash#

Many thanks,
Michael Maciolek
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-02-11

the libssh2 team