bazel-contrib / bazel-contrib/rules_foreign_cc

apr example build with configure_make fails on os x

Open
#808 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
737
Forks
270
PR merge metrics
No merged PRs in 30d

Description

I tried to build `configure_make` example that provide apr library as third party.
On make stage it fails:

```
config.status: executing libtool commands
config.status: executing default commands
+ /private/var/tmp/_bazel_u18151176/230694bf04aa38d817d04fe9d58edb9d/sandbox/darwin-sandbox/2/execroot/rules_foreign_cc_examples/bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make -C /private/var/tmp/_bazel_u18151176/230694bf04aa38d817d04fe9d58edb9d/sandbox/darwin-sandbox/2/execroot/rules_foreign_cc_examples/bazel-out/darwin-fastbuild/bin/external/apr/apr.build_tmpdir
bazel-out/darwin-fastbuild/bin/external/apr/apr_foreign_cc/build_script.sh: line 136: 29433 Segmentation fault: 11 $EXT_BUILD_ROOT/bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make -C $BUILD_TMPDIR
_____ END BUILD LOGS _____
```
When I tried to build sources in sandbox dir with system `GNU make` it's doesn't fault, but `rules_foreign_cc/toolchains/make/bin/make` keeps throwing `segfaults`.

OSX version : 11.5.2 Big Sur
Bazel version : 4.2.1

I noticed that system `make` builded for `i386-apple-darwin11.3.0 `, but toolchain's `make` builded for `x86_64-apple-darwin20.6.0 `

If i run toolchains/make/bin/make by hands, I get the following output:

```
/private/var/tmp/_bazel_u18151176/230694bf04aa38d817d04fe9d58edb9d/sandbox/darwin-sandbox/2/execroot/rules_foreign_cc_examples/bazel-out/darwin-fastbuild/bin/external/apr/apr.build_tmpdir » /private/var/tmp/_bazel_u18151176/230694bf04aa38d817d04fe9d58edb9d/sandbox/darwin-sandbox/2/execroot/rules_foreign_cc_examples/bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make -d
GNU Make 4.3
Built for x86_64-apple-darwin20.6.0
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile 'Makefile'...
Reading makefile '/private/var/tmp/_bazel_u18151176/230694bf04aa38d817d04fe9d58edb9d/sandbox/darwin-sandbox/2/execroot/rules_foreign_cc_examples/bazel-out/darwin-fastbuild/bin/external/apr/apr.build_tmpdir/build/apr_rules.mk' (search path) (no ~ expansion)...
Reading makefile '/private/var/tmp/_bazel_u18151176/230694bf04aa38d817d04fe9d58edb9d/sandbox/darwin-sandbox/2/execroot/rules_foreign_cc_examples/bazel-out/darwin-fastbuild/bin/external/apr/apr.build_tmpdir/build-outputs.mk' (search path) (no ~ expansion)...
[1] 29791 segmentation fault -d
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure in the examples/configure_make APR build on macOS 11.5.2 with Bazel 4.2.1, starting at apr_foreign_cc/build_script.sh line 136. Compare rules_foreign_cc/toolchains/make/bin/make with the system GNU make and inspect the generated apr_rules.mk and build-outputs.mk. Done means the toolchain make no longer segfaults and the example builds successfully.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.