about ntohs() on windows

Asked by qingbaibai on 2011-12-02

Hello,

I build rohc-1.3.1 on windows with slickedit and MinGW. It appears the bug like "src/common/ip.c:408: undefined reference to `ntohs@4'" and <winsock.h> is included in ip.c .

Regards,
qingbaibai

Question information

Language:
English Edit question
Status:
Open
For:
rohc Edit question
Assignee:
No assignee Edit question
Last query:
2012-01-04
Last reply:
2012-03-11

Hello,

I do not understand your problem clearly. I'll try to reformulate it in order to be sure to understand it fully.

You are trying to build the ROHC library on Windows as asked in FAQ #180366. I recommended you to either use Cygwin or Mingw. You choose Mingw. While using mingw to build the library, you encountered an error that aborts the process. Am I right?

The error message seems to be "src/common/ip.c:408: undefined reference to `ntohs@4'". Am I right?

What I do not understand is why you mention that <winsock.h> is included in ip.c? I winsock.h something you added?

Regards,
Didier

qingbaibai (sunqing-cztz) said : #2

Hello,
I have solved the problem. I don't include netinet/in.h which defines the macro ntohs() because netinet/in.h includes other library functions of linux system. So I create a header file that includes the definition of ntohs(). I move the definition of ntohs() from linux to windows and the problem is solved. Thank you.
Regards,qingbaibai

