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

Compile error on WSL2 Ubuntu #490

Closed
gtrab99 opened this issue May 7, 2023 · 12 comments
Closed

Compile error on WSL2 Ubuntu #490

gtrab99 opened this issue May 7, 2023 · 12 comments

Comments

@gtrab99
Copy link

gtrab99 commented May 7, 2023

Hello,

I have been able to compile honggfuzz on my system in the past without issue, but recently I tried and am getting the following errors from bfd.c:

image

Could this be a compiler compatibility issue?

@benner
Copy link

benner commented May 20, 2023

I have same issue

1 similar comment
@jinnypenny
Copy link

I have same issue

@vivi50
Copy link

vivi50 commented May 25, 2023

I have same issue, but when I reset to the previous commit f7b69ee, it compiles successfully. i think the issue may be caused by the latest commit

@douglasbagnall
Copy link
Contributor

Same issue on Ubuntu 22.04 with binutils-dev 2.38-4ubuntu2.2

As @vivi50 suggests, reverting 37e8e81 solves the issue.

In order to make this searchable, I present the error message as text:

cc -c -fuse-ld=lld  -std=c11 -I/usr/local/include -D_GNU_SOURCE -Wall -Wextra -Werror -Wno-format-truncation -Wno-override-init -I. -D_FILE_OFFSET_BITS=64 -finline-limit=4000 -D_HF_ARCH_LINUX  -o linux/bfd.o linux/bfd.c
linux/bfd.c:202:21: error: ‘enum disassembler_style’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
  202 |     void* buf, enum disassembler_style style HF_ATTR_UNUSED, const char* fmt, ...) {
      |                     ^~~~~~~~~~~~~~~~~~
linux/bfd.c:202:40: error: parameter 2 (‘style’) has incomplete type
  202 |     void* buf, enum disassembler_style style HF_ATTR_UNUSED, const char* fmt, ...) {
linux/bfd.c: In function ‘arch_bfdDisasm’:
linux/bfd.c:249:9: error: cast between incompatible function types from ‘void (*)(struct disassemble_info *, void *, int (*)(void *, const char *, ...))’ to ‘void (*)(void *, void *, void *, void *)’ [-Werror=cast-function-type]
  249 |         (void (*)(void*, void*, void*, void*))init_disassemble_info;
      |         ^

@gusti6
Copy link

gusti6 commented Aug 13, 2023

I have same issue, but when I reset to the previous commit f7b69ee, it compiles successfully. i think the issue may be caused by the latest commit

Compiled with this commit, but now when I run hongfuzz I get the following error:
honggfuzz --linux_perf_bts_edge -- /usr/bin/djpeg FILE

As above, maximize unique code blocks via Intel Processor Trace (requires libipt.so):

honggfuzz --linux_perf_ipt_block -- /usr/bin/djpeg FILE

[2023-08-13T17:16:50-0400][F][82300] main():340 Parsing of the cmd-line arguments failed

@robertswiecki
Copy link
Collaborator

robertswiecki commented Aug 14, 2023

I think WSL2 is a virtualization-based environment, the CPU performance event would have to be exported into the VM.

It's relatively easy to do it with --linux_perf_instr or --linux_perf_branch (at least qemu-kvm supportes them via Linux kernel), but BTS and IntelPT are quite complex, and unless I misunderstand WSL2 severly, they probably not handled by the Linux VMM under Windows :(

@vanhauser-thc
Copy link
Contributor

This has nothing to do with WSL2. I have this error too on a native Ubuntu and a Debian.

D_HF_ARCH_LINUX -g -ggdb -g3  -o linux/bfd.o linux/bfd.c
  linux/bfd.c:202:21: error: ‘enum disassembler_style’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
    202 |     void* buf, enum disassembler_style style HF_ATTR_UNUSED, const char* fmt, ...) {
        |                     ^~~~~~~~~~~~~~~~~~
  linux/bfd.c:202:40: error: parameter 2 (‘style’) has incomplete type
    202 |     void* buf, enum disassembler_style style HF_ATTR_UNUSED, const char* fmt, ...) {
  linux/bfd.c: In function ‘arch_bfdDisasm’:
  linux/bfd.c:249:9: error: cast between incompatible function types from ‘void (*)(struct disassemble_info *, void *, int (*)(void *, const char *, ...))’ to ‘void (*)(void *, void *, void *, void *)’ [-Werror=cast-function-type]
    249 |         (void (*)(void*, void*, void*, void*))init_disassemble_info;
        |         ^
  In file included from ./libhfcommon/util.h:28,
                   from ./honggfuzz.h:39,
                   from ./sanitizers.h:26,
                   from ./linux/unwind.h:27,
                   from ./linux/bfd.h:32,
                   from linux/bfd.c:26:
  linux/bfd.c: In function ‘arch_bfdFPrintFStyled’:
  linux/bfd.c:204:5: error: ‘va_start’ used in function with fixed args
    204 |     va_start(args, fmt);
        |     ^~~~~~~~
  cc1: all warnings being treated as errors

@robertswiecki
Copy link
Collaborator

This should help the situation a bit (undefined enum disassembler_style)

c0522ed

As for the cast between incompatible function types, I'm not sure how to do it for now. I was thinking that casting from any pointer to void* is ok, but apparently not.

@robertswiecki
Copy link
Collaborator

robertswiecki commented Oct 2, 2023

And this ad389c4 will maybe help with function conversions.

@vanhauser-thc
Copy link
Contributor

Hi Robert,

I still get:

linux/bfd.c: In function ‘arch_bfdDisasm’:
linux/bfd.c:257:9: error: cast between incompatible function types from ‘void (*)(struct disassemble_info *, void *, int (*)(void *, const char *, ...))’ to ‘void (*)(void *, void *, void *, void *)’ [-Werror=cast-function-type]
  257 |         (void (*)(void*, void*, void*, void*))init_disassemble_info;
      |         ^
cc1: all warnings being treated as errors
make: *** [Makefile:279: linux/bfd.o] Error 1

this is on a Ubuntu 20.04.6 LTS

@robertswiecki
Copy link
Collaborator

What about this? 4c85173

@vanhauser-thc
Copy link
Contributor

this fixes it for me :)

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

8 participants