Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to compile on CentOS 7 #8

Closed
TheFiZi opened this issue Mar 7, 2020 · 3 comments
Closed

Unable to compile on CentOS 7 #8

TheFiZi opened this issue Mar 7, 2020 · 3 comments

Comments

@TheFiZi
Copy link

TheFiZi commented Mar 7, 2020

When trying to compile on CentOS 7 I receive the following output:

[root@TURMERIC udp-broadcast-relay]# make
c99   -Wall main.c -o udp-broadcast-relay
main.c:64:1: error: unknown type name ‘u_char’
 static u_char gram[4096] = {
 ^
main.c: In function ‘main’:
main.c:80:2: error: unknown type name ‘u_char’
  u_char id;
  ^
main.c:81:2: error: unknown type name ‘u_char’
  u_char ttl;
  ^
main.c:100:2: error: unknown type name ‘u_char’
  u_char pkt_infos[16384];
  ^
main.c:235:3: warning: implicit declaration of function ‘bcopy’ [-Wimplicit-function-declaration]
   bcopy((struct sockaddr_in *) &reqbuf.ifr_addr,
   ^
main.c:316:4: error: ‘u_short’ undeclared (first use in this function)
  *(u_short*)(gram + 22) = (u_short) htons(port);
    ^
main.c:316:4: note: each undeclared identifier is reported only once for each function it appears in
main.c:316:12: error: expected expression before ‘)’ token
  *(u_short*)(gram + 22) = (u_short) htons(port);
            ^
main.c:316:37: error: expected ‘;’ before ‘htons’
  *(u_short*)(gram + 22) = (u_short) htons(port);
                                     ^
main.c:347:59: error: dereferencing pointer to incomplete type
      rcv_ifindex = ((struct in_pktinfo *) CMSG_DATA(cmsg))->ipi_ifindex;
                                                           ^
main.c:374:13: error: expected expression before ‘)’ token
   *(u_short*)(gram + 20) = (u_short) rcv_addr.sin_port;
             ^
main.c:374:38: error: expected ‘;’ before ‘rcv_addr’
   *(u_short*)(gram + 20) = (u_short) rcv_addr.sin_port;
                                      ^
main.c:377:13: error: expected expression before ‘)’ token
   *(u_short*)(gram + 24) = htons(8 + len);
             ^
main.c:378:13: error: expected expression before ‘)’ token
   *(u_short*)(gram + 2) = htons(28 + len);
             ^
main.c:392:21: error: expected expression before ‘)’ token
     ntohs(*(u_short*) (gram + 22)), /* dst port */
                     ^
make: *** [udp-broadcast-relay] Error 1
[root@TURMERIC udp-broadcast-relay]# c99 --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@TheFiZi
Copy link
Author

TheFiZi commented Mar 7, 2020

I've made a bit of progress with a CFLAG recommendation I found here

[root@TURMERIC udp-broadcast-relay]# CFLAGS='-Du_char="unsigned char"'
[root@TURMERIC udp-broadcast-relay]# export CFLAGS
[root@TURMERIC udp-broadcast-relay]# make
c99 -Du_char="unsigned char"  -Wall main.c -o udp-broadcast-relay
main.c: In function ‘main’:
main.c:235:3: warning: implicit declaration of function ‘bcopy’ [-Wimplicit-function-declaration]
   bcopy((struct sockaddr_in *) &reqbuf.ifr_addr,
   ^
main.c:316:4: error: ‘u_short’ undeclared (first use in this function)
  *(u_short*)(gram + 22) = (u_short) htons(port);
    ^
main.c:316:4: note: each undeclared identifier is reported only once for each function it appears in
main.c:316:12: error: expected expression before ‘)’ token
  *(u_short*)(gram + 22) = (u_short) htons(port);
            ^
main.c:316:37: error: expected ‘;’ before ‘htons’
  *(u_short*)(gram + 22) = (u_short) htons(port);
                                     ^
main.c:347:59: error: dereferencing pointer to incomplete type
      rcv_ifindex = ((struct in_pktinfo *) CMSG_DATA(cmsg))->ipi_ifindex;
                                                           ^
main.c:374:13: error: expected expression before ‘)’ token
   *(u_short*)(gram + 20) = (u_short) rcv_addr.sin_port;
             ^
main.c:374:38: error: expected ‘;’ before ‘rcv_addr’
   *(u_short*)(gram + 20) = (u_short) rcv_addr.sin_port;
                                      ^
main.c:377:13: error: expected expression before ‘)’ token
   *(u_short*)(gram + 24) = htons(8 + len);
             ^
main.c:378:13: error: expected expression before ‘)’ token
   *(u_short*)(gram + 2) = htons(28 + len);
             ^
main.c:392:21: error: expected expression before ‘)’ token
     ntohs(*(u_short*) (gram + 22)), /* dst port */
                     ^
make: *** [udp-broadcast-relay] Error 1

@TheFiZi
Copy link
Author

TheFiZi commented Mar 7, 2020

What ever improvements were made by this PR fixed my compilation issues.

I've cloned their repo for now and will use that until their PR is merged.

@TheFiZi TheFiZi closed this as completed Mar 7, 2020
@nomeata
Copy link
Owner

nomeata commented Mar 8, 2020

That’s odd, #7 doesn’t seem to affect compilation via make at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants