adtools icon indicating copy to clipboard operation
adtools copied to clipboard

Build issue with macOS clang

Open BSzili opened this issue 6 years ago • 1 comments

I'm trying to build adtools on macOS Mojave, and this warning causes the compilation to fail:

/Users/bszili/Documents/adtools/binutils/repo/bfd/elflink.c:4975:45: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic] return (struct elf_link_hash_entry *) 0 - 1; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ /Users/bszili/Documents/adtools/binutils/repo/bfd/elflink.c:5087:46: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic] if (h == (struct elf_link_hash_entry *) 0 - 1) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ 2 errors generated.

The compiler is: Apple LLVM version 10.0.0 (clang-1000.10.44.4)

BSzili avatar Mar 29 '19 20:03 BSzili

I ran into the same thing. What's missing here is --disable-werror in the configure flags for binutils. With this, building binutils on macOS works fine.

The reason for this is that Clang has much more warnings than GCC, and binutils by default turns them into errors.

Midar avatar Apr 20 '19 11:04 Midar