Build error under Bazel on Ubuntu: C++ compilation of rule '@org_brotli//:brotlienc' failed #229

Closed
opened 2026-01-29 20:40:16 +00:00 by claunia · 3 comments
Owner

Originally created by @gkalpak on GitHub (May 18, 2018).

I am getting an error when trying to bazel build angular/angular on an Ubuntu 16.04 docker container (based on this docker image).

This is the WORKSPACE file, which contains:

http_archive(
    name = "org_brotli",
    url = "https://github.com/google/brotli/archive/c6333e1e79fb62ea088443f192293f964409b04e.zip",
    strip_prefix = "brotli-c6333e1e79fb62ea088443f192293f964409b04e",
    sha256 = "3f781988dee7dd3bcce2bf238294663cfaaf3b6433505bdb762e24d0a284d1dc",
)

This is the error:

$ cat /etc/issue
Ubuntu 16.04.4 LTS

$ bazel version
Build label: 0.13.0
...

$ bazel build //packages/...
INFO: Analysed 267 targets (0 packages loaded).
INFO: Found 267 targets...
INFO: From Compiling TypeScript (devmode) @angular_devkit//packages/angular_devkit/build_optimizer:lib [for host]:

WARNING: your tsconfig.json file specifies options which are overridden by Bazel:
 - compilerOptions.target and compilerOptions.module are controlled by downstream dependencies, such as ts_devserver
 - compilerOptions.declaration is always true, as it's needed for dependent libraries to type-check
 - compilerOptions.paths is determined by the module_name attribute in transitive deps[]
 - compilerOptions.typeRoots is always set to the @types subdirectory of the node_modules attribute
 - compilerOptions.rootDir and compilerOptions.baseUrl are always the workspace root directory
 - compilerOptions.noEmitOnError is always false under Bazel


INFO: From SkylarkAction packages/core/test/bundling/hello_world_i18n/bundle.min.js:
INFO: Using input source map: bazel-out/k8-fastbuild/bin/packages/core/test/bundling/hello_world_i18n/bundle.js.map
ERROR: /home/gkalpak/.cache/bazel/_bazel_gkalpak/5df520977b592b3dff11812717fa0822/external/org_brotli/BUILD:157:1: C++ compilation of rule '@org_brotli//:brotlienc' failed (Exit 1)
In file included from external/org_brotli/c/enc/./brotli_bit_stream.h:22:0,
                 from external/org_brotli/c/enc/brotli_bit_stream.c:11:
external/org_brotli/c/enc/././command.h: In function 'CombineLengthCodes':
external/org_brotli/c/enc/././command.h:79:12: error: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Werror=conversion]
     return (uint16_t)offset | bits64;
            ^
cc1: all warnings being treated as errors
INFO: Elapsed time: 767.444s, Critical Path: 686.46s
INFO: 70 processes: 17 local, 28 processwrapper-sandbox, 25 worker.
FAILED: Build did NOT complete successfully

cc @alexeagle

Originally created by @gkalpak on GitHub (May 18, 2018). I am getting an error when trying to `bazel build` [angular/angular][1] on an Ubuntu 16.04 docker container (based on this [docker image][2]). This is the [WORKSPACE][3] file, which contains: ``` http_archive( name = "org_brotli", url = "https://github.com/google/brotli/archive/c6333e1e79fb62ea088443f192293f964409b04e.zip", strip_prefix = "brotli-c6333e1e79fb62ea088443f192293f964409b04e", sha256 = "3f781988dee7dd3bcce2bf238294663cfaaf3b6433505bdb762e24d0a284d1dc", ) ``` This is the error: ``` $ cat /etc/issue Ubuntu 16.04.4 LTS $ bazel version Build label: 0.13.0 ... $ bazel build //packages/... INFO: Analysed 267 targets (0 packages loaded). INFO: Found 267 targets... INFO: From Compiling TypeScript (devmode) @angular_devkit//packages/angular_devkit/build_optimizer:lib [for host]: WARNING: your tsconfig.json file specifies options which are overridden by Bazel: - compilerOptions.target and compilerOptions.module are controlled by downstream dependencies, such as ts_devserver - compilerOptions.declaration is always true, as it's needed for dependent libraries to type-check - compilerOptions.paths is determined by the module_name attribute in transitive deps[] - compilerOptions.typeRoots is always set to the @types subdirectory of the node_modules attribute - compilerOptions.rootDir and compilerOptions.baseUrl are always the workspace root directory - compilerOptions.noEmitOnError is always false under Bazel INFO: From SkylarkAction packages/core/test/bundling/hello_world_i18n/bundle.min.js: INFO: Using input source map: bazel-out/k8-fastbuild/bin/packages/core/test/bundling/hello_world_i18n/bundle.js.map ERROR: /home/gkalpak/.cache/bazel/_bazel_gkalpak/5df520977b592b3dff11812717fa0822/external/org_brotli/BUILD:157:1: C++ compilation of rule '@org_brotli//:brotlienc' failed (Exit 1) In file included from external/org_brotli/c/enc/./brotli_bit_stream.h:22:0, from external/org_brotli/c/enc/brotli_bit_stream.c:11: external/org_brotli/c/enc/././command.h: In function 'CombineLengthCodes': external/org_brotli/c/enc/././command.h:79:12: error: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Werror=conversion] return (uint16_t)offset | bits64; ^ cc1: all warnings being treated as errors INFO: Elapsed time: 767.444s, Critical Path: 686.46s INFO: 70 processes: 17 local, 28 processwrapper-sandbox, 25 worker. FAILED: Build did NOT complete successfully ``` cc @alexeagle [1]: https://github.com/angular/angular [2]: https://hub.docker.com/r/dorowu/ubuntu-desktop-lxde-vnc/ [3]: https://github.com/angular/angular/blob/88ab1d0e553238f45e16fabd208134f836564a63/WORKSPACE#L67-L72
Author
Owner

@eustas commented on GitHub (May 18, 2018):

Looks confusing. Compiler says that result of | operator with two uint16_t operands is int.
Going to dig in that soon.

@eustas commented on GitHub (May 18, 2018): Looks confusing. Compiler says that result of `|` operator with two `uint16_t` operands is `int`. Going to dig in that soon.
Author
Owner

@eustas commented on GitHub (May 18, 2018):

Should be fixed now. If not, feel free to reopen with new error log =)

@eustas commented on GitHub (May 18, 2018): Should be fixed now. If not, feel free to reopen with new error log =)
Author
Owner

@gkalpak commented on GitHub (May 18, 2018):

It works now. Thx 💯

@gkalpak commented on GitHub (May 18, 2018): It works now. Thx 💯
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#229