Bug 269039 - net/libvncserver: error: use of undeclared identifier 'PF_INET'
Summary: net/libvncserver: error: use of undeclared identifier 'PF_INET'
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Neel Chauhan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-18 22:31 UTC by Vladimir Druzenko
Modified: 2023-01-29 16:21 UTC (History)
1 user (show)

See Also:
nc: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Druzenko freebsd_committer freebsd_triage 2023-01-18 22:31:37 UTC
13.1-p5 amd64.
After this commit https://cgit.freebsd.org/ports/commit/?id=180d33e6f234e6c485ec29f7c4d2367b06e28ef1 build fails:
=========================================================================
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:56:18: warning: implicit declaration of function 'accept' is invalid in C99 [-Wimplicit-function-declaration]
    proxy_sock = accept(data->local_listensock, (struct sockaddr *)&sin, &sinlen);
                 ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:63:5: warning: implicit declaration of function 'close' is invalid in C99 [-Wimplicit-function-declaration]
    rfbCloseSocket(data->local_listensock);
    ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/rfb/rfbproto.h:117:6: note: expanded from macro 'rfbCloseSocket'
            _rfbCloseSocket(s);         \
            ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/rfb/rfbproto.h:107:25: note: expanded from macro '_rfbCloseSocket'
#define _rfbCloseSocket close
                        ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:94:19: warning: implicit declaration of function 'recv' is invalid in C99 [-Wimplicit-function-declaration]
            len = recv(proxy_sock, buf, sizeof(buf), 0);
                  ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:127:21: warning: implicit declaration of function 'send' is invalid in C99 [-Wimplicit-function-declaration]
                i = send(proxy_sock, buf + wr, len - wr, 0);
                    ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:146:5: warning: implicit declaration of function 'close' is invalid in C99 [-Wimplicit-function-declaration]
    rfbCloseSocket(proxy_sock);
    ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/rfb/rfbproto.h:117:6: note: expanded from macro 'rfbCloseSocket'
            _rfbCloseSocket(s);         \
            ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/rfb/rfbproto.h:107:25: note: expanded from macro '_rfbCloseSocket'
#define _rfbCloseSocket close
                        ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:154:5: warning: implicit declaration of function 'close' is invalid in C99 [-Wimplicit-function-declaration]
    rfbCloseSocket(data->ssh_sock);
    ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/rfb/rfbproto.h:117:6: note: expanded from macro 'rfbCloseSocket'
            _rfbCloseSocket(s);         \
            ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/rfb/rfbproto.h:107:25: note: expanded from macro '_rfbCloseSocket'
