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

Compilation failure on i386 #38

Open
PinoTsao opened this issue May 1, 2020 · 5 comments
Open

Compilation failure on i386 #38

PinoTsao opened this issue May 1, 2020 · 5 comments

Comments

@PinoTsao
Copy link

PinoTsao commented May 1, 2020

make in gtests/net/packetdrill complains:

run_system_call.c: In function ‘cmsg_expect_eq’:
run_system_call.c:860:38: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘size_t’ {aka ‘unsigned int’} [-Werror=format=]
"Bad len in cmsg %d: expected=%lu actual=%lu",
~~^
%u
i, ecm->cmsg_len, acm->cmsg_len);
~~~~~~~~~~~~~
run_system_call.c:860:49: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘size_t’ {aka ‘unsigned int’} [-Werror=format=]
"Bad len in cmsg %d: expected=%lu actual=%lu",
~~^
%u
i, ecm->cmsg_len, acm->cmsg_len);
~~~~~~~~~~~~~
run_system_call.c: In function ‘get_epoll_event_from_expr’:
run_system_call.c:2924:21: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
event->data.ptr = (void *)epollev_expr->ptr->value.num;
^
run_system_call.c: In function ‘syscall_epoll_wait’:
run_system_call.c:3129:6: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]
"epoll_event->data does not match script: "
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
run_system_call.c:3132:6:
event_script.data.u64,
~~~~~~~~~~~~~~~~~~~~~
run_system_call.c:3130:19: note: format string is defined here
"expected: %lu "
~~^
%llu
run_system_call.c:3129:6: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]
"epoll_event->data does not match script: "
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
run_system_call.c:3133:6:
event_live->data.u64);
~~~~~~~~~~~~~~~~~~~~
run_system_call.c:3131:17: note: format string is defined here
"actual: %lu\n",
~~^
%llu
run_system_call.c: In function ‘syscall_splice’:
run_system_call.c:3249:31: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
result = splice(fd_in_live, (loff_t *) off_in, fd_out_live,
^
run_system_call.c:3250:5: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
(loff_t *) off_out, len, flags);
^
cc1: all warnings being treated as errors
make: *** [: run_system_call.o] Error 1

@nealcardwell
Copy link
Collaborator

Thanks for the report. Can you please provide some more information, so that we can reproduce this issue and verify the fix?

What OS platform, distribution/release, and compiler version is this?

The platform should be accessible with:
uname -r

The distribution version you can often get with something like:
lsb_release -d
or:
hostnamectl

The compiler version should be accessible with something like:
gcc --version

For example:

Linux, Debian 9, compiler version:
$ gcc --version
=> gcc (Debian 9.2.1-28) 9.2.1 20200203

Thanks!

@PinoTsao
Copy link
Author

PinoTsao commented May 4, 2020

$ hostnamectl
Static hostname: DB10VMi386
Icon name: computer-vm
Chassis: vm
Machine ID: 889ae9bf38344d3aa6f8359510337dfc
Boot ID: 229926988b2f4930b872c1e132422d17
Virtualization: kvm
Operating System: Debian GNU/Linux 10 (buster)
Kernel: Linux 4.19.0-8-686
Architecture: x86

$ gcc --version
gcc (Debian 8.3.0-6) 8.3.0

@nealcardwell
Copy link
Collaborator

Hi,

When I use that compiler on Debian 10 to compile the Google packetdrill repo at https://github.com/google/packetdrill at SHA1 a700d17 I do not see any warnings or errors.

Can you please provide the URL of the packetdrill repo you are using, as well as the SHA1 of the exact commit at which you are compiling?

I will only be able to help if you are using the repo at https://github.com/google/packetdrill at the HEAD for that repo (SHA1 a700d17). If you are using some other packetdrill fork then you'll need to contact the author of that fork.

Thanks!
neal

@PinoTsao
Copy link
Author

PinoTsao commented May 7, 2020

Hi Neal,

Do you test on i386 Debian 10? I think this issue should be exist in every i386 platform. BTW, I do use the same repo and commit as you mentioned.

@PinoTsao
Copy link
Author

some errors are easy for outsider, such as paring "%zu" to size_t variable, like:

run_system_call.c: In function ‘cmsg_expect_eq’:
run_system_call.c:860:38: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘size_t {aka unsigned int}’ [-Werror=format=]
      "Bad len in cmsg %d: expected=%lu actual=%lu",

But,this one:

run_system_call.c: In function ‘get_epoll_event_from_expr’:
run_system_call.c:2924:21: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
   event->data.ptr = (void *)epollev_expr->ptr->value.num;

epollev_expr->ptr->value.num is of type s64, convert to 32-bit pointer make gcc complains, and this is not easy for outsiders

rli9 pushed a commit to intel/lkp-tests that referenced this issue May 18, 2020
compilation on i386 complains 2 kinds of error:
----
run_system_call.c: In function ‘cmsg_expect_eq’:
run_system_call.c:860:38: error: format ‘%lu’ expects argument of type
‘long unsigned int’, but argument 4 has type ‘size_t {aka unsigned int}’
[-Werror=format=]
      "Bad len in cmsg %d: expected=%lu actual=%lu",
...
run_system_call.c: In function ‘get_epoll_event_from_expr’:
run_system_call.c:2924:21: error: cast to pointer from integer of
different size [-Werror=int-to-pointer-cast]
   event->data.ptr = (void *)epollev_expr->ptr->value.num;
....
----

The 1st error is easy, paring "%zu" with "size_t" would fix; but 2nd one
is not easy for outsides, it should be taken care by packetdrill itself.
Have reported the issue: google/packetdrill#38.

When packetdrill fix compilation on i386, this patch could be reverted.

Signed-off-by: Cao jin <jinx.cao@intel.com>
Signed-off-by: Philip Li <philip.li@intel.com>
dcaratti pushed a commit to dcaratti/packetdrill that referenced this issue Feb 16, 2021
mptcp: add a new 'syscalls' subcategory
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