Failed to build ksim-stub@sha/avx-builder.c.o
nanley opened this issue · 5 comments
I get the following error attempting to build ksim on Arch Linux:
$ ninja -C build/
ninja: Entering directory `build/'
[3/19] Compiling c object 'ksim-stub@sha/avx-builder.c.o'
FAILED: ksim-stub@sha/avx-builder.c.o
ccache cc '-Iksim-stub@sha' '-fdiagnostics-color=always' '-I..' '-I.' '-pipe' '-Wall' '-Winvalid-pch' '-fvisibility=hidden' '-Wall' '-march=native' '-mrtm' '-D_GNU_SOURCE' '-O0' '-g' '-fPIC' '-I/usr/include/libdrm' '-I/usr/include/libpng16' '-MMD' '-MQ' 'ksim-stub@sha/avx-builder.c.o' '-MF' 'ksim-stub@sha/avx-builder.c.o.d' -o 'ksim-stub@sha/avx-builder.c.o' -c ../avx-builder.c
In file included from ../avx-builder.h:1:0,
from ../avx-builder.c:28:
/usr/include/bfd.h:35:2: error: #error config.h must be included before this header
#error config.h must be included before this header
^~~~~
[4/19] Compiling c object 'ksim-stub@sha/eu.c.o'
FAILED: ksim-stub@sha/eu.c.o
ccache cc '-Iksim-stub@sha' '-fdiagnostics-color=always' '-I..' '-I.' '-pipe' '-Wall' '-Winvalid-pch' '-fvisibility=hidden' '-Wall' '-march=native' '-mrtm' '-D_GNU_SOURCE' '-O0' '-g' '-fPIC' '-I/usr/include/libdrm' '-I/usr/include/libpng16' '-MMD' '-MQ' 'ksim-stub@sha/eu.c.o' '-MF' 'ksim-stub@sha/eu.c.o.d' -o 'ksim-stub@sha/eu.c.o' -c ../eu.c
In file included from ../avx-builder.h:1:0,
from ../eu.c:38:
/usr/include/bfd.h:35:2: error: #error config.h must be included before this header
#error config.h must be included before this header
^~~~~
[8/19] Compiling c object 'ksim-stub@sha/stub.c.o'
ninja: build stopped: subcommand failed.
I'm not sure what the appropriate fix is, but defining PACKAGE above the include avoids the error.
This looks like a problem with the arch package. The header here on fedora says:
/* DO NOT EDIT! -- buffer-read-only: t -- This file is automatically
generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c",
"bfdio.c", "bfdwin.c", "section.c", "archures.c", "reloc.c",
"syms.c", "bfd.c", "archive.c", "corefile.c", "targets.c", "format.c",
"linker.c", "simple.c" and "compress.c".
Run "make headers" in your build bfd/ to regenerate. */
Maybe there's a problem with how they generate the header when they build bfd.
Sorry for the delayed response. I'm currently on vacation with no access to an Arch system. I remember Arch having a similar header comment. I'll look into it more when I get back.
Looks like this error is avoided in Fedora because they patch bfd to exclude the check for PACKAGE : http://pkgs.fedoraproject.org/cgit/rpms/binutils.git/tree/binutils-2.22.52.0.4-no-config-h-check.patch . For reference, here's another software project similarly affected by a more vanilla copy of the header: mlpack/mlpack#574
I see, for better or worse, the fedora maintainers are shielding fedora users from binutils upstream... I'll add a similar workaround for ksim. Thanks for digging into this!
Thanks. No problem!