> To: <email address hidden>
> From: <email address hidden>
> Date: Mon, 5 Dec 2011 18:20:52 +0000
> Subject: Re: [Rohc] [Question #180689]: about ntohs() on windows
>
> Question #180689 on rohc changed:
> https://answers.launchpad.net/rohc/+question/180689
>
> Status: Open => Needs information
>
> Didier Barvaux requested more information:
> Hello,
>
> I do not understand your problem clearly. I'll try to reformulate it in
> order to be sure to understand it fully.
>
> You are trying to build the ROHC library on Windows as asked in FAQ
> #180366. I recommended you to either use Cygwin or Mingw. You choose
> Mingw. While using mingw to build the library, you encountered an error
> that aborts the process. Am I right?
>
> The error message seems to be "src/common/ip.c:408: undefined reference
> to `ntohs@4'". Am I right?
>
> What I do not understand is why you mention that <winsock.h> is included
> in ip.c? I winsock.h something you added?
>
> Regards,
> Didier
>
> --
> You received this question notification because you are a member of ROHC
> Team, which is an answer contact for rohc.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~rohc
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~rohc
> More help : https://help.launchpad.net/ListHelp

Hello,

I'm pleased that you fixed the problem!

Could you quickly describe the process you followed to build the library with MinGW? Could you also send the source patch that makes the library build? It could be very helpful for other people that are interested in building the library under Windows...

Regards,
Didier

qingbaibai (sunqing-cztz) said : #4

hello,
What I've done is to modify some header files like netinet/ip.h, netinet/ip6.h and netinet/in.h to make sure that the library can be tested on windows. Now I'm learning Winpcap and I haven't add the Winpcap library to ROHC. Parts related to libpcap in test.c and test.h haven't solved. And I have't find the right function to replace the function gettimeofday() of linux.This is the source code I modified. I use SlickEdit code Editor and MinGW. I hope it will be helpful.
Regards,qingbaibai

> To: <email address hidden>
> From: <email address hidden>
> Date: Tue, 6 Dec 2011 19:41:01 +0000
> Subject: Re: [Rohc] [Question #180689]: about ntohs() on windows
>
> Question #180689 on rohc changed:
> https://answers.launchpad.net/rohc/+question/180689
>
> Status: Open => Needs information
>
> Didier Barvaux requested more information:
> Hello,
>
> I'm pleased that you fixed the problem!
>
> Could you quickly describe the process you followed to build the library
> with MinGW? Could you also send the source patch that makes the library
> build? It could be very helpful for other people that are interested in
> building the library under Windows...
>
> Regards,
> Didier
>
> --
> You received this question notification because you are a member of ROHC
> Team, which is an answer contact for rohc.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~rohc
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~rohc
> More help : https://help.launchpad.net/ListHelp

qingbaibai (sunqing-cztz) said : #5

hello,
There are still some bugs in the code I gave you.
Regards,qingbaibai

> To: <email address hidden>
> From: <email address hidden>
> Date: Tue, 6 Dec 2011 19:41:01 +0000
> Subject: Re: [Rohc] [Question #180689]: about ntohs() on windows
>
> Question #180689 on rohc changed:
> https://answers.launchpad.net/rohc/+question/180689
>
> Status: Open => Needs information
>
> Didier Barvaux requested more information:
> Hello,
>
> I'm pleased that you fixed the problem!
>
> Could you quickly describe the process you followed to build the library
> with MinGW? Could you also send the source patch that makes the library
> build? It could be very helpful for other people that are interested in
> building the library under Windows...
>
> Regards,
> Didier
>
> --
> You received this question notification because you are a member of ROHC
> Team, which is an answer contact for rohc.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~rohc
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~rohc
> More help : https://help.launchpad.net/ListHelp

Hello,

Thanks for giving some more information. You state that you gave me code, but I see nothing. Am I missing something?

I do not think you may attach some code to a "Launchpad question". If the code is not too large, try sending it to the mailing list.

Regards,
Didier

qingbaibai (sunqing-cztz) said : #7

hello,
I send the code again now.

> To: <email address hidden>
> From: <email address hidden>
> Subject: Re: [Question #180689]: about ntohs() on windows
> Date: Sun, 11 Dec 2011 15:55:49 +0000
>
> Your question #180689 on rohc changed:
> https://answers.launchpad.net/rohc/+question/180689
>
> Status: Open => Needs information
>
> Didier Barvaux requested more information:
> Hello,
>
> Thanks for giving some more information. You state that you gave me
> code, but I see nothing. Am I missing something?
>
> I do not think you may attach some code to a "Launchpad question". If
> the code is not too large, try sending it to the mailing list.
>
> Regards,
> Didier
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/rohc/+question/180689
>
> You received this question notification because you asked the question.

Sorry qingbaibai, it didn't work. How large is the code you try to send?

Regards,
Didier

qingbaibai (sunqing-cztz) said : #9

hello,
It is just 4.67M. Can you give me your own mail address? I send the code to your own mail. Thank you.
Regrads,qingbaibai

> To: <email address hidden>
> From: <email address hidden>
> Date: Tue, 13 Dec 2011 08:50:54 +0000
> Subject: Re: [Rohc] [Question #180689]: about ntohs() on windows
>
> Question #180689 on rohc changed:
> https://answers.launchpad.net/rohc/+question/180689
>
> Status: Open => Needs information
>
> Didier Barvaux requested more information:
> Sorry qingbaibai, it didn't work. How large is the code you try to send?
>
> Regards,
> Didier
>
> --
> You received this question notification because you are a member of ROHC
> Team, which is an answer contact for rohc.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~rohc
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~rohc
> More help : https://help.launchpad.net/ListHelp

Hello,

4.67 MB is quite large for a patch. Is it the full source code? If it is a pacth, how did you generate it?

Regards,
Didier

qingbaibai (sunqing-cztz) said : #11

hello,
It is the full code because I changed the header files. I will try to use mailing list. Thank you.
Regards,qingbaibai

> To: <email address hidden>
> From: <email address hidden>
> Subject: Re: [Question #180689]: about ntohs() on windows
> Date: Wed, 14 Dec 2011 18:01:12 +0000
>
> Your question #180689 on rohc changed:
> https://answers.launchpad.net/rohc/+question/180689
>
> Status: Open => Needs information
>
> Didier Barvaux requested more information:
> Hello,
>
> 4.67 MB is quite large for a patch. Is it the full source code? If it is
> a pacth, how did you generate it?
>
> Regards,
> Didier
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/rohc/+question/180689
>
> You received this question notification because you asked the question.

Hello,

Please try to create a patch for the code you changed in the ROHC library. For details about patch creation, see FAQ #640 and especially the section named "Submitting your modifications". The send the patch and the other files to the mailling list.

Regards,
Didier

Launchpad Janitor (janitor) said : #13

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Hello,

Any news on this? Do you encounter some difficulties creating the patch?

Regards,
Didier

qingbaibai (sunqing-cztz) said : #15

Hello,
I am so sorry to answerl you back. I delete the pcap file in my original files. Therefore, the size is reduced to 189KB. I write a description. Since I changed the code for some time, I just list general changes.
Regrads,qingbaibai

> To: <email address hidden>
> From: <email address hidden>
> Subject: Re: [Question #180689]: about ntohs() on windows
> Date: Fri, 30 Dec 2011 09:25:49 +0000
>
> Your question #180689 on rohc changed:
> https://answers.launchpad.net/rohc/+question/180689
>
> Didier Barvaux posted a new comment:
> Hello,
>
> Any news on this? Do you encounter some difficulties creating the patch?
>
> Regards,
> Didier
>
> --
> You received this question notification because you asked the question.

Launchpad Janitor (janitor) said : #16

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Re-open the question and link it with bug #813128.

Can you help with this problem?

Provide an answer of your own, or ask qingbaibai for more information if necessary.

To post a message you must log in.