Thread: fe-connect build failure (Solaris 9, PGSQL 7.3.3, OpenSSL 0.9.7b)

fe-connect build failure (Solaris 9, PGSQL 7.3.3, OpenSSL 0.9.7b)

From
"Paul Eggert"
Date:
I ran into the following problem building PostgreSQL 7.3.3 on Solaris
9 (sparc) using GCC 3.3 and OpenSSL 0.9.7b.

   gcc -g -Wall -Wmissing-prototypes -Wmissing-declarations -fPIC -I. -I../../../src/include -I/opt/reb/include
-I/opt/sfw/include-DFRONTEND -DSYSCONFDIR='"/opt/reb/etc/postgresql"'  -c -o fe-connect.o fe-connect.c 
   In file included from fe-connect.c:46:
   /usr/include/crypt.h:22: error: parse error before '(' token
   /usr/include/crypt.h:22: error: parse error before "const"
   gmake[4]: *** [fe-connect.o] Error 1
   gmake[4]: Leaving directory `/net/cog/project/reb/src/base/postgresql/src/interfaces/libpq'

This is the OpenSSH-versus-crypt.h compatibility issue that is discussed
in doc/FAQ_Solaris thusly:

   2) Why do I get problems when building with OpenSSL support?

   When you build PostgreSQL with OpenSSL support you might get
   compilation errors in the following files:

   src/backend/libpq/crypt.c
   src/backend/libpq/password.c
   src/interfaces/libpq/fe-auth.c
   src/interfaces/libpq/fe-connect.c

   This is because of a namespace conflict between the standard
   /usr/include/crypt.h header and the header files provided by OpenSSL.

   Upgrading your OpenSSL installation to version 0.9.6a fixes this
   problem.

Apparently the problem has come back (in limited form) in OpenSSL 0.9.7b,
the current version of OpenSSL.

I worked around the problem as follows.  However, I don't offhand see
why fe-connect.c has to include <crypt.h> at all, so perhaps a simpler
fix is to remove the #include on all platforms.

===================================================================
RCS file: src/interfaces/libpq/fe-connect.c,v
retrieving revision 7.3.3.0
retrieving revision 7.3.3.1
diff -pu -r7.3.3.0 -r7.3.3.1
--- src/interfaces/libpq/fe-connect.c    2003/01/30 19:50:07    7.3.3.0
+++ src/interfaces/libpq/fe-connect.c    2003/06/12 21:06:06    7.3.3.1
@@ -42,7 +42,7 @@
 #ifndef HAVE_STRDUP
 #include "strdup.h"
 #endif
-#ifdef HAVE_CRYPT_H
+#if defined(HAVE_CRYPT_H) && !defined(des_crypt)
 #include <crypt.h>
 #endif

Re: fe-connect build failure (Solaris 9, PGSQL 7.3.3, OpenSSL

From
Bruce Momjian
Date:
OK, I removed #include crypt.h from fe-connect.c, because as you stated,
it didn't seem needed, and was causing problems.  This fix will be in 7.4.

---------------------------------------------------------------------------

Paul Eggert wrote:
> I ran into the following problem building PostgreSQL 7.3.3 on Solaris
> 9 (sparc) using GCC 3.3 and OpenSSL 0.9.7b.
>
>    gcc -g -Wall -Wmissing-prototypes -Wmissing-declarations -fPIC -I. -I../../../src/include -I/opt/reb/include
-I/opt/sfw/include-DFRONTEND -DSYSCONFDIR='"/opt/reb/etc/postgresql"'  -c -o fe-connect.o fe-connect.c 
>    In file included from fe-connect.c:46:
>    /usr/include/crypt.h:22: error: parse error before '(' token
>    /usr/include/crypt.h:22: error: parse error before "const"
>    gmake[4]: *** [fe-connect.o] Error 1
>    gmake[4]: Leaving directory `/net/cog/project/reb/src/base/postgresql/src/interfaces/libpq'
>
> This is the OpenSSH-versus-crypt.h compatibility issue that is discussed
> in doc/FAQ_Solaris thusly:
>
>    2) Why do I get problems when building with OpenSSL support?
>
>    When you build PostgreSQL with OpenSSL support you might get
>    compilation errors in the following files:
>
>    src/backend/libpq/crypt.c
>    src/backend/libpq/password.c
>    src/interfaces/libpq/fe-auth.c
>    src/interfaces/libpq/fe-connect.c
>
>    This is because of a namespace conflict between the standard
>    /usr/include/crypt.h header and the header files provided by OpenSSL.
>
>    Upgrading your OpenSSL installation to version 0.9.6a fixes this
>    problem.
>
> Apparently the problem has come back (in limited form) in OpenSSL 0.9.7b,
> the current version of OpenSSL.
>
> I worked around the problem as follows.  However, I don't offhand see
> why fe-connect.c has to include <crypt.h> at all, so perhaps a simpler
> fix is to remove the #include on all platforms.
>
> ===================================================================
> RCS file: src/interfaces/libpq/fe-connect.c,v
> retrieving revision 7.3.3.0
> retrieving revision 7.3.3.1
> diff -pu -r7.3.3.0 -r7.3.3.1
> --- src/interfaces/libpq/fe-connect.c    2003/01/30 19:50:07    7.3.3.0
> +++ src/interfaces/libpq/fe-connect.c    2003/06/12 21:06:06    7.3.3.1
> @@ -42,7 +42,7 @@
>  #ifndef HAVE_STRDUP
>  #include "strdup.h"
>  #endif
> -#ifdef HAVE_CRYPT_H
> +#if defined(HAVE_CRYPT_H) && !defined(des_crypt)
>  #include <crypt.h>
>  #endif
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073