Skip to contentSkip to conversation

Compile error with unsigned integers

DISCUSSION Anmol Panda 3 participants 3 messages Nov 28, 2017

lore
Share & tools
lore
#0 lore raw

Dear all,

We are trying to compile the xdp programs in the /tests folder of
p4c-xdp. On compiling from .c to .o using clang:
clang -O2 -S -Wall -target bpf -c xdp1-mod.c -o xdp1-mod.o

the following errors are reported:

In file included from xdp1-mod.c:3:
./xdp1-mod.h:16:5: error: unknown type name 'u32'

    u32 input_port; /* bit<32> */
    ^
./xdp1-mod.h:21:5: error: unknown type name 'u32'
    u32 output_port; /* bit<32> */
    ^
./xdp1-mod.h:25:5: error: unknown type name 'u64'
    u64 destination; /* bit<48> */
    ^
./xdp1-mod.h:26:5: error: unknown type name 'u64'
    u64 source; /* bit<48> */
    ^
./xdp1-mod.h:27:5: error: unknown type name 'u16'
    u16 etherType; /* bit<16> */
    ^

It reports 20 such errors and exits. We weren't getting such errors
before when we successfully compiled and ran the test programs and even some programs that we had written. After browsing for this error, we tried including <stdint.h> and <linux/types.h>, but the error persists.

The libstdc++ version is 7.2.0, llvm version is 6.0.0svn. Please
guide us how we may resolve this issue. We are utmost grateful for your help and time.

Awaiting your response,
Sincerely,

#1 lore raw

[ + William ]

Quoted 4 lines · Anmol Panda

Dear all,

    We are trying to compile the xdp programs in the /tests folder of p4c-xdp. On compiling from .c to .o using clang:
clang -O2 -S -Wall -target bpf -c xdp1-mod.c -o xdp1-mod.o

Looks like you are double posting these issues within few hours even (!?) ...

https://github.com/vmware/p4c-xdp/issues/59

... p4c-xdp project is the more appropriate place to ask since it's most likely related to the project itself.

Quoted 24 lines

the following errors are reported:

In file included from xdp1-mod.c:3:
./xdp1-mod.h:16:5: error: unknown type name 'u32'
    u32 input_port; /* bit<32> */
    ^
./xdp1-mod.h:21:5: error: unknown type name 'u32'
    u32 output_port; /* bit<32> */
    ^
./xdp1-mod.h:25:5: error: unknown type name 'u64'
    u64 destination; /* bit<48> */
    ^
./xdp1-mod.h:26:5: error: unknown type name 'u64'
    u64 source; /* bit<48> */
    ^
./xdp1-mod.h:27:5: error: unknown type name 'u16'
    u16 etherType; /* bit<16> */
    ^
   It reports 20 such errors and exits. We weren't getting such errors before when we successfully compiled and ran the test programs and even some programs that we had written. After browsing for this error, we tried including <stdint.h> and <linux/types.h>, but the error persists.

   The libstdc++ version is 7.2.0, llvm version is 6.0.0svn. Please guide us how we may resolve this issue. We are utmost grateful for your help and time.

Awaiting your response,
Sincerely,

#2 lore raw
Quoted 8 lines · Daniel Borkmann

[ + William ]

Quoted 4 lines · Anmol Panda

Dear all,

We are trying to compile the xdp programs in the /tests folder of p4c-xdp. On compiling from .c to .o using clang:
clang -O2 -S -Wall -target bpf -c xdp1-mod.c -o xdp1-mod.o

Quoted 33 lines

Looks like you are double posting these issues within few hours even (!?) ...

https://github.com/vmware/p4c-xdp/issues/59

... p4c-xdp project is the more appropriate place to ask since it's most likely related to the project itself.

Quoted 24 lines

the following errors are reported:

In file included from xdp1-mod.c:3:
./xdp1-mod.h:16:5: error: unknown type name 'u32'

    u32 input_port; /* bit<32> */
    ^
./xdp1-mod.h:21:5: error: unknown type name 'u32'
    u32 output_port; /* bit<32> */
    ^
./xdp1-mod.h:25:5: error: unknown type name 'u64'
    u64 destination; /* bit<48> */
    ^
./xdp1-mod.h:26:5: error: unknown type name 'u64'
    u64 source; /* bit<48> */
    ^
./xdp1-mod.h:27:5: error: unknown type name 'u16'
    u16 etherType; /* bit<16> */
    ^

It reports 20 such errors and exits. We weren't getting such errors before when we successfully compiled and ran the test programs and even some programs that we had written. After browsing for this error, we tried including <stdint.h> and <linux/types.h>, but the error persists.

The libstdc++ version is 7.2.0, llvm version is 6.0.0svn. Please guide us how we may resolve this issue. We are utmost grateful for your help and time.

Awaiting your response,
Sincerely,

Hi,

Since it's p4c-xdp project related, let's discuss in github issue page. And thanks Daniel for forwarding.

William