Skip to content

Simple client compilation fails #128

@ig0r

Description

@ig0r

Hi guys,

I've generated standalone telehash.h and telehash.c (also added peer.c as a source as I need some methods from there) and created a simple telehash client that uses it.

Currently I got a bunch of compilation errors:

gcc -Iinclude -Iinclude/lib -Iunix -Ithrowback -g -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -DDEBUG -c telehash.c -o telehash.o
telehash.c: In function ‘lob_set_printf’:
telehash.c:254:3: warning: implicit declaration of function ‘vasprintf’ [-Wimplicit-function-declaration]
   vasprintf(&val, format, ap);
   ^
telehash.c: In function ‘util_frames_await’:
telehash.c:7940:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if((frames->out * PAYLOAD(frames)) > lob_len(frames->outbox)) return frames;
                                      ^
telehash.c: In function ‘peer_send’:
telehash.c:9118:45: error: ‘struct pipe_struct’ has no member named ‘arg’
   if(!(router = mesh_linkid(link->mesh, pipe->arg)))
                                             ^
In file included from telehash.c:1:0:
telehash.c:9120:44: error: ‘struct pipe_struct’ has no member named ‘id’
     LOG("router link not found for %s",pipe->id);
                                            ^
include/telehash.h:5219:77: note: in definition of macro ‘LOG’
 #define LOG(fmt, ...) util_sys_log(7, __FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
                                                                             ^
telehash.c:9127:38: error: ‘struct pipe_struct’ has no member named ‘id’
     LOG("bridging via router %s",pipe->id);
                                      ^
include/telehash.h:5219:77: note: in definition of macro ‘LOG’
 #define LOG(fmt, ...) util_sys_log(7, __FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
                                                                             ^
telehash.c:9132:35: error: ‘struct pipe_struct’ has no member named ‘id’
   LOG("peering via router %s",pipe->id);
                                   ^
include/telehash.h:5219:77: note: in definition of macro ‘LOG’
 #define LOG(fmt, ...) util_sys_log(7, __FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
                                                                             ^
telehash.c:9137:3: error: too many arguments to function ‘link_direct’
   link_direct(router,open,NULL);
   ^
telehash.c:6960:8: note: declared here
 link_t link_direct(link_t link, lob_t inner)
        ^
telehash.c:9140:3: warning: implicit declaration of function ‘mesh_forward’ [-Wimplicit-function-declaration]
   mesh_forward(link->mesh, packet->body, link, 0);
   ^
telehash.c: In function ‘peer_pipe’:
telehash.c:9151:23: error: ‘struct mesh_struct’ has no member named ‘index’
   pipes = xht_get(mesh->index, "ext_peer_pipes");
                       ^
telehash.c:9152:60: error: ‘struct pipe_struct’ has no member named ‘id’
   for(pipe = pipes;pipe;pipe = pipe->next) if(util_cmp(pipe->id,sn) == 0) return pipe;
                                                            ^
telehash.c:9155:15: warning: implicit declaration of function ‘pipe_new’ [-Wimplicit-function-declaration]
   if(!(pipe = pipe_new("peer"))) return NULL;
               ^
telehash.c:9155:13: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
   if(!(pipe = pipe_new("peer"))) return NULL;
             ^
telehash.c:9156:7: error: ‘struct pipe_struct’ has no member named ‘id’
   pipe->id = strdup(hashname_short(peer));
       ^
telehash.c:9157:7: error: ‘struct pipe_struct’ has no member named ‘arg’
   pipe->arg = hashname_dup(peer);
       ^
telehash.c:9158:7: error: ‘struct pipe_struct’ has no member named ‘send’
   pipe->send = peer_send;
       ^
telehash.c:9160:15: error: ‘struct mesh_struct’ has no member named ‘index’
   xht_set(mesh->index,"ext_peer_pipes",pipe);
               ^
telehash.c: In function ‘peer_open_connect’:
telehash.c:9199:25: error: too many arguments to function ‘mesh_receive’
   if(hs->head_len == 1) mesh_receive(link->mesh, hs, pipe);
                         ^
telehash.c:6467:8: note: declared here
 link_t mesh_receive(mesh_t mesh, lob_t outer)
        ^
telehash.c:9202:5: error: too many arguments to function ‘mesh_receive_handshake’
     mesh_receive_handshake(link->mesh, hs, pipe);
     ^
telehash.c:6390:8: note: declared here
 link_t mesh_receive_handshake(mesh_t mesh, lob_t handshake)
        ^
telehash.c: In function ‘peer_open_peer’:
telehash.c:9241:3: error: too many arguments to function ‘link_direct’
   link_direct(peer,open,NULL); // encrypts then sends
   ^
telehash.c:6960:8: note: declared here
 link_t link_direct(link_t link, lob_t inner)
        ^
telehash.c: In function ‘peer_free’:
telehash.c:9249:23: error: ‘struct mesh_struct’ has no member named ‘index’
   pipes = xht_get(mesh->index, "ext_peer_pipes");
                       ^
telehash.c:9254:23: error: ‘struct pipe_struct’ has no member named ‘arg’
     hashname_free(pipe->arg);
                       ^
telehash.c: In function ‘peer_enable’:
telehash.c:9263:34: warning: passing argument 3 of ‘mesh_on_path’ from incompatible pointer type [-Wincompatible-pointer-types]
   mesh_on_path(mesh, "ext_peer", peer_path);
                                  ^
telehash.c:6332:6: note: expected ‘struct link_struct * (*)(struct link_struct *, struct lob_struct *)’ but argument is of type ‘struct pipe_struct * (*)(struct link_struct *, struct lob_struct *)’
 void mesh_on_path(mesh_t mesh, char *id, link_t (*path)(link_t link, lob_t path))
      ^
telehash.c: In function ‘peer_connect’:
telehash.c:9293:68: warning: implicit declaration of function ‘link_handshakes’ [-Wimplicit-function-declaration]
   if(!(pipe = peer_pipe(peer->mesh, router->id)) || !(handshakes = link_handshakes(peer))) return LOG("internal error");
                                                                    ^
telehash.c:9293:66: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
   if(!(pipe = peer_pipe(peer->mesh, router->id)) || !(handshakes = link_handshakes(peer))) return LOG("internal error");
                                                                  ^
Makefile:123: recipe for target 'telehash.o' failed
make: *** [telehash.o] Error 1

It seems like most of the errors is related to the fact that peer_*() methods expect different pipe_struct and mesh_struct, and some methods are expected to have different signatures.

Do you have any suggestions to resolve those issues?

Thanks!

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