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

Building rules_m4 on Windows result in errors #1

Closed
robin-thomas opened this issue Jan 4, 2019 · 2 comments
Closed

Building rules_m4 on Windows result in errors #1

robin-thomas opened this issue Jan 4, 2019 · 2 comments

Comments

@robin-thomas
Copy link

Bazel building using MSVC

$ bazel build @bazelify_gmp//:gmp
INFO: Invocation ID: 18ac6ddd-788d-4f38-b1f5-edd31178d40d
Loading:
Loading: 0 packages loaded
Analyzing: target @bazelify_gmp//:gmp (0 packages loaded, 0 targets configured)
INFO: Analysed target @bazelify_gmp//:gmp (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
[0 / 21] no action
ERROR: C:/users/houji/_bazel_houji/6dp3edvb/external/m4_v1.4.18/BUILD.bazel:15:1: C++ compilation of rule '@m4_v1.4.18//:m4_lib' failed (Exit 2)
c:\users\houji\_bazel_houji\6dp3edvb\execroot\__main__\external\m4_v1.4.18\lib\freadahead.h(41): error C2061: syntax error: identifier '__attribute__'
c:\users\houji\_bazel_houji\6dp3edvb\execroot\__main__\external\m4_v1.4.18\lib\freadahead.h(41): error C2059: syntax error: ';'
Target @bazelify_gmp//:gmp failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.788s, Critical Path: 0.70s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

Bazel building using mingw-gcc

$ bazel build @bazelify_gmp//:gmp --compiler=mingw-gcc
INFO: Invocation ID: 768ff9c7-3663-4166-a1a0-24d2444af630
Loading:
Loading: 0 packages loaded
Analyzing: target @bazelify_gmp//:gmp (0 packages loaded, 0 targets configured)
INFO: Analysed target @bazelify_gmp//:gmp (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
[0 / 17] no action
ERROR: C:/users/houji/_bazel_houji/6dp3edvb/external/m4_v1.4.18/BUILD.bazel:15:1: C++ compilation of rule '@m4_v1.4.18//:m4_lib' failed (Exit 1)
In file included from external/m4_v1.4.18/lib/regex.c:68:
external/m4_v1.4.18/lib/regex_internal.h:29:10: fatal error: langinfo.h: No such file or directory
 #include <langinfo.h>
          ^~~~~~~~~~~~
compilation terminated.
Target @bazelify_gmp//:gmp failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.267s, Critical Path: 0.21s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

It builds fine on Ubuntu and Mac.

Kindly help.

@jmillikin
Copy link
Owner

I don't have any machines running Windows, so I can't debug this directly. Once rules_m4 moves upstream into the bazelbuild/ org and gets a full CI suite, fixing the Windows build will be more practical.

If you upload the header files generated by m4's build scripts, I might be able to hack something together for the short term. Can you try downloading https://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.xz and running its configure manually, then uploading the resulting config.h and configmake.h to this issue? Ideally once for MSVC, and again using mingw-gcc.

@jmillikin
Copy link
Owner

MSVC builds are now working. There are some compiler warnings about invalid conversions because M4 assumes sizeof(int) == sizeof(void*) which isn't true, but the resulting binaries are functional enough to pass the test suite.

I haven't tried building with MinGW, but believe it should need only minimal changes. Specifically the use of MSVC-specific #pragma include_alias in gnulib_windows_config.h should be replaced by shim headers containing GCC-specific #include_next directives.

windows rules_m4

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