-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
this rule is missing dependency declarations for the following files included by 'external/com_google_protobuf/src/google/protobuf/util/internal/json_escaping.cc' #5164
Comments
I am seeing a similar error
The protobuf dependency we are pulling in is:
|
Getting the same error with my custom CROSSTOOL which worked with bazel up to version 0.12. |
@damienmg please help ;-) |
well, I seem to have found the solution:
But now there is a new problem: ERROR: cc_toolchain_suite '@bazel_build_toolchains//tools/arm_compiler:toolchain' does not contain a toolchain for CPU 'local' and compiler 'compiler' And if I modify |
Can you share the BUILD file which has cc_toolchain_suite? Are you setting
--cpu and/or --compiler/--libc_top?
…On Wed, May 23, 2018 at 7:03 AM Chen Kan ***@***.***> wrote:
well, I seem to have found the solution:
the local part in my CROSSTOOL file is wrong cause I use paths of gcc 4.8
in cxx_builtin_include_directory section, which would not exist in Ubuntu
16.04.
Here is my new CROSSTOOL file:
major_version: "local"
minor_version: ""
default_target_cpu: "same_as_host"
default_toolchain {
cpu: "aarch64"
toolchain_identifier: "gcc_5_4_1_aarch64"
}
default_toolchain {
cpu: "k8"
toolchain_identifier: "local_linux"
}
default_toolchain {
cpu: "local"
toolchain_identifier: "local_linux"
}
toolchain {
abi_version: "gcc"
abi_libc_version: "glibc_2.21"
builtin_sysroot: ""
compiler: "gcc"
host_system_name: "k8"
needsPic: true
supports_gold_linker: false
supports_incremental_linker: false
supports_fission: false
supports_interface_shared_objects: false
supports_normalizing_ar: true
supports_start_end_lib: false
supports_thin_archives: true
target_libc: "glibc_2.21"
target_cpu: "aarch64"
target_system_name: "aarch64"
toolchain_identifier: "gcc_5_4_1_aarch64"
tool_path { name: "ar" path: "gcc-5.4.1-aarch64/aarch64-linux-gnu-ar" }
tool_path { name: "compat-ld" path: "gcc-5.4.1-aarch64/aarch64-linux-gnu-ld" }
tool_path { name: "cpp" path: "gcc-5.4.1-aarch64/aarch64-linux-gnu-gcc" }
tool_path { name: "dwp" path: "gcc-5.4.1-aarch64/aarch64-linux-gnu-dwp" }
tool_path { name: "gcc" path: "gcc-5.4.1-aarch64/aarch64-linux-gnu-gcc" }
tool_path { name: "gcov" path: "gcc-5.4.1-aarch64/aarch64-linux-gnu-gcov" }
tool_path { name: "ld" path: "gcc-5.4.1-aarch64/aarch64-linux-gnu-ld" }
tool_path { name: "nm" path: "gcc-5.4.1-aarch64/aarch64-linux-gnu-nm" }
tool_path { name: "objcopy" path: "gcc-5.4.1-aarch64/aarch64-linux-gnu-objcopy" }
objcopy_embed_flag: "-I"
objcopy_embed_flag: "binary"
tool_path { name: "objdump" path: "gcc-5.4.1-aarch64/aarch64-linux-gnu-objdump" }
tool_path { name: "strip" path: "gcc-5.4.1-aarch64/aarch64-linux-gnu-strip" }
compiler_flag: "--sysroot=external/org_linaro_releases_gcc_5_4_1_aarch64/aarch64-linux-gnu/libc"
# compiler_flag: "-mfloat-abi=hard"
compiler_flag: "-nostdinc"
compiler_flag: "-isystem"
compiler_flag: "external/org_linaro_releases_gcc_5_4_1_aarch64/lib/gcc/aarch64-linux-gnu/5.4.1/include"
compiler_flag: "-isystem"
compiler_flag: "external/org_linaro_releases_gcc_5_4_1_aarch64/aarch64-linux-gnu/libc/usr/include"
compiler_flag: "-isystem"
compiler_flag: "external/org_linaro_releases_gcc_5_4_1_aarch64/lib/gcc/aarch64-linux-gnu/5.4.1/include-fixed"
cxx_flag: "-isystem"
cxx_flag: "external/org_linaro_releases_gcc_5_4_1_aarch64/aarch64-linux-gnu/include/c++/5.4.1/aarch64-linux-gnu"
cxx_flag: "-isystem"
cxx_flag: "external/org_linaro_releases_gcc_5_4_1_aarch64/aarch64-linux-gnu/include/c++/5.4.1"
cxx_flag: "-std=c++11"
cxx_builtin_include_directory: ***@***.***_linaro_releases_gcc_5_4_1_aarch64//include)%"
cxx_builtin_include_directory: ***@***.***_linaro_releases_gcc_5_4_1_aarch64//aarch64-linux-gnu/libc/usr/include)%"
cxx_builtin_include_directory: ***@***.***_linaro_releases_gcc_5_4_1_aarch64//lib/gcc/aarch64-linux-gnu/5.4.1/include)%"
cxx_builtin_include_directory: ***@***.***_linaro_releases_gcc_5_4_1_aarch64//lib/gcc/aarch64-linux-gnu/5.4.1/include-fixed)%"
cxx_builtin_include_directory: ***@***.***_linaro_releases_gcc_5_4_1_aarch64//aarch64-linux-gnu/include)%/c++/5.4.1/aarch64-linux-gnu"
cxx_builtin_include_directory: ***@***.***_linaro_releases_gcc_5_4_1_aarch64//aarch64-linux-gnu/include)%/c++/5.4.1"
linker_flag: "--sysroot=external/org_linaro_releases_gcc_5_4_1_aarch64/aarch64-linux-gnu/libc"
linker_flag: "-lstdc++"
# linker_flag: "-lm"
# linker_flag: "-lpthread"
linker_flag: "-Lexternal/org_linaro_releases_gcc_5_4_1_aarch64/aarch64-linux-gnu/lib"
linker_flag: "-Lexternal/org_linaro_releases_gcc_5_4_1_aarch64/aarch64-linux-gnu/lib64"
linker_flag: "-Lexternal/org_linaro_releases_gcc_5_4_1_aarch64/aarch64-linux-gnu/libc/lib"
linker_flag: "-Lexternal/org_linaro_releases_gcc_5_4_1_aarch64/aarch64-linux-gnu/libc/usr/lib"
linker_flag: "-Bexternal/org_linaro_releases_gcc_5_4_1_aarch64/aarch64-linux-gnu/bin"
# linker_flag: "-Wl,--dynamic-linker=/lib/ld-linux-aarch64.so.1"
# linker_flag: "-print-sysroot"
# linker_flag: "-Wl,-verbose"
# Anticipated future default.
# This makes GCC and Clang do what we want when called through symlinks.
unfiltered_cxx_flag: "-no-canonical-prefixes"
linker_flag: "-no-canonical-prefixes"
# Make C++ compilation deterministic. Use linkstamping instead of these
# compiler symbols.
unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
# Security hardening on by default.
# Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
# We need to undef it before redefining it as some distributions now have
# it enabled by default.
compiler_flag: "-U_FORTIFY_SOURCE"
compiler_flag: "-fstack-protector"
compiler_flag: "-fPIE"
linker_flag: "-pie"
linker_flag: "-Wl,-z,relro,-z,now"
# Enable coloring even if there's no attached terminal. Bazel removes the
# escape sequences if --nocolor is specified.
compiler_flag: "-fdiagnostics-color=always"
# All warnings are enabled. Maybe enable -Werror as well?
compiler_flag: "-Wall"
# Enable a few more warnings that aren't part of -Wall.
compiler_flag: "-Wunused-but-set-parameter"
# But disable some that are problematic.
compiler_flag: "-Wno-free-nonheap-object" # has false positives
# Keep stack frames for debugging, even in opt mode.
compiler_flag: "-fno-omit-frame-pointer"
# Stamp the binary with a unique identifier.
linker_flag: "-Wl,--build-id=md5"
linker_flag: "-Wl,--hash-style=gnu"
compilation_mode_flags {
mode: DBG
# Enable debug symbols.
compiler_flag: "-g"
# Keep stack frames for debugging.
# compiler_flag: "-fno-omit-frame-pointer"
}
compilation_mode_flags {
mode: OPT
# No debug symbols.
# Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or
# even generally? However, that can't happen here, as it requires special
# handling in Bazel.
compiler_flag: "-g0"
# Conservative choice for -O
# -O3 can increase binary size and even slow down the resulting binaries.
# Profile first and / or use FDO if you need better performance than this.
compiler_flag: "-O2"
# Disable assertions
compiler_flag: "-DNDEBUG"
# Removal of unused code and data at link time (can this increase binary size in some cases?).
compiler_flag: "-ffunction-sections"
compiler_flag: "-fdata-sections"
linker_flag: "-Wl,--gc-sections"
# statically link everything
# linker_flag: "-static"
# strip all symbols
linker_flag: "-s"
}
}
toolchain {
abi_version: "local"
abi_libc_version: "local"
builtin_sysroot: ""
compiler: "compiler"
host_system_name: "local"
needsPic: true
supports_gold_linker: false
supports_incremental_linker: false
supports_fission: false
supports_interface_shared_objects: false
supports_normalizing_ar: false
supports_start_end_lib: false
target_libc: "local"
target_cpu: "local"
target_system_name: "local"
toolchain_identifier: "local_linux"
tool_path { name: "ar" path: "/usr/bin/ar" }
tool_path { name: "compat-ld" path: "/usr/bin/ld" }
tool_path { name: "cpp" path: "/usr/bin/cpp" }
tool_path { name: "dwp" path: "/usr/bin/dwp" }
tool_path { name: "gcc" path: "/usr/bin/gcc" }
cxx_flag: "-std=c++0x"
linker_flag: "-lstdc++"
linker_flag: "-B/usr/bin/"
# TODO(bazel-team): In theory, the path here ought to exactly match the path
# used by gcc. That works because bazel currently doesn't track files at
# absolute locations and has no remote execution, yet. However, this will need
# to be fixed, maybe with auto-detection?
cxx_builtin_include_directory: "/usr/lib/gcc/"
cxx_builtin_include_directory: "/usr/local/include"
cxx_builtin_include_directory: "/usr/include"
tool_path { name: "gcov" path: "/usr/bin/gcov" }
# C(++) compiles invoke the compiler (as that is the one knowing where
# to find libraries), but we provide LD so other rules can invoke the linker.
tool_path { name: "ld" path: "/usr/bin/ld" }
tool_path { name: "nm" path: "/usr/bin/nm" }
tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
objcopy_embed_flag: "-I"
objcopy_embed_flag: "binary"
tool_path { name: "objdump" path: "/usr/bin/objdump" }
tool_path { name: "strip" path: "/usr/bin/strip" }
# Anticipated future default.
unfiltered_cxx_flag: "-no-canonical-prefixes"
unfiltered_cxx_flag: "-fno-canonical-system-headers"
# Make C++ compilation deterministic. Use linkstamping instead of these
# compiler symbols.
unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
# Security hardening on by default.
# Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
# We need to undef it before redefining it as some distributions now have
# it enabled by default.
compiler_flag: "-U_FORTIFY_SOURCE"
compiler_flag: "-D_FORTIFY_SOURCE=1"
compiler_flag: "-fstack-protector"
linker_flag: "-Wl,-z,relro,-z,now"
# Enable coloring even if there's no attached terminal. Bazel removes the
# escape sequences if --nocolor is specified. This isn't supported by gcc
# on Ubuntu 14.04.
# compiler_flag: "-fcolor-diagnostics"
# All warnings are enabled. Maybe enable -Werror as well?
compiler_flag: "-Wall"
# Enable a few more warnings that aren't part of -Wall.
compiler_flag: "-Wunused-but-set-parameter"
# But disable some that are problematic.
compiler_flag: "-Wno-free-nonheap-object" # has false positives
# Keep stack frames for debugging, even in opt mode.
compiler_flag: "-fno-omit-frame-pointer"
# Anticipated future default.
linker_flag: "-no-canonical-prefixes"
# Have gcc return the exit code from ld.
linker_flag: "-pass-exit-codes"
# Gold linker only? Can we enable this by default?
# linker_flag: "-Wl,--warn-execstack"
# linker_flag: "-Wl,--detect-odr-violations"
compilation_mode_flags {
mode: DBG
# Enable debug symbols.
compiler_flag: "-g"
}
compilation_mode_flags {
mode: OPT
# No debug symbols.
# Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or
# even generally? However, that can't happen here, as it requires special
# handling in Bazel.
compiler_flag: "-g0"
# Conservative choice for -O
# -O3 can increase binary size and even slow down the resulting binaries.
# Profile first and / or use FDO if you need better performance than this.
compiler_flag: "-O2"
# Disable assertions
compiler_flag: "-DNDEBUG"
# Removal of unused code and data at link time (can this increase binary size in some cases?).
compiler_flag: "-ffunction-sections"
compiler_flag: "-fdata-sections"
linker_flag: "-Wl,--gc-sections"
}
linking_mode_flags { mode: DYNAMIC }
}
But now there is a new problem:
ERROR: cc_toolchain_suite ***@***.***_build_toolchains//tools/arm_compiler:toolchain' does not contain a toolchain for CPU 'local' and compiler 'compiler'
And if I modify target_cpu to k8 in my CROSSTOOL file local part, this
problem will disapear.
But I think this solution is not very elegant...
So is there anybody knows why k8 is necessary for target_cpu, and what is
the best solution here.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#5164 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAxt5i-4FuAhe618IQvO8cE-L_JtmL0Zks5t1O2WgaJpZM4TznjO>
.
--
Marcel Hlopko | Software Engineer | hlopko@google.com |
Google Germany GmbH | Erika-Mann-Str. 33 | 80636 München | Germany |
Geschäftsführer: Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
| Registergericht
und -nummer: Hamburg, HRB 86891
|
@mhlopko ok, here it is filegroup(
name = "toolchain_fg",
srcs = [
":cc-compiler-aarch64",
":cc-compiler-k8",
":aarch64_linux_all_files",
"@org_linaro_releases_gcc_5_4_1_aarch64//:compiler_components",
],
)
filegroup(
name = "srcs",
srcs = glob(["**"]) + [
"//tools/arm_compiler/gcc-5.4.1-aarch64:srcs",
],
# visibility = ["//visibility:public"],
)
cc_toolchain_suite(
name = "toolchain",
# target_cpu | compiler
toolchains = {
"aarch64|gcc": "cc-compiler-aarch64",
"k8|compiler": "cc-compiler-k8",
},
)
filegroup(
name = "aarch64_linux_all_files",
srcs = [
"//tools/arm_compiler/gcc-5.4.1-aarch64:tool-wrappers",
"@org_linaro_releases_gcc_5_4_1_aarch64//:compiler_pieces",
],
)
filegroup(
name = "aarch64_linux_linker_files",
srcs = [
"//tools/arm_compiler/gcc-5.4.1-aarch64:ar",
"//tools/arm_compiler/gcc-5.4.1-aarch64:gcc",
"//tools/arm_compiler/gcc-5.4.1-aarch64:ld",
"@org_linaro_releases_gcc_5_4_1_aarch64//:compiler_pieces",
],
)
filegroup(
name = "aarch64_linux_compiler_files",
srcs = [
"//tools/arm_compiler/gcc-5.4.1-aarch64:as",
"//tools/arm_compiler/gcc-5.4.1-aarch64:gcc",
"//tools/arm_compiler/gcc-5.4.1-aarch64:ld",
"@org_linaro_releases_gcc_5_4_1_aarch64//:compiler_pieces",
],
)
filegroup(
name = "empty",
srcs = [],
)
cc_toolchain(
name = "cc-compiler-aarch64",
all_files = ":aarch64_linux_all_files",
compiler_files = ":aarch64_linux_compiler_files",
cpu = "aarch64",
dwp_files = ":empty",
dynamic_runtime_libs = [":empty"],
linker_files = ":aarch64_linux_linker_files",
objcopy_files = "//tools/arm_compiler/gcc-5.4.1-aarch64:objcopy",
static_runtime_libs = [":empty"],
strip_files = "//tools/arm_compiler/gcc-5.4.1-aarch64:strip",
supports_param_files = 1,
visibility = ["//visibility:public"],
)
cc_toolchain(
name = "cc-compiler-k8",
all_files = ":empty",
compiler_files = ":empty",
cpu = "local",
dwp_files = ":empty",
dynamic_runtime_libs = [":empty"],
linker_files = ":empty",
objcopy_files = ":empty",
static_runtime_libs = [":empty"],
strip_files = ":empty",
supports_param_files = 1,
visibility = ["//visibility:public"],
) |
@mhlopko so the problem is all targets in cc-compiler-k8 are empty? |
OK, I think I've figured it out, toolchain in CROSSTOOL must match cc_toolchain_suite() right? SOrry for the trouble, I'll close this issue. |
I met the same problem. But I don't understand how you solved it. It seems that you deleted gcc 4.8 part. But it seems that the CROSSTOOL code you pasted as a solution does not match what you've pasted in your first post, a lot of code has been changed. I can't match two files.
in a CROSSTOOL.tpl file, didn't find any gcc version stuff. |
We see a similar issue in p4lang/p4c#3748 (comment), but we're not using a custom CROSSTOOL. Any ideas? |
Because this ticket often comes in google search for a bunch of a similar issues, I decided to add this potentially helpful comment. Basically, each time compiler version changes within a particular toolchain (including default toolchain, as in: compiler was upgraded on the host machine) it is desirable to clean up the bazel build cache in |
@oakad Do you know if there's an issue open somewhere to fix that? Having to clear caches in Bazel is allegedly not something one should ever have to do. |
It's not necessary to clear the cache, but you have to explicitly rerun the repo rules that detect non-hermetic host configuration via |
Every time I tried to use bazel fetch on its own it somehow broke on me. :-) |
@fmeum Can confirm that fetch solution seems to work. But, it's not something which is easy to remember so adding it to the error message will be most helpful. |
Description of the problem / feature request:
build protobuf with custom CROSSTOOL under Ubuntu 16.04 failed:
This is my build command:
And my WORKSPACE:
my BUILD looks like this:
This is my
main.cc
:At last the CROSSTOOL:
sorry that I have to screen some code for copyright reasons.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
I'm using docker to build my project:
docker pull chenkan1994/bazel-build:latest
Build with all the files I posted above should reproduce this bug.
What operating system are you running Bazel on?
Ubuntu 16.04
What's the output of
bazel info release
?release 0.13.0
Have you found anything relevant by searching the web?
The text was updated successfully, but these errors were encountered: