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

env DEVELOPER_DIR and SDKROOT missing when linking executable file #12321

Closed
daimagou opened this issue Oct 21, 2020 · 6 comments
Closed

env DEVELOPER_DIR and SDKROOT missing when linking executable file #12321

daimagou opened this issue Oct 21, 2020 · 6 comments
Labels

Comments

@daimagou
Copy link

daimagou commented Oct 21, 2020

Description of the problem / feature request:

Use --sandbox_debug to see verbose messages from the sandbox
Error: SDKROOT not set.
external/local_config_cc/cc_wrapper.sh: line 58:  6153 Abort trap: 6           "$(/usr/bin/dirname "$0")"/wrapped_clang "$@"

Feature requests: what underlying problem are you trying to solve with this feature?

manual export SDKROOT and DEVELOPER_DIR  env in external/local_config_cc/cc_wrapper.sh 

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

build an executable file for ios/macos

What operating system are you running Bazel on?

ProductName: Mac OS X
ProductVersion: 10.15.3
BuildVersion: 19D76

Have you found anything relevant by searching the web?

#11716

Any other information, logs, or outputs that you want to share?

// Returns the DEVELOPER_DIR environment variable in the current process
// environment. Aborts if this variable is unset.
std::string GetMandatoryEnvVar(const std::string &var_name) {
  char *env_value = getenv(var_name.c_str());
  if (env_value == nullptr) {
    std::cerr << "Error: " << var_name << " not set.\n";
    abort();
  }
  return env_value;
}
@daimagou daimagou changed the title env DEVELOPER_DIR and SDKROOT misc when compile executable file env DEVELOPER_DIR and SDKROOT missing when linking executable file Oct 21, 2020
@jin jin added z-team-Apple Deprecated. Send to rules_apple, or label team-Rules-CPP + platform:apple type: bug untriaged labels Oct 21, 2020
@haolongzhangm
Copy link

any update for this issue ,

sames caused by upgrade the lastest xcode

@susinmotion
Copy link
Contributor

susinmotion commented Oct 23, 2020

It looks like the installation might be incomplete and/or Bazel might be looking in the wrong place for the developer tools.

Could you try if you haven't:
accepting the license?
installing the command line tools for the new Xcode version?
using --xcode_version or xcode-select to point to the new Xcode version?
running blaze shutdown?

https://docs.bazel.build/versions/master/migrate-xcode.html#troubleshooting

@daimagou
Copy link
Author

daimagou commented Oct 26, 2020

@susinmotion thank you for your reply,I tried the method you said, but there is still the same problem

add more info:

1.Env can be found in the compile stage

(cd /private/var/tmp/_bazel_xxx/19af71a3f2eee621aed0a0ca59e12662/execroot/xxxx && \
  exec env - \
    APPLE_SDK_PLATFORM=iPhoneOS \
    APPLE_SDK_VERSION_OVERRIDE=13.6 \
    PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin \
    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 -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG '-std=c++11' -iquote 

  .....

  ...../utils.cpp -o bazel-out/ios_arm64-opt/bin/..../utils.o

  1. Env cannot be found in the executable file generation stage
 (cd /private/var/tmp/_bazel_mac_ci/19af71a3f2eee621aed0a0ca59e12662/execroot/xxxx && \
 exec env - \
 external/local_config_cc/cc_wrapper.sh bazel-out/ios_arm64-opt/bin/xxxxx/libmy_test.internal_cc_library.a 
 ....

ERROR: /Users/mac/...path.../BUILD:24:1: Linking bazel-out/ios_arm64-opt/bin/....path.../my_test.unstripped... failed (Aborted): cc_wrapper.sh failed: error executing command external/local_config_cc/cc_wrapper.sh bazel-out/ios_arm64-opt/bin/...path..../libmy_test.internal_cc_library.a ... (remaining 15 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox cc_wrapper.sh failed: error executing command external/local_config_cc/cc_wrapper.sh bazel-out/ios_arm64-opt/bin/...path..../libmy_test.internal_cc_library.a ... (remaining 15 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
Error: DEVELOPER_DIR not set.
external/local_config_cc/cc_wrapper.sh: line 56:  9557 Abort trap: 6           "$(/usr/bin/dirname "$0")"/wrapped_clang "$@"

I don’t understand why it will be different at different stages

@susinmotion susinmotion added the team-Rules-CPP Issues for C++ rules label Oct 26, 2020
@susinmotion
Copy link
Contributor

Ahhh thanks for looking into this. The "missing env" issue is real. It's this one: #12049.

But I still think there might be something else going on here... Passing to cc rules for more input.

@susinmotion susinmotion removed the z-team-Apple Deprecated. Send to rules_apple, or label team-Rules-CPP + platform:apple label Oct 26, 2020
@keith
Copy link
Member

keith commented Oct 26, 2020

FWIW with my issue I've never seen an action not get the apple env that requires it.

@susinmotion susinmotion removed their assignment Oct 30, 2020
@daimagou
Copy link
Author

daimagou commented Nov 9, 2020

Thanks everyone for your help, close this question

@daimagou daimagou closed this as completed Nov 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants
@keith @jin @susinmotion @haolongzhangm @daimagou and others