Postfix 3.4.4 compile problems on Solaris 11

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Postfix 3.4.4 compile problems on Solaris 11

Jaco Lesch
Guys

Attempting to compile Postfix 3.4.4 on Solaris 11 with GCC 7.3.0, but I
am getting the following error when running "make makefiles":
----------------------------------------------------------------------------------------------------
gcc -I. -I../../include -DNO_NISPLUS -Dstrcasecmp=fix_strcasecmp
-Dstrncasecmp=fix_strncasecmp -I/usr/remove/include -DHAS_DEV_URANDOM
-DHAS_PCRE -I/usr/include/pcre -UUSE_DYNAMIC_LIBS -DDEF_SHLIB_DIR=\"no\"
-UUSE_DYNAMIC_MAPS -Wmissing-prototypes -Wformat -Wno-comment  -g -O -I.
-DSUNOS5 -c unix_dgram_connect.c
unix_dgram_connect.c: In function ‘unix_dgram_connect’:
unix_dgram_connect.c:63:24: error: expected identifier or ‘(’ before
numeric constant
      struct sockaddr_un sun;
                         ^
unix_dgram_connect.c:70:48: error: request for member ‘sun_path’ in
something not a structure or union
      if ((path_len = strlen(path)) >= sizeof(sun.sun_path))
                                                 ^
unix_dgram_connect.c:72:21: error: lvalue required as unary ‘&’ operand
      memset((void *) &sun, 0, sizeof(sun));
                      ^
unix_dgram_connect.c:73:8: error: request for member ‘sun_family’ in
something not a structure or union
      sun.sun_family = AF_UNIX;
         ^
unix_dgram_connect.c:77:15: error: request for member ‘sun_path’ in
something not a structure or union
      memcpy(sun.sun_path, path, path_len + 1);
                ^
unix_dgram_connect.c:84:43: error: lvalue required as unary ‘&’ operand
      if (connect(sock, (struct sockaddr *) &sun, sizeof(sun)) < 0) {
                                            ^
*** Error code 1
make: Fatal error: Command failed for target `unix_dgram_connect.o'
Current working directory /usr/local/src/postfix-3.4.4/src/util
*** Error code 1
make: Fatal error: Command failed for target `update'
----------------------------------------------------------------------------------------------------

Not sure if I am missing the plot somewhere. When compiling Postfix
3.3.4 there is no issues and the source compile just fine.

OS: Solaris 11.3 SPARC (SunOS dev-host 5.11 11.3 sun4v sparc sun4v)
Compiler: GCC 7.3.0
Postfix: 3.4.4

Regards

--
---
Jaco Lesch
SAIX HLS
Email: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Postfix 3.4.4 compile problems on Solaris 11

Wietse Venema
> unix_dgram_connect.c: In function 'unix_dgram_connect':
> unix_dgram_connect.c:63:24: error: expected identifier or '(' before
> numeric constant
>       struct sockaddr_un sun;
>                          ^

Any idea why identical code in src/util/unix_listen.c compiles
without error?

unix_dgram_connect.c is new with Postfix 3.4, but most of the code
is identical to unix_listen.c (in particular both files use 'sun').

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Postfix 3.4.4 compile problems on Solaris 11

Viktor Dukhovni
In reply to this post by Jaco Lesch
> On Apr 1, 2019, at 5:04 AM, Jaco Lesch <[hidden email]> wrote:
>
> unix_dgram_connect.c:63:24: error: expected identifier or ‘(’ before numeric constant
>      struct sockaddr_un sun;

Takes me back to my roots working with SunOS 3.x.  Ever since, I've
kept away from sin, by naming unix-domain sockaddrs "s_un" and inet
sockaddrs "s_in", thus avoiding conflicts with the "sun" macro, and
the trigonometric function.

--
        Viktor.

Reply | Threaded
Open this post in threaded view
|

Re: Postfix 3.4.4 compile problems on Solaris 11

Wietse Venema
Viktor Dukhovni:
> > On Apr 1, 2019, at 5:04 AM, Jaco Lesch <[hidden email]> wrote:
> >
> > unix_dgram_connect.c:63:24: error: expected identifier or ?(? before numeric constant
> >      struct sockaddr_un sun;
>
> Takes me back to my roots working with SunOS 3.x.  Ever since, I've
> kept away from sin, by naming unix-domain sockaddrs "s_un" and inet
> sockaddrs "s_in", thus avoiding conflicts with the "sun" macro, and
> the trigonometric function.

Did you notice the line with "#undef sun" here, and in the 22-year
old file unix_listen.c which dates back to the days that SUn was
the primary development platform for what became Postfix?

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Postfix 3.4.4 compile problems on Solaris 11

Andrew Evdokimov
In reply to this post by Wietse Venema
On 01/04/2019 14:14, Wietse Venema wrote:
>> unix_dgram_connect.c: In function 'unix_dgram_connect':
>> unix_dgram_connect.c:63:24: error: expected identifier or '(' before
>> numeric constant
>>        struct sockaddr_un sun;
>>                           ^
>
> Any idea why identical code in src/util/unix_listen.c compiles
> without error?

Because it undefs 'sun' macro while unix_dgram_connect.c does not.

...
int     unix_connect(const char *addr, int block_mode, int timeout)
{
#undef sun
     struct sockaddr_un sun;
...

builder@builder2:~$ gcc -dM -E - < /dev/null | grep sun
#define __sun 1
#define sun 1
#define __sun__ 1
builder@builder2:~$ uname -a
SunOS builder2 5.11 11.4.5.3.0 i86pc i386 i86pc


--
Andrew Evdokimov
+7 910 450 83 33
mail [hidden email]
xmpp [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Postfix 3.4.4 compile problems on Solaris 11

tomww
oh, right.

reading your reply, I re-discovered my local fix I use for the
SFE packaging project:

==
#fix unlucky selection of name for struct (introduced in some 3.4.x
version)
grep "struct sockaddr_un sun;" src/util/unix_dgram_connect.c \
   && gsed -i.bak_undef_sun -e '/struct sockaddr_un sun;/ i\
   #undef sun' src/util/unix_dgram_connect.c
==

@tomww


On Mon, Apr 01, 2019 at 06:52:20PM +0300, Andrew Evdokimov wrote:

> On 01/04/2019 14:14, Wietse Venema wrote:
> > > unix_dgram_connect.c: In function 'unix_dgram_connect':
> > > unix_dgram_connect.c:63:24: error: expected identifier or '(' before
> > > numeric constant
> > >        struct sockaddr_un sun;
> > >                           ^
> >
> > Any idea why identical code in src/util/unix_listen.c compiles
> > without error?
>
> Because it undefs 'sun' macro while unix_dgram_connect.c does not.
>
> ...
> int     unix_connect(const char *addr, int block_mode, int timeout)
> {
> #undef sun
>     struct sockaddr_un sun;
> ...
>
> builder@builder2:~$ gcc -dM -E - < /dev/null | grep sun
> #define __sun 1
> #define sun 1
> #define __sun__ 1
> builder@builder2:~$ uname -a
> SunOS builder2 5.11 11.4.5.3.0 i86pc i386 i86pc
>
>
> --
> Andrew Evdokimov
> +7 910 450 83 33
> mail [hidden email]
> xmpp [hidden email]

--
Reply | Threaded
Open this post in threaded view
|

Re: Postfix 3.4.4 compile problems on Solaris 11

Wietse Venema
In reply to this post by Wietse Venema
Wietse Venema:

> > unix_dgram_connect.c: In function 'unix_dgram_connect':
> > unix_dgram_connect.c:63:24: error: expected identifier or '(' before
> > numeric constant
> >       struct sockaddr_un sun;
> >                          ^
>
> Any idea why identical code in src/util/unix_listen.c compiles
> without error?
>
> unix_dgram_connect.c is new with Postfix 3.4, but most of the code
> is identical to unix_listen.c (in particular both files use 'sun').

But it does not have the line with

        #undef sun

that the other unix_*.c files have.

Add this, and it compiles (on my Solaris9 VM).

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Postfix 3.4.4 compile problems on Solaris 11

Jaco Lesch
On 4/1/19 20:08, Wietse Venema wrote:

> Wietse Venema:
>>> unix_dgram_connect.c: In function 'unix_dgram_connect':
>>> unix_dgram_connect.c:63:24: error: expected identifier or '(' before
>>> numeric constant
>>>        struct sockaddr_un sun;
>>>                           ^
>> Any idea why identical code in src/util/unix_listen.c compiles
>> without error?
>>
>> unix_dgram_connect.c is new with Postfix 3.4, but most of the code
>> is identical to unix_listen.c (in particular both files use 'sun').
> But it does not have the line with
>
> #undef sun
>
> that the other unix_*.c files have.
>
> Add this, and it compiles (on my Solaris9 VM).
>
> Wietse
Wietse and Guys

Thanks for the feedback and solution. Have done as suggested, tested on
both GCC 7.3.0 and DeveloperStudio 12.6, both working fine and producing
working binaries.

Regards

--
---
Jaco Lesch
SAIX HLS
Email: [hidden email]