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

can't compile on Mac OS 10.9.5 - unknown type name n_short and n_time #1

Closed
PmE8HW0KRfqa opened this issue Apr 4, 2016 · 10 comments
Closed

Comments

@PmE8HW0KRfqa
Copy link

make
cc  -g -Os   -c -o cnping.o cnping.c
In file included from cnping.c:13:
/usr/include/netinet/ip_icmp.h:92:4: error: unknown type name 'n_short'; did you
      mean 'u_short'?
                        n_short icd_id;
                        ^
/usr/include/sys/types.h:85:25: note: 'u_short' declared here
typedef unsigned short          u_short;
                                ^
In file included from cnping.c:13:
/usr/include/netinet/ip_icmp.h:93:4: error: unknown type name 'n_short'; did you
      mean 'u_short'?
                        n_short icd_seq;
                        ^
/usr/include/sys/types.h:85:25: note: 'u_short' declared here
typedef unsigned short          u_short;
                                ^
In file included from cnping.c:13:
/usr/include/netinet/ip_icmp.h:99:4: error: unknown type name 'n_short'; did you
      mean 'u_short'?
                        n_short ipm_void;
                        ^
/usr/include/sys/types.h:85:25: note: 'u_short' declared here
typedef unsigned short          u_short;
                                ^
In file included from cnping.c:13:
/usr/include/netinet/ip_icmp.h:100:4: error: unknown type name 'n_short'; did
      you mean 'u_short'?
                        n_short ipm_nextmtu;
                        ^
/usr/include/sys/types.h:85:25: note: 'u_short' declared here
typedef unsigned short          u_short;
                                ^
In file included from cnping.c:13:
/usr/include/netinet/ip_icmp.h:121:4: error: unknown type name 'n_time'
                        n_time its_otime;
                        ^
/usr/include/netinet/ip_icmp.h:122:4: error: unknown type name 'n_time'
                        n_time its_rtime;
                        ^
/usr/include/netinet/ip_icmp.h:123:4: error: unknown type name 'n_time'
                        n_time its_ttime;
                        ^
/usr/include/netinet/ip_icmp.h:126:14: error: field has incomplete type
      'struct ip'
                        struct ip idi_ip;
                                  ^
/usr/include/netinet/ip_icmp.h:126:11: note: forward declaration of 'struct ip'
                        struct ip idi_ip;
                               ^
8 errors generated.
make: *** [cnping.o] Error 1

@cnlohr
Copy link
Member

cnlohr commented Apr 4, 2016

woah... I don't know for sure, my first inclination is to add a -D_GNU_SOURCE to the compile flags.

@mischnic
Copy link
Contributor

It compiled after adding some includes and copying the icmphdr struct definition from the WIN32 part.
But then running fails: Error: Failed to set TTL option . That might has to do something with #define SOL_IP IPPROTO_IP?

Patch
mac.patch.txt

@hackrid
Copy link
Contributor

hackrid commented Apr 22, 2016

had the same issue. you must run it as root

@hackrid
Copy link
Contributor

hackrid commented Apr 23, 2016

... or what ever you call it on osx ;)

@Yann-R
Copy link

Yann-R commented Sep 25, 2016

Most of the time, when n_short and n_time are missing definitions on Mac around ip_icmp, the reason is missing #include <netinet/ip.h>

Sometimes, you already have #include <netinet/in.h> instead, which is not sufficient and can be replaced by the above ip.hthat transitively includes in.h

@cnlohr
Copy link
Member

cnlohr commented Sep 27, 2016

So... do changes need to be made on my part?

@mischnic
Copy link
Contributor

I updated the code and now I get these errors after closing the cnping window using the button:

XIO:  fatal IO error 60 (Operation timed out) on X server "/private/tmp/com.apple.launchd.9Bj5LvF6tU/org.macosforge.xquartz:0"
      after 28747 requests (28453 known processed) with 0 events remaining.

Obvisouly, cnping exits, should I ignore the message?
(I was going to create a pull request)

@mischnic
Copy link
Contributor

Can be closed (pr #10 & #11)

@Dauie
Copy link

Dauie commented Jul 15, 2018

Also, if you do have this issue after including: Make sure that you are including <netinet/ip.h> before you include any libraries that reference the type alias n_short. i.g. <netinet/ip_icmp.h>

@cnlohr
Copy link
Member

cnlohr commented Jul 15, 2018

Does that mean the code as it stands doesn't work?

cnlohr pushed a commit that referenced this issue Jul 28, 2018
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

6 participants