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

Bazel build fails on Mac OS X #43

Closed
yesudeep opened this issue Jul 25, 2020 · 1 comment
Closed

Bazel build fails on Mac OS X #43

yesudeep opened this issue Jul 25, 2020 · 1 comment

Comments

@yesudeep
Copy link

yesudeep commented Jul 25, 2020

Hi,

I'm using Bazel to build tcmalloc on Mac OS X 10.15.6 but I get an error:

❯ bazel build "@com_google_tcmalloc//tcmalloc"
INFO: Analyzed target @com_google_tcmalloc//tcmalloc:tcmalloc (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
INFO: From Compiling external/com_google_tcmalloc/tcmalloc/internal/environment.cc:
warning: unknown warning option '-Wno-attribute-alias'; did you mean '-Wno-attributes'? [-Wunknown-warning-option]
1 warning generated.
ERROR: /private/var/tmp/_bazel_username/148f9f6ebca6e47e7d6d5ed427a82e62/external/com_google_tcmalloc/tcmalloc/internal/BUILD:200:11: C++ compilation of rule '@com_google_tcmalloc//tcmalloc/internal:mincore' failed (Exit 1): wrapped_clang failed: error executing command
  (cd /private/var/tmp/_bazel_username/148f9f6ebca6e47e7d6d5ed427a82e62/sandbox/darwin-sandbox/59/execroot/__main__ && \
  exec env - \
    APPLE_SDK_PLATFORM=MacOSX \
    APPLE_SDK_VERSION_OVERRIDE=10.15 \
    PATH=/Users/username/.local/bin:/Users/username/go/bin:/Users/username/.cargo/bin:/usr/local/opt/llvm/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin \
    XCODE_VERSION_OVERRIDE=11.6.0.11E708 \
  external/local_config_cc/wrapped_clang '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -O0 -DDEBUG '-std=c++11' -iquote external/com_google_tcmalloc -iquote bazel-out/darwin-fastbuild/bin/external/com_google_tcmalloc -MD -MF bazel-out/darwin-fastbuild/bin/external/com_google_tcmalloc/tcmalloc/internal/_objs/mincore/mincore.d '-frandom-seed=bazel-out/darwin-fastbuild/bin/external/com_google_tcmalloc/tcmalloc/internal/_objs/mincore/mincore.o' -isysroot __BAZEL_XCODE_SDKROOT__ -F__BAZEL_XCODE_SDKROOT__/System/Library/Frameworks -F__BAZEL_XCODE_DEVELOPER_DIR__/Platforms/MacOSX.platform/Developer/Library/Frameworks '-mmacosx-version-min=10.15' -DHAVE_BAZEL_BUILD '-fdiagnostics-color=always' '-std=c++2a' -Wall -Wreturn-type -Wuninitialized -Wunused-result '-Werror=narrowing' '-Werror=reorder' -Wunused-local-typedefs '-Werror=conversion-null' '-Werror=overlength-strings' '-Werror=pointer-arith' '-Werror=varargs' '-Werror=vla' '-Werror=write-strings' -Wmissing-declarations -Wno-attribute-alias -Wno-sign-compare -Wno-uninitialized -Wno-unused-function -Wno-unused-result -Wno-unused-variable -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/com_google_tcmalloc/tcmalloc/internal/mincore.cc -o bazel-out/darwin-fastbuild/bin/external/com_google_tcmalloc/tcmalloc/internal/_objs/mincore/mincore.o)
Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox wrapped_clang failed: error executing command
  (cd /private/var/tmp/_bazel_username/148f9f6ebca6e47e7d6d5ed427a82e62/sandbox/darwin-sandbox/59/execroot/__main__ && \
  exec env - \
    APPLE_SDK_PLATFORM=MacOSX \
    APPLE_SDK_VERSION_OVERRIDE=10.15 \
    PATH=/Users/username/.local/bin:/Users/username/go/bin:/Users/username/.cargo/bin:/usr/local/opt/llvm/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin \
    XCODE_VERSION_OVERRIDE=11.6.0.11E708 \
  external/local_config_cc/wrapped_clang '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -O0 -DDEBUG '-std=c++11' -iquote external/com_google_tcmalloc -iquote bazel-out/darwin-fastbuild/bin/external/com_google_tcmalloc -MD -MF bazel-out/darwin-fastbuild/bin/external/com_google_tcmalloc/tcmalloc/internal/_objs/mincore/mincore.d '-frandom-seed=bazel-out/darwin-fastbuild/bin/external/com_google_tcmalloc/tcmalloc/internal/_objs/mincore/mincore.o' -isysroot __BAZEL_XCODE_SDKROOT__ -F__BAZEL_XCODE_SDKROOT__/System/Library/Frameworks -F__BAZEL_XCODE_DEVELOPER_DIR__/Platforms/MacOSX.platform/Developer/Library/Frameworks '-mmacosx-version-min=10.15' -DHAVE_BAZEL_BUILD '-fdiagnostics-color=always' '-std=c++2a' -Wall -Wreturn-type -Wuninitialized -Wunused-result '-Werror=narrowing' '-Werror=reorder' -Wunused-local-typedefs '-Werror=conversion-null' '-Werror=overlength-strings' '-Werror=pointer-arith' '-Werror=varargs' '-Werror=vla' '-Werror=write-strings' -Wmissing-declarations -Wno-attribute-alias -Wno-sign-compare -Wno-uninitialized -Wno-unused-function -Wno-unused-result -Wno-unused-variable -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/com_google_tcmalloc/tcmalloc/internal/mincore.cc -o bazel-out/darwin-fastbuild/bin/external/com_google_tcmalloc/tcmalloc/internal/_objs/mincore/mincore.o)
Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox
warning: unknown warning option '-Wno-attribute-alias'; did you mean '-Wno-attributes'? [-Wunknown-warning-option]
external/com_google_tcmalloc/tcmalloc/internal/mincore.cc:28:36: error: cannot initialize a parameter of type 'char *' with an lvalue of type 'unsigned char *'
    return ::mincore(addr, length, result);
                                   ^~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/sys/mman.h:243:45: note: passing argument to parameter here
int     mincore(const void *, size_t, char *);
                                            ^
1 warning and 1 error generated.
Target @com_google_tcmalloc//tcmalloc:tcmalloc failed to build
INFO: Elapsed time: 0.658s, Critical Path: 0.53s
INFO: 1 process: 1 darwin-sandbox.
FAILED: Build did NOT complete successfully

Running the same command on Clear Linux 5.7.8-968 x86_64 with gcc compiles alright without errors.

@yesudeep
Copy link
Author

Nevermind. Realized it works only on Linux.

This issue was closed.
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

1 participant