Coder Social home page Coder Social logo

Comments (22)

Rawa avatar Rawa commented on May 14, 2024 1

I managed to compile it.

First set the package version and name in linux/bfd.c

#define PACKAGE 1
#define PACKAGE_VERSION 1

This is done to please the bfd.c change, as explained in the Stackoverflow thread.

Then i added libraries dl and z and also libiberty.a as flags to ARCH_LDFLAGS, since these are the libraries bfd are unable to find.
line 40-42:

ARCH_LDFLAGS := -lpthread -L/usr/local/include -L/usr/include \
                 -lunwind-ptrace -lunwind-generic -lbfd -lopcodes -lrt \
                 -ldl -lz /usr/lib64/libiberty.a

from honggfuzz.

robertswiecki avatar robertswiecki commented on May 14, 2024

Unfortunately I don't have access to Arch Linux. If you find a way to by-pass that by some reasomably small patch, feel free to submit a pull request.

from honggfuzz.

robertswiecki avatar robertswiecki commented on May 14, 2024

With 876a74c I changed some *.h guard macros. This might or might not aleviate the problem on Arch Linux (some guard macro names are reserved for libc). Feel free to try it.

from honggfuzz.

anestisb avatar anestisb commented on May 14, 2024

Just to let you know that Makefile is configured to preserve possible environment defined CFLAGS / LDFLAGS. Thus using something like the following can incorporate previous changes without requiring to edit the source source (and maintain distro specific hack-arounds).

CFLAGS='-DPACKAGE="honggfuzz" -DPACKAGE_VERSION="beta"' LDFLAGS='-ldl -lz /usr/lib64/libiberty.a' make -B

from honggfuzz.

Edholm avatar Edholm commented on May 14, 2024

The fix supplied by @Rawa works on ArchLinux but will make Ubuntu unable to compile...

Here is a patch of the above fix for Arch.
archfix.txt

from honggfuzz.

Rawa avatar Rawa commented on May 14, 2024

@anestisb Yeah, that looks way better. However, i'm unable to get it to work. The problem seems to be with the import of /usr/lib64/libiberty.a, seems like it is included too early? Adding it in the end of LDFLAGS causes no issues at all.

from honggfuzz.

robertswiecki avatar robertswiecki commented on May 14, 2024

Thanks for the patch, but I'm nor sure why we should statically compile in libiberty. The honggfuzz code doesn't use it directly, and if libbfd depends on it, the static linker would add appropriate NEEDED flags to the elf header.

If you'd like, I'd suggest debugging it a bit more, i.e. whether your libbfd requires anything besides, and if so, why it doesn't indiacte that in its ELF header.

E.g. mine correctly marks as NEEDED what it needs:

$ ldd /usr/lib/libbfd-2.24-system.so
linux-vdso.so.1 => (0x00007ffcc7f58000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd1cde43000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd1cdc2a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd1cd864000)
/lib64/ld-linux-x86-64.so.2 (0x0000558880953000)

from honggfuzz.

robertswiecki avatar robertswiecki commented on May 14, 2024

I added those PACKAGE definitions though, as they clearly help with compiling it under Arch - 1cd09ae

from honggfuzz.

Edholm avatar Edholm commented on May 14, 2024

The same command for me gives:

$ ldd /usr/lib/libbfd-2.25.1.so 
linux-vdso.so.1 (0x00007ffda6240000)
libz.so.1 => /usr/lib/libz.so.1 (0x00007fd756317000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fd756113000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007fd755d6f000)
/usr/lib64/ld-linux-x86-64.so.2 (0x000055f8b61d0000)

Which is more or less the same...

from honggfuzz.

robertswiecki avatar robertswiecki commented on May 14, 2024

Can you post your compilation output without using -lz and without adding static libiberty lib?

from honggfuzz.

Rawa avatar Rawa commented on May 14, 2024

The output when adding -lz and -ldl flags but not statically linking libiberty is as follows:

