Thread: built 6.4.2 on SCO OpenServer 5.0.5
I recently successfully built PostgreSQL 6.4.2 on SCO OpenServer 5.0.5, using SCO's UDK compiler. (For those not familiar with SCO, they have two distinct product lines, OpenServer and UnixWare, both current and supported by SCO. It would be nice if PostgreSQL continued to work on both. OpenServer is SVR3.2 based, and UnixWare 7 is SVR5 based.) SCO's UDK compiler is their UnixWare compiler, but it runs on UnixWare 7, UnixWare 2.1.X, and OpenServer 5.X, and produces binaries that will run on all three platforms. I have not tried the native SCO OpenServer compiler yet. The biggest problem is in pgsql/src/backend/libpq/pqcomm.c. In the StreamServerPort() function, on line 534, setsockopt() is used to set the socket to SO_REUSEADDR. This fails under OpenServer for UNIX domain sockets (family AF_UNIX). It works fine for AF_INET sockets. So, I surrounded the call to setsockopt() with an check for the correct family: if (family == AF_INET) { if ((setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &one, sizeof(one))) == -1) { sprintf(PQerrormsg, "FATAL: StreamServerPort: setsockopt (SO_REUSEADDR) failed: errno=%d\n", errno); fputs(PQerrormsg, stderr); pqdebug("%s", PQerrormsg); return STATUS_ERROR; } } However, I don't know enough about UNIX domain sockets to know if this is really a good idea or not. (Help, please?) I always use TCP/IP for my own work anyway. If you are using SCO's UDK, you are essentially pretending that you are using UnixWare. So, you need to also make the following changes: In pgsql/src/include/port, replace sco.h with unixware.h. In pgsql/src/template/sco, replace the CFLAGS line with: CFLAGS:-O -Kpentium,host,inline,loop_unroll,alloca If you installed bison and flex (I did; they're on SCO's SkunkWare CD), then also change the YACC and LEX lines in the same file to: YACC:bison LEX:flex If you want to use the readline library with psql (so you can use the up-arrow to get previous commands, etc.), make sure to install the *UnixWare* version from the SkunkWare CD, as the OpenServer version on the CD is not compatible with the new UDK compiler. Make sure that you have '.' (period) in your PATH when you build. The command line I used for configure was: configure --with-libs=/usr/local/lib --with-includes=/usr/local/include --without-CXX I haven't been able to build the C++ interface with the UDK, so I just disable it. This worked for me; ask if you have any trouble. Andrew Merrill
Hackers, where are we on this one? > I recently successfully built PostgreSQL 6.4.2 on SCO OpenServer 5.0.5, > using SCO's UDK compiler. > > (For those not familiar with SCO, they have two distinct product lines, > OpenServer and UnixWare, both current and supported by SCO. It would be > nice if PostgreSQL continued to work on both. OpenServer is SVR3.2 > based, and UnixWare 7 is SVR5 based.) > > SCO's UDK compiler is their UnixWare compiler, but it runs on UnixWare > 7, UnixWare 2.1.X, and OpenServer 5.X, and produces binaries that will > run on all three platforms. I have not tried the native SCO OpenServer > compiler yet. > > The biggest problem is in pgsql/src/backend/libpq/pqcomm.c. > > In the StreamServerPort() function, on line 534, setsockopt() is used to > set the socket to SO_REUSEADDR. This fails under OpenServer for UNIX > domain sockets (family AF_UNIX). It works fine for AF_INET sockets. > So, I surrounded the call to setsockopt() with an check for the correct > family: > > if (family == AF_INET) { > > if ((setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &one, > sizeof(one))) == -1) > { > sprintf(PQerrormsg, > "FATAL: StreamServerPort: setsockopt (SO_REUSEADDR) failed: > errno=%d\n", errno); > fputs(PQerrormsg, stderr); > pqdebug("%s", PQerrormsg); > return STATUS_ERROR; > } > > } > > However, I don't know enough about UNIX domain sockets to know if this > is really a good idea or not. (Help, please?) I always use TCP/IP for > my own work anyway. > > If you are using SCO's UDK, you are essentially pretending that you are > using UnixWare. So, you need to also make the following changes: > > In pgsql/src/include/port, replace sco.h with unixware.h. > > In pgsql/src/template/sco, replace the CFLAGS line with: > > CFLAGS:-O -Kpentium,host,inline,loop_unroll,alloca > > If you installed bison and flex (I did; they're on SCO's SkunkWare CD), > then also change the YACC and LEX lines in the same file to: > > YACC:bison > LEX:flex > > If you want to use the readline library with psql (so you can use the > up-arrow to get previous commands, etc.), make sure to install the > *UnixWare* version from the SkunkWare CD, as the OpenServer version on > the CD is not compatible with the new UDK compiler. > > Make sure that you have '.' (period) in your PATH when you build. > > The command line I used for configure was: > > configure --with-libs=/usr/local/lib --with-includes=/usr/local/include > --without-CXX > > I haven't been able to build the C++ interface with the UDK, so I just > disable it. > > This worked for me; ask if you have any trouble. > > Andrew Merrill > > > -- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
We have integrated most of your suggestions in 6.5. We now have sco and unixware template files. > I recently successfully built PostgreSQL 6.4.2 on SCO OpenServer 5.0.5, > using SCO's UDK compiler. > > (For those not familiar with SCO, they have two distinct product lines, > OpenServer and UnixWare, both current and supported by SCO. It would be > nice if PostgreSQL continued to work on both. OpenServer is SVR3.2 > based, and UnixWare 7 is SVR5 based.) > > SCO's UDK compiler is their UnixWare compiler, but it runs on UnixWare > 7, UnixWare 2.1.X, and OpenServer 5.X, and produces binaries that will > run on all three platforms. I have not tried the native SCO OpenServer > compiler yet. > > The biggest problem is in pgsql/src/backend/libpq/pqcomm.c. > > In the StreamServerPort() function, on line 534, setsockopt() is used to > set the socket to SO_REUSEADDR. This fails under OpenServer for UNIX > domain sockets (family AF_UNIX). It works fine for AF_INET sockets. > So, I surrounded the call to setsockopt() with an check for the correct > family: > > if (family == AF_INET) { > > if ((setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &one, > sizeof(one))) == -1) > { > sprintf(PQerrormsg, > "FATAL: StreamServerPort: setsockopt (SO_REUSEADDR) failed: > errno=%d\n", errno); > fputs(PQerrormsg, stderr); > pqdebug("%s", PQerrormsg); > return STATUS_ERROR; > } > > } > > However, I don't know enough about UNIX domain sockets to know if this > is really a good idea or not. (Help, please?) I always use TCP/IP for > my own work anyway. > > If you are using SCO's UDK, you are essentially pretending that you are > using UnixWare. So, you need to also make the following changes: > > In pgsql/src/include/port, replace sco.h with unixware.h. > > In pgsql/src/template/sco, replace the CFLAGS line with: > > CFLAGS:-O -Kpentium,host,inline,loop_unroll,alloca > > If you installed bison and flex (I did; they're on SCO's SkunkWare CD), > then also change the YACC and LEX lines in the same file to: > > YACC:bison > LEX:flex > > If you want to use the readline library with psql (so you can use the > up-arrow to get previous commands, etc.), make sure to install the > *UnixWare* version from the SkunkWare CD, as the OpenServer version on > the CD is not compatible with the new UDK compiler. > > Make sure that you have '.' (period) in your PATH when you build. > > The command line I used for configure was: > > configure --with-libs=/usr/local/lib --with-includes=/usr/local/include > --without-CXX > > I haven't been able to build the C++ interface with the UDK, so I just > disable it. > > This worked for me; ask if you have any trouble. > > Andrew Merrill > > > -- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026