Compiling files that include /usr/include/linux/tcp.h gives errors

Bug #494254 reported by Yusuf
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

Binary package hint: linux-libc-dev

When I compile a file that includes /usr/include/linux/tcp.h, I get the following errors:
/usr/include/linux/tcp.h:72: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:72: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:73: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:73: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:74: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:74: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:75: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:75: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:76: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:76: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:77: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:77: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:78: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:78: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:79: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:79: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:80: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:80: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:81: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:81: error: a function call cannot appear in a constant-expression

The version of the linux-libc-dev package I have installed is: 2.6.31-16.52_i386
I am running Ubuntu 9.10 with the latest updates.

The same file compiles fine on another Ubuntu installation, having linux-libc-dev package linux-libc-dev_2.6.28-17.58.i386
and Ubuntu 9.04 with the latest updates.

Andy Whitcroft (apw)
tags: added: kernel-series-unknown
Andy Whitcroft (apw)
tags: added: karmic
removed: kernel-series-unknown
Changed in linux (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Andy Whitcroft (apw) wrote :

@Yusuf -- we have tested this here and it seems to work as expected when compiling a simple source (as below), this was using the 2.6.31-17.54 headers and gcc 4.4.1:

  #include <stdio.h>
  #include <linux/tcp.h>

  int main(int argc, char *argv[])
  {
 printf("HELLO %d\n", TCP_FLAG_CWR);
  }

Please could you include a minimal failing example and indicate the version of gcc you are using.

Changed in linux (Ubuntu):
status: Triaged → Incomplete
Revision history for this message
Yusuf (mydadani) wrote :

Andy,
I tried your suggestion and yes indeed the sample code you suggested, did compile and link cleanly when I used cc, however, the same file when compiled with g++, gave the same errors that I had first reported.
The version of g++ that I am running is: 4:4.4.1-1ubuntu2
Thanks,
- Yusuf

Revision history for this message
kappen (kappen) wrote :

use #include <netinet/tcp.h> instead of linux/tcp and the problem is no more =)

Revision history for this message
Yusuf (mydadani) wrote : Re: [Bug 494254] Re: Compiling files that include /usr/include/linux/tcp.h gives errors

Thanks,
 Mohammad Yusuf Dadani

________________________________
From: kappen <email address hidden>
To: <email address hidden>
Sent: Tue, April 6, 2010 2:56:54 AM
Subject: [Bug 494254] Re: Compiling files that include /usr/include/linux/tcp.h gives errors

use #include <netinet/tcp.h> instead of linux/tcp and the problem is no
more =)

--
Compiling files that include /usr/include/linux/tcp.h gives errors
https://bugs.launchpad.net/bugs/494254
You received this bug notification because you are a direct subscriber
of the bug.

Status in “linux” package in Ubuntu: Incomplete

Bug description:
Binary package hint: linux-libc-dev

When I compile a file that includes /usr/include/linux/tcp.h, I get the following errors:
/usr/include/linux/tcp.h:72: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:72: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:73: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:73: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:74: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:74: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:75: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:75: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:76: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:76: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:77: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:77: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:78: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:78: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:79: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:79: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:80: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:80: error: a function call cannot appear in a constant-expression
/usr/include/linux/tcp.h:81: error: ‘__u32 __fswab32(__u32)’ cannot appear in a constant-expression
/usr/include/linux/tcp.h:81: error: a function call cannot appear in a constant-expression

The version of the linux-libc-dev package I have installed is: 2.6.31-16.52_i386
I am running Ubuntu 9.10 with the latest updates.

The same file compiles fine on another Ubuntu installation, having linux-libc-dev package linux-libc-dev_2.6.28-17.58.i386
and Ubuntu 9.04 with the latest updates.

To unsubscribe from this bug, go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/494254/+subscribe

Revision history for this message
Jeremy Foshee (jeremyfoshee) wrote :

This bug report was marked as Incomplete and has not had any updated comments for quite some time. As a result this bug is being closed. Please reopen if this is still an issue in the current Ubuntu release http://www.ubuntu.com/getubuntu/download . Also, please be sure to provide any requested information that may have been missing. To reopen the bug, click on the current status under the Status column and change the status back to "New". Thanks.

[This is an automated message. Apologies if it has reached you inappropriately; please just reply to this message indicating so.]

tags: added: kj-expired
Changed in linux (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Leonid Evdokimov (darkk) wrote :

You can also do s/__cpu_to_be32/__constant_cpu_to_be32/ in <linux/tcp.h> to avoid this problem.

Leonid Evdokimov (darkk)
Changed in linux (Ubuntu):
status: Expired → New
Revision history for this message
Jeremy Foshee (jeremyfoshee) wrote :

Leonid,
   Please do not reopen closed state bugs unless you are the original reporter.

Thanks!

~JFo

Changed in linux (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.