Skip to content

Two compile errors in src/net/conn_plain.c on *BSD platforms #700

@oldgreen

Description

@oldgreen

I've encountered a minor hiccup compiling the new version 0.12.0. I've had no problems with the previous version 0.11.0. Please find the relevant information and suggested fix in the following text:

$ uname -spr
NetBSD 7.1_STABLE x86_64

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/lto-wrapper
Target: x86_64--netbsd
Configured with: /usr/7/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=x86_64--netbsd --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb2 20150115' --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-threads --with-tune=nocona --enable-libstdcxx-time=rt --enable-lto --with-mpc-lib=/var/obj/mknative/amd64-x86_64/usr/7/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/amd64-x86_64/usr/7/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/amd64-x86_64/usr/7/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/7/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/7/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/7/src/external/lgpl3/gmp/lib/libgmp/arch/x86_64 --enable-tls --disable-multilib --disable-symvers --disable-libstdcxx-pch --build=x86_64-unknown-netbsd6.0. --host=x86_64--netbsd --with-sysroot=/var/obj/mknative/amd64-x86_64/usr/7/src/destdir.amd64
Thread model: posix
gcc version 4.8.5 (nb2 20150115) 

$ PATH=/home/zzz/local/postgresql_10.5/bin:/home/zzz/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R7/bin:/usr/pkg/bin:/usr/pkg/sbin:/usr/games sh -c 'bash ./bootstrap'
-- The C compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- TimescaleDB version 0.12.0. Can be updated from version 0.11.0
-- Build type is 
-- Performing Test CC_SUPPORTS_VISIBILITY_HIDDEN
-- Performing Test CC_SUPPORTS_VISIBILITY_HIDDEN - Success
-- Using compiler GNU
-- Found Git: /usr/pkg/bin/git (found version "2.16.4") 
-- Using pg_config /home/zzz/local/postgresql_10.5/bin/pg_config
-- Compiling against PostgreSQL version 10.5
-- Install pgindent to be able to format C code: https://github.com/postgres/postgres/tree/master/src/tools/pgindent
-- Found OpenSSL: /usr/lib/libcrypto.so (found version "1.0.1u") 
-- Using OpenSSL version 1.0.1u
-- Using pg_regress /home/zzz/local/postgresql_10.5/lib/pgxs/src/test/regress/pg_regress
-- Using objdump /usr/bin/objdump
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zzz/project/github/timescaledb/build
TimescaleDB build system initialized in ./build. To compile, do:
cd ./build && make

[...]

[ 83%] Building C object src/CMakeFiles/timescaledb.dir/net/conn_plain.c.o
/home/u1/projekty/github/timescaledb/src/net/conn_plain.c: In function ‘plain_connect’:
/home/u1/projekty/github/timescaledb/src/net/conn_plain.c:28:16: error: ‘PF_UNSPEC’ undeclared (first use in this function)
   .ai_family = PF_UNSPEC,
                ^
[...]

/home/u1/projekty/github/timescaledb/src/net/conn_plain.c: In function ‘plain_set_timeout’:
/home/u1/projekty/github/timescaledb/src/net/conn_plain.c:175:9: error: variable ‘timeout’ has initializer but incomplete type
  struct timeval timeout = {

There are no errors if the following patch is applied:

diff --git a/src/net/conn_plain.c b/src/net/conn_plain.c
index 1a582d2..16ebca5 100644
--- a/src/net/conn_plain.c
+++ b/src/net/conn_plain.c
@@ -1,6 +1,8 @@
 #include <unistd.h>
 #include <postgres.h>
 #include <pg_config.h>
+#include <sys/socket.h>
+#include <sys/time.h>
 
 #include "conn_internal.h"
 #include "conn_plain.h"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions