bazel-contrib / bazel-contrib/rules_foreign_cc

cmake debug build failed

Open
#1,041 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
737
Forks
270
PR merge metrics
No merged PRs in 30d

Description

cmake debug build will add `d` suffix by default, which is not consistent with the library name. for example

with thrift cmake rule as follows
https://github.com/apache/brpc/blob/master/bazel/third_party/thrift/thrift.BUILD#L23

run
> bazel build -c dbg //some/target/depend/on/thrift

will get
```
INFO: Found 1 target...
WARNING: Remote Cache: Expected output external/org_apache_thrift/thrift/lib/libthrift.a was not created locally.
ERROR: .cache/bazel/5f6cfd791ed6436cd7d0a9ad06515f99/external/org_apache_thrift/BUILD.bazel:23:6: output 'external/org_apache_thrift/thrift/lib/libthrift.a' was not created
ERROR: .cache/bazel/5f6cfd791ed6436cd7d0a9ad06515f99/external/org_apache_thrift/BUILD.bazel:23:6: output 'external/org_apache_thrift/thrift/lib/libthriftnb.a' was not created
ERROR: .cache/bazel/5f6cfd791ed6436cd7d0a9ad06515f99/external/org_apache_thrift/BUILD.bazel:23:6: output 'external/org_apache_thrift/thrift/lib/libthriftz.a' was not created
ERROR: .cache/bazel/5f6cfd791ed6436cd7d0a9ad06515f99/external/org_apache_thrift/BUILD.bazel:23:6: Foreign Cc - CMake: Building thrift failed: not all outputs were created or valid
Target //some/target/depend/on/thrift failed to build
Use --verbose_failures to see the command lines of failed build steps.
```

to solve this i passed `-DCMAKE_DEBUG_POSTFIX=\"\"` to the cmake attr `generate_args`

but i think cmake rule should handle this by default

Contributor guide

Open the contributing guide

Research direction

Start with the referenced bazel/third_party/thrift/thrift.BUILD rule and its CMake generate_args, then reproduce the shown bazel build -c dbg command. Check how the CMake debug postfix affects the expected thrift library outputs. Done means the debug build creates the library names expected by the rule without requiring an explicit empty CMAKE_DEBUG_POSTFIX.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.