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

Failed to build ksim-stub@sha/avx-builder.c.o #1

Open
nanley opened this issue Nov 11, 2016 · 5 comments
Open

Failed to build ksim-stub@sha/avx-builder.c.o #1

nanley opened this issue Nov 11, 2016 · 5 comments

Comments

@nanley
Copy link

nanley commented Nov 11, 2016

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.

@krh
Copy link
Owner

krh commented Nov 11, 2016

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.

@krh krh closed this as completed Nov 22, 2016
@nanley
Copy link
Author

nanley commented Nov 23, 2016

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.

@nanley
Copy link
Author

nanley commented Nov 28, 2016

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

@krh
Copy link
Owner

krh commented Nov 29, 2016

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!

@krh krh reopened this Nov 29, 2016
@nanley
Copy link
Author

nanley commented Nov 30, 2016

Thanks. No problem!

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