cc -c -D_GNU_SOURCE -Wall -Werror -Wframe-larger-than=51200 -std=c11 -I. -I/usr/local/include -I/usr/include -Wextra -Wno-initializer-overrides -Wno-override-init -Wno-unknown-warning-option -funroll-loops -O2 -D_FILE_OFFSET_BITS=64 -msse4.2 -D_HF_ARCH_LINUX -o honggfuzz.o honggfuzz.c
cc -c -D_GNU_SOURCE -Wall -Werror -Wframe-larger-than=51200 -std=c11 -I. -I/usr/local/include -I/usr/include -Wextra -Wno-initializer-overrides -Wno-override-init -Wno-unknown-warning-option -funroll-loops -O2 -D_FILE_OFFSET_BITS=64 -msse4.2 -D_HF_ARCH_LINUX -o cmdline.o cmdline.c
cc -c -D_GNU_SOURCE -Wall -Werror -Wframe-larger-than=51200 -std=c11 -I. -I/usr/local/include -I/usr/include -Wextra -Wno-initializer-overrides -Wno-override-init -Wno-unknown-warning-option -funroll-loops -O2 -D_FILE_OFFSET_BITS=64 -msse4.2 -D_HF_ARCH_LINUX -o display.o display.c
cc -c -D_GNU_SOURCE -Wall -Werror -Wframe-larger-than=51200 -std=c11 -I. -I/usr/local/include -I/usr/include -Wextra -Wno-initializer-overrides -Wno-override-init -Wno-unknown-warning-option -funroll-loops -O2 -D_FILE_OFFSET_BITS=64 -msse4.2 -D_HF_ARCH_LINUX -o log.o log.c
cc -c -D_GNU_SOURCE -Wall -Werror -Wframe-larger-than=51200 -std=c11 -I. -I/usr/local/include -I/usr/include -Wextra -Wno-initializer-overrides -Wno-override-init -Wno-unknown-warning-option -funroll-loops -O2 -D_FILE_OFFSET_BITS=64 -msse4.2 -D_HF_ARCH_LINUX -o files.o files.c
cc -c -D_GNU_SOURCE -Wall -Werror -Wframe-larger-than=51200 -std=c11 -I. -I/usr/local/include -I/usr/include -Wextra -Wno-initializer-overrides -Wno-override-init -Wno-unknown-warning-option -funroll-loops -O2 -D_FILE_OFFSET_BITS=64 -msse4.2 -D_HF_ARCH_LINUX -o fuzz.o fuzz.c
cc -c -D_GNU_SOURCE -Wall -Werror -Wframe-larger-than=51200 -std=c11 -I. -I/usr/local/include -I/usr/include -Wextra -Wno-initializer-overrides -Wno-override-init -Wno-unknown-warning-option -funroll-loops -O2 -D_FILE_OFFSET_BITS=64 -msse4.2 -D_HF_ARCH_LINUX -o report.o report.c
cc -c -D_GNU_SOURCE -Wall -Werror -Wframe-larger-than=51200 -std=c11 -I. -I/usr/local/include -I/usr/include -Wextra -Wno-initializer-overrides -Wno-override-init -Wno-unknown-warning-option -funroll-loops -O2 -D_FILE_OFFSET_BITS=64 -msse4.2 -D_HF_ARCH_LINUX -o mangle.o mangle.c
cc -c -D_GNU_SOURCE -Wall -Werror -Wframe-larger-than=51200 -std=c11 -I. -I/usr/local/include -I/usr/include -Wextra -Wno-initializer-overrides -Wno-override-init -Wno-unknown-warning-option -funroll-loops -O2 -D_FILE_OFFSET_BITS=64 -msse4.2 -D_HF_ARCH_LINUX -o util.o util.c
cc -c -D_GNU_SOURCE -Wall -Werror -Wframe-larger-than=51200 -std=c11 -I. -I/usr/local/include -I/usr/include -Wextra -Wno-initializer-overrides -Wno-override-init -Wno-unknown-warning-option -funroll-loops -O2 -D_FILE_OFFSET_BITS=64 -msse4.2 -D_HF_ARCH_LINUX -o linux/ptrace_utils.o linux/ptrace_utils.c
cc -c -D_GNU_SOURCE -Wall -Werror -Wframe-larger-than=51200 -std=c11 -I. -I/usr/local/include -I/usr/include -Wextra -Wno-initializer-overrides -Wno-override-init -Wno-unknown-warning-option -funroll-loops -O2 -D_FILE_OFFSET_BITS=64 -msse4.2 -D_HF_ARCH_LINUX -o linux/sancov.o linux/sancov.c
cc -c -D_GNU_SOURCE -Wall -Werror -Wframe-larger-than=51200 -std=c11 -I. -I/usr/local/include -I/usr/include -Wextra -Wno-initializer-overrides -Wno-override-init -Wno-unknown-warning-option -funroll-loops -O2 -D_FILE_OFFSET_BITS=64 -msse4.2 -D_HF_ARCH_LINUX -o linux/perf.o linux/perf.c
cc -c -D_GNU_SOURCE -Wall -Werror -Wframe-larger-than=51200 -std=c11 -I. -I/usr/local/include -I/usr/include -Wextra -Wno-initializer-overrides -Wno-override-init -Wno-unknown-warning-option -funroll-loops -O2 -D_FILE_OFFSET_BITS=64 -msse4.2 -D_HF_ARCH_LINUX -o linux/unwind.o linux/unwind.c
cc -c -D_GNU_SOURCE -Wall -Werror -Wframe-larger-than=51200 -std=c11 -I. -I/usr/local/include -I/usr/include -Wextra -Wno-initializer-overrides -Wno-override-init -Wno-unknown-warning-option -funroll-loops -O2 -D_FILE_OFFSET_BITS=64 -msse4.2 -D_HF_ARCH_LINUX -o linux/pt.o linux/pt.c
cc -c -D_GNU_SOURCE -Wall -Werror -Wframe-larger-than=51200 -std=c11 -I. -I/usr/local/include -I/usr/include -Wextra -Wno-initializer-overrides -Wno-override-init -Wno-unknown-warning-option -funroll-loops -O2 -D_FILE_OFFSET_BITS=64 -msse4.2 -D_HF_ARCH_LINUX -o linux/bfd.o linux/bfd.c
cc -c -D_GNU_SOURCE -Wall -Werror -Wframe-larger-than=51200 -std=c11 -I. -I/usr/local/include -I/usr/include -Wextra -Wno-initializer-overrides -Wno-override-init -Wno-unknown-warning-option -funroll-loops -O2 -D_FILE_OFFSET_BITS=64 -msse4.2 -D_HF_ARCH_LINUX -o linux/arch.o linux/arch.c
cc -o honggfuzz honggfuzz.o cmdline.o display.o log.o files.o fuzz.o report.o mangle.o util.o linux/ptrace_utils.o linux/sancov.o linux/perf.o linux/unwind.o linux/pt.o linux/bfd.o linux/arch.o -lm -lpthread -L/usr/local/include -L/usr/include -lunwind-ptrace -lunwind-generic -lbfd -lopcodes -lrt -lz -ldl
/usr/bin/ld: copy reloc against protected `_UPT_accessors' is dangerous
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archures.o): In function `bfd_default_scan':
(.text+0xf9): undefined reference to `_sch_istable'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(bfd.o): In function `bfd_errmsg':
(.text+0x140): undefined reference to `xstrerror'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(bfd.o): In function `bfd_demangle':
(.text+0x105c): undefined reference to `cplus_demangle'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(bfd.o): In function `bfd_demangle':
(.text+0x11c7): undefined reference to `cplus_demangle'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(opncls.o): In function `_bfd_delete_bfd':
(.text+0x14f): undefined reference to `objalloc_free'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(opncls.o): In function `find_separate_debug_file':
(.text+0x3a5): undefined reference to `lrealpath'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(opncls.o): In function `_bfd_new_bfd':
(.text+0x617): undefined reference to `objalloc_create'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(opncls.o): In function `_bfd_free_cached_info':
(.text+0x73f): undefined reference to `objalloc_free'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(opncls.o): In function `bfd_fopen':
(.text+0x7fc): undefined reference to `xstrdup'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(opncls.o): In function `bfd_openstreamr':
(.text+0x9e8): undefined reference to `xstrdup'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(opncls.o): In function `bfd_openw':
(.text+0xa7b): undefined reference to `xstrdup'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(opncls.o): In function `bfd_create':
(.text+0xcbb): undefined reference to `xstrdup'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(opncls.o): In function `bfd_alloc':
(.text+0xeba): undefined reference to `_objalloc_alloc'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(opncls.o): In function `bfd_openr_iovec':
(.text+0xfe9): undefined reference to `xstrdup'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(opncls.o): In function `bfd_create_gnu_debuglink_section':
(.text+0x13e5): undefined reference to `lbasename'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(opncls.o): In function `bfd_fill_in_gnu_debuglink_section':
(.text+0x1507): undefined reference to `lbasename'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(opncls.o): In function `bfd_release':
(.text+0x10e8): undefined reference to `objalloc_free_block'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(syms.o): In function `bfd_decode_symclass':
(.text+0x2fc): undefined reference to `_sch_toupper'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(syms.o): In function `_bfd_stab_section_find_nearest_line':
(.text+0x6ce): undefined reference to `filename_ncmp'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(syms.o): In function `_bfd_stab_section_find_nearest_line':
(.text+0xbdd): undefined reference to `filename_cmp'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(hash.o): In function `bfd_hash_table_free':
(.text+0x9): undefined reference to `objalloc_free'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(hash.o): In function `bfd_hash_table_init_n':
(.text+0x3f): undefined reference to `objalloc_create'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(hash.o): In function `bfd_hash_table_init_n':
(.text+0xd1): undefined reference to `_objalloc_alloc'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(hash.o): In function `bfd_hash_insert':
(.text+0x21f): undefined reference to `_objalloc_alloc'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(hash.o): In function `bfd_hash_lookup':
(.text+0x402): undefined reference to `_objalloc_alloc'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(hash.o): In function `bfd_hash_allocate':
(.text+0x5ff): undefined reference to `_objalloc_alloc'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(srec.o): In function `srec_mkobject':
(.text+0x5cb): undefined reference to `hex_init'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(srec.o): In function `srec_get_section_contents':
(.text+0x832): undefined reference to `_hex_value'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(srec.o): In function `srec_bad_byte':
(.text+0xee6): undefined reference to `_sch_istable'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(srec.o): In function `srec_scan':
(.text+0x110d): undefined reference to `_hex_value'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(srec.o): In function `srec_scan':
(.text+0x1297): undefined reference to `_hex_value'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(srec.o): In function `srec_scan':
(.text+0x13a1): undefined reference to `_sch_istable'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(srec.o): In function `srec_object_p':
(.text+0x19bf): undefined reference to `_hex_value'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(srec.o): In function `srec_object_p':
(.text+0x1a4b): undefined reference to `hex_init'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(srec.o): In function `symbolsrec_object_p':
(.text+0x1b53): undefined reference to `hex_init'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(binary.o): In function `mangle_name':
(.text+0xa7): undefined reference to `_sch_istable'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(tekhex.o): In function `getvalue':
(.text+0x6): undefined reference to `_hex_value'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(tekhex.o): In function `getsym':
(.text+0xb6): undefined reference to `_hex_value'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(tekhex.o): In function `first_phase':
(.text+0x5d6): undefined reference to `_hex_value'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(tekhex.o): In function `tekhex_init.part.2':
(.text+0xbbf): undefined reference to `hex_init'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(tekhex.o): In function `pass_over.constprop.4':
(.text+0x1017): undefined reference to `_hex_value'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(tekhex.o): In function `tekhex_object_p':
(.text+0x111a): undefined reference to `_hex_value'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(ihex.o): In function `ihex_bad_byte':
(.text+0x666): undefined reference to `_sch_istable'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(ihex.o): In function `ihex_object_p':
(.text+0x7d1): undefined reference to `_hex_value'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(ihex.o): In function `ihex_object_p':
(.text+0x993): undefined reference to `hex_init'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(ihex.o): In function `ihex_get_section_contents':
(.text+0x11f9): undefined reference to `_hex_value'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(compress.o): In function `bfd_is_section_compressed':
(.text+0x552): undefined reference to `_sch_istable'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(verilog.o): In function `verilog_mkobject':
(.text+0x19b): undefined reference to `hex_init'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf64-x86-64.o): In function `elf_x86_64_finish_dynamic_sections':
(.text+0xa31): undefined reference to `htab_traverse'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf64-x86-64.o): In function `elf_x86_64_size_dynamic_sections':
(.text+0x202e): undefined reference to `htab_traverse'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf64-x86-64.o): In function `elf_x86_64_link_hash_table_free':
(.text+0x325d): undefined reference to `htab_delete'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf64-x86-64.o): In function `elf_x86_64_link_hash_table_free':
(.text+0x326e): undefined reference to `objalloc_free'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf64-x86-64.o): In function `elf_x86_64_link_hash_table_create':
(.text+0x3334): undefined reference to `htab_try_create'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf64-x86-64.o): In function `elf_x86_64_link_hash_table_create':
(.text+0x3340): undefined reference to `objalloc_create'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf64-x86-64.o): In function `elf_x86_64_get_local_sym_hash.isra.5':
(.text+0x38c0): undefined reference to `htab_find_slot_with_hash'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf64-x86-64.o): In function `elf_x86_64_get_local_sym_hash.isra.5':
(.text+0x3996): undefined reference to `_objalloc_alloc'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf64.o): In function `_bfd_elf64_bfd_from_remote_memory':
(.text+0x27f8): undefined reference to `xstrdup'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elflink.o): In function `bfd_elf_link_add_symbols':
(.text+0xa4cc): undefined reference to `objalloc_free_block'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elflink.o): In function `bfd_elf_link_add_symbols':
(.text+0xab8f): undefined reference to `_sch_istable'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elflink.o): In function `bfd_elf_size_dynamic_sections':
(.text+0xbd6c): undefined reference to `lbasename'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elflink.o): In function `bfd_elf_size_dynamic_sections':
(.text+0xc553): undefined reference to `lbasename'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf-eh-frame.o): In function `_bfd_elf_discard_section_eh_frame':
(.text+0x1eb9): undefined reference to `iterative_hash'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf-eh-frame.o): In function `_bfd_elf_discard_section_eh_frame':
(.text+0x1ec9): undefined reference to `iterative_hash'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf-eh-frame.o): In function `_bfd_elf_discard_section_eh_frame':
(.text+0x1ef3): undefined reference to `iterative_hash'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf-eh-frame.o): In function `_bfd_elf_discard_section_eh_frame':
(.text+0x1f03): undefined reference to `iterative_hash'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf-eh-frame.o): In function `_bfd_elf_discard_section_eh_frame':
(.text+0x1f13): undefined reference to `iterative_hash'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf-eh-frame.o):(.text+0x1f23): more undefined references to `iterative_hash' follow
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf-eh-frame.o): In function `_bfd_elf_discard_section_eh_frame':
(.text+0x1fea): undefined reference to `htab_find_slot_with_hash'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf-eh-frame.o): In function `_bfd_elf_discard_section_eh_frame':
(.text+0x22be): undefined reference to `htab_try_create'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf-eh-frame.o): In function `_bfd_elf_discard_section_eh_frame_hdr':
(.text+0x235a): undefined reference to `htab_delete'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf32-i386.o): In function `elf_i386_finish_dynamic_sections':
(.text+0xc4c): undefined reference to `htab_traverse'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf32-i386.o): In function `elf_i386_size_dynamic_sections':
(.text+0x21e2): undefined reference to `htab_traverse'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf32-i386.o): In function `elf_i386_link_hash_table_free':
(.text+0x31bd): undefined reference to `htab_delete'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf32-i386.o): In function `elf_i386_link_hash_table_free':
(.text+0x31ce): undefined reference to `objalloc_free'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf32-i386.o): In function `elf_i386_link_hash_table_create':
(.text+0x3236): undefined reference to `htab_try_create'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf32-i386.o): In function `elf_i386_link_hash_table_create':
(.text+0x3242): undefined reference to `objalloc_create'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf32-i386.o): In function `elf_i386_get_local_sym_hash.isra.4':
(.text+0x341a): undefined reference to `htab_find_slot_with_hash'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf32-i386.o): In function `elf_i386_get_local_sym_hash.isra.4':
(.text+0x34ee): undefined reference to `_objalloc_alloc'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(elf32.o): In function `_bfd_elf32_bfd_from_remote_memory':
(.text+0x283e): undefined reference to `xstrdup'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(aout32.o): In function `aout_32_final_link':
(.text+0x6f56): undefined reference to `_sch_istable'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(cofflink.o): In function `coff_link_add_object_symbols':
(.text+0xac7): undefined reference to `_sch_istable'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(pei-x86_64.o): In function `pex64_bfd_print_pdata_section':
(.text+0x1abd): undefined reference to `xmalloc'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(plugin.o): In function `bfd_plugin_object_p':
(.text+0x581): undefined reference to `concat'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(plugin.o): In function `bfd_plugin_object_p':
(.text+0x59a): undefined reference to `make_relative_prefix'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(plugin.o): In function `bfd_plugin_object_p':
(.text+0x5f0): undefined reference to `concat'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `adjust_relative_path':
(.text+0x1e5): undefined reference to `getpwd'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `adjust_relative_path':
(.text+0x1f2): undefined reference to `lrealpath'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `adjust_relative_path':
(.text+0x204): undefined reference to `lrealpath'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `adjust_relative_path':
(.text+0x290): undefined reference to `filename_ncmp'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_look_for_bfd_in_cache':
(.text+0x77c): undefined reference to `htab_find'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_add_bfd_to_archive_cache':
(.text+0x7f6): undefined reference to `htab_find_slot'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_add_bfd_to_archive_cache':
(.text+0x844): undefined reference to `htab_create_alloc'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_generic_read_ar_hdr_mag':
(.text+0xa5e): undefined reference to `_sch_istable'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_append_relative_path':
(.text+0xc57): undefined reference to `lbasename'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_get_elt_at_filepos':
(.text+0xd63): undefined reference to `filename_cmp'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_get_elt_at_filepos':
(.text+0xd97): undefined reference to `filename_cmp'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_get_elt_at_filepos':
(.text+0xef8): undefined reference to `xstrdup'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_construct_extended_name_table':
(.text+0x1b84): undefined reference to `filename_cmp'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_construct_extended_name_table':
(.text+0x1bde): undefined reference to `lbasename'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_construct_extended_name_table':
(.text+0x1c16): undefined reference to `filename_ncmp'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_construct_extended_name_table':
(.text+0x1cf4): undefined reference to `filename_ncmp'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_construct_extended_name_table':
(.text+0x1db5): undefined reference to `filename_cmp'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_construct_extended_name_table':
(.text+0x1e5a): undefined reference to `lbasename'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_archive_bsd44_construct_extended_name_table':
(.text+0x2125): undefined reference to `lbasename'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_bsd44_write_ar_hdr':
(.text+0x2243): undefined reference to `_sch_istable'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_bsd44_write_ar_hdr':
(.text+0x2254): undefined reference to `lbasename'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `bfd_bsd_truncate_arname':
(.text+0x2442): undefined reference to `lbasename'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `bfd_dont_truncate_arname':
(.text+0x2541): undefined reference to `lbasename'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `bfd_gnu_truncate_arname':
(.text+0x25b2): undefined reference to `lbasename'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_archive_close_and_cleanup':
(.text+0x38a4): undefined reference to `htab_find_slot'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_archive_close_and_cleanup':
(.text+0x38d1): undefined reference to `htab_clear_slot'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_archive_close_and_cleanup':
(.text+0x3955): undefined reference to `htab_traverse_noresize'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(archive.o): In function `_bfd_archive_close_and_cleanup':
(.text+0x395d): undefined reference to `htab_delete'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(cache.o): In function `bfd_open_file':
(.text+0x360): undefined reference to `unlink_if_ordinary'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(corefile.o): In function `generic_core_file_matches_executable_p':
(.text+0x16f): undefined reference to `filename_cmp'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libbfd.a(stabs.o): In function `_bfd_link_section_stabs':
(.text+0x6b7): undefined reference to `_sch_istable'
collect2: error: ld returned 1 exit status
Makefile:170: recipe for target 'honggfuzz' failed
make: *** [honggfuzz] Error 1

from honggfuzz.

robertswiecki avatar robertswiecki commented on May 14, 2024

I added -Bdynamic (as per https://gcc.gnu.org/ml/gcc-help/2011-11/msg00294.html) to LDFLAGS in 00d6eca - did it help?

from honggfuzz.

robertswiecki avatar robertswiecki commented on May 14, 2024

Also, together with this - 2e06f56 - seems the order of -Bdynamic / -l is important

from honggfuzz.

Edholm avatar Edholm commented on May 14, 2024

Unfortunately that made no difference.

from honggfuzz.

robertswiecki avatar robertswiecki commented on May 14, 2024

One last suggestion, can you change

-Bdynamic

into

-Wl,-Bdynamic

in the Makefile, and give it the last try.

I don't think I will install Arch any time soon, so my remote debugging skils end here :(.

If you're interested in the subject and want to resolve it here's my opinion: Your linker is preferring static libraries to dynamic libraries on your system and it tries to compile in libbfd.a instead of linking dynamically against libbfd.so - no idea why this preference is here.

The problem arises from the fact that libbfd.a is just a collection of *.o files, but without information on what else is needed in order for libbfd.a to operate correctly. We could theoretically use pkg-config to gather this, but not all systems support pkg-config.

*.so contant DT_NEEDED sections which allow dynamic linker to gather all needed libs while runtime-linking libraries. That's why you don't need -lz and -ldl, because libbfd.so explicitly depends on them (in the ELF headers)

ld is a tricky beast, and things like order of arguments matter a lot. We call ld through gcc or clang, so some specific options to ld need to be called as -Wl,option if you want to test it.

So, please feel free to go through 'man ld' and the wisdom of the Internets trying to figure out why your ld prefers static lib vs dynamic lib and how to change that.

You can also try different ld, e.g. gold (another package installation might be required). You need then to use

-fuse-ld=gold
or
-fuse-ld=bfd

at the linking stage as an option to cc (ARCH_LDFLAGS)

If you find the right combination of options, feel free to let me know, and I'll try to add it to the Makefile.

from honggfuzz.

Edholm avatar Edholm commented on May 14, 2024

I solved it. It seems the binutils package on arch removes /usr/lib/bfd.so and the linker therefore seems to default to the .a file.

Either manually creating the symlink or modifying the PKGBUILD to not remove bfd.so makes honggfuzz compile.

Therefore the current compile issue is not related to honggfuzz. However, the#define PACKAGE is still required.

Thanks for the help @robertswiecki!

As a side-note: I added honggfuzz with a patch that makes it compile on ArchLinux to the AUR

from honggfuzz.

Edholm avatar Edholm commented on May 14, 2024

Follow up: I asked about the reasoning for this, and got the following answer:

It is not a stable interface and should not be linked against outside of
binutils. Either use the static version or link against the versioned one.

from honggfuzz.

robertswiecki avatar robertswiecki commented on May 14, 2024

Ha... good to know, thanks for checking!

from honggfuzz.

Stolas avatar Stolas commented on May 14, 2024

After trying to get this to run on OpenSuse I noticed it is working the same as Arch Linux.
I've also found the following StackExchange page: http://stackoverflow.com/questions/34952123/error-compiling-against-libopcodes

Which Linux Distros are supported? (allow to make and run?)

from honggfuzz.

robertswiecki avatar robertswiecki commented on May 14, 2024

I tested it under Ubuntu Debian and Fedora

from honggfuzz.

Stolas avatar Stolas commented on May 14, 2024

Great, thanks.

from honggfuzz.

scchess avatar scchess commented on May 14, 2024

Yes. I can double-confirm "/usr/lib64/libiberty.a" is the key.

from honggfuzz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.