#define _rfbCloseSocket close
                        ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:213:22: warning: implicit declaration of function 'socket' is invalid in C99 [-Wimplicit-function-declaration]
    data->ssh_sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
                     ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:213:29: error: use of undeclared identifier 'PF_INET'
    data->ssh_sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
                            ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:213:38: error: use of undeclared identifier 'SOCK_STREAM'
    data->ssh_sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
                                     ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:220:25: error: use of undeclared identifier 'AF_INET'
    hints.ai_family   = AF_INET;
                        ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:221:25: error: use of undeclared identifier 'SOCK_STREAM'
    hints.ai_socktype = SOCK_STREAM;
                        ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:224:19: error: use of undeclared identifier 'AF_INET'
        sin.sin_family = AF_INET;
                         ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:233:8: warning: implicit declaration of function 'connect' is invalid in C99 [-Wimplicit-function-declaration]
    if(connect(data->ssh_sock, (struct sockaddr*)(&sin), sizeof(struct sockaddr_in)) != 0) {
       ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:288:37: error: use of undeclared identifier 'PF_INET'
    data->local_listensock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
                                    ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:288:46: error: use of undeclared identifier 'SOCK_STREAM'
    data->local_listensock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
                                             ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:293:22: error: use of undeclared identifier 'AF_INET'
    sin.sin_family = AF_INET;
                     ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:301:14: warning: implicit declaration of function 'bind' is invalid in C99 [-Wimplicit-function-declaration]
    if(-1 == bind(data->local_listensock, (struct sockaddr *)&sin, sinlen)) {
             ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:305:14: warning: implicit declaration of function 'listen' is invalid in C99 [-Wimplicit-function-declaration]
    if(-1 == listen(data->local_listensock, 1)) {
             ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:311:9: warning: implicit declaration of function 'getsockname' is invalid in C99 [-Wimplicit-function-declaration]
    if (getsockname(data->local_listensock, (struct sockaddr *)&sin, &sinlen ) == -1){
        ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:340:5: warning: implicit declaration of function 'close' is invalid in C99 [-Wimplicit-function-declaration]
    rfbCloseSocket(data->local_listensock);
    ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/rfb/rfbproto.h:117:6: note: expanded from macro 'rfbCloseSocket'
            _rfbCloseSocket(s);         \
            ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/rfb/rfbproto.h:107:25: note: expanded from macro '_rfbCloseSocket'
#define _rfbCloseSocket close
                        ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:341:5: warning: implicit declaration of function 'close' is invalid in C99 [-Wimplicit-function-declaration]
    rfbCloseSocket(data->ssh_sock);
    ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/rfb/rfbproto.h:117:6: note: expanded from macro 'rfbCloseSocket'
            _rfbCloseSocket(s);         \
            ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/rfb/rfbproto.h:107:25: note: expanded from macro '_rfbCloseSocket'
#define _rfbCloseSocket close
                        ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/client_examples/sshtunnel.c:423:6: warning: implicit declaration of function 'close' is invalid in C99 [-Wimplicit-function-declaration]
            rfbCloseSocket(client->sock);
            ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/rfb/rfbproto.h:117:6: note: expanded from macro 'rfbCloseSocket'
            _rfbCloseSocket(s);         \
            ^
/tmp/work/usr/ports/net/libvncserver/work/libvncserver-LibVNCServer-0.9.14/rfb/rfbproto.h:107:25: note: expanded from macro '_rfbCloseSocket'
#define _rfbCloseSocket close
                        ^
14 warnings and 8 errors generated.
=========================================================================
Maybe maintainer forgot to commit patch file net/libvncserver/files/patch-client__examples_sshtunnel.c:
--- client_examples/sshtunnel.c.orig
+++ client_examples/sshtunnel.c
@@ -10,6 +10,9 @@
  *  - added name resolution for the ssh host
  */

+#include <sys/types.h>
+#include <sys/socket.h>
+#include <unistd.h>
 #include <rfb/rfbclient.h>
 #include <libssh2.h>
 #include <arpa/inet.h>
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2023-01-18 22:45:33 UTC
Posted to upstream: https://github.com/LibVNC/libvncserver/issues/548
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-01-18 23:02:42 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=14c0b3dee82151215ff4327423e3758369b37499

commit 14c0b3dee82151215ff4327423e3758369b37499
Author:     Neel Chauhan <nc@FreeBSD.org>
AuthorDate: 2023-01-18 23:00:11 +0000
Commit:     Neel Chauhan <nc@FreeBSD.org>
CommitDate: 2023-01-18 23:00:11 +0000

    net/libvncserver: Fix build

    PR:             269039
    Reported by:    VVD <vvd@unislabs.com>

 .../files/patch-client__examples_sshtunnel.c (new)           | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Comment 3 Neel Chauhan freebsd_committer freebsd_triage 2023-01-18 23:02:57 UTC
I have added a patch to fix this: https://cgit.freebsd.org/ports/commit/?id=14c0b3dee82151215ff4327423e3758369b37499

Pull the latest ports tree.
Comment 4 Vladimir Druzenko freebsd_committer freebsd_triage 2023-01-18 23:08:46 UTC
Can you check in portlint(?) dependencies?
It use #include <libssh2.h> from security/libssh2, but:
$ pkg info -d libvncserver
libvncserver-0.9.14:
        libgpg-error-1.46
        libgcrypt-1.9.4_1
        png-1.6.39
        jpeg-turbo-2.1.4
        lzo2-2.10_1
Comment 5 Vladimir Druzenko freebsd_committer freebsd_triage 2023-01-18 23:10:34 UTC
"close" require #include <unistd.h>
Comment 6 Vladimir Druzenko freebsd_committer freebsd_triage 2023-01-18 23:38:52 UTC
Configure stage silent grab libssh2:

If libssh2 not installed:
> Could NOT find LibSSH2 (missing: LIBSSH2_LIBRARY LIBSSH2_INCLUDE_DIR)

If libssh2 installed:
> -- Found LibSSH2: /usr/local/lib/libssh2.so (found version "1.10.0")
Comment 7 Vladimir Druzenko freebsd_committer freebsd_triage 2023-01-29 16:21:18 UTC
Maybe turn off WITH_LIBSSH2 and WITH_EXAMPLES by default?