bazel-contrib / bazel-contrib/rules_foreign_cc

Configure directory structure of $EXT_BUILD_DEPS

Open
#418 16 comments 3 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
737
Forks
270
PR merge metrics
No merged PRs in 30d

Description

When I pass a few other Bazel dependencies into `cmake_external(.. deps = [...])`, all of the headers seem to be copied into $`EXT_BUILD_DEPS/include` and libraries to `$EXT_BUILD_DEPS/lib`. However, the directory structure is destroyed. If the dependency creates `external/org_dependency/include/core/platform/utils/foo.h`, then this is just symlinked as `$EXT_BUILD_DEPS/include/foo.h`. This creates a problem because my source code that I'm trying to compile wants to `#include "core/platform/utils/foo.h"`. And I really can't use $EXT_BUILD_DEPS at all because another dependency decided to create their own time.h which is creating all sorts of linker errors, as you could imagine.

Wondering if there is a way to preserve dependency structure.

Right now my workaround, which isn't quite working, is to use flags like:

```
"CMAKE_CXX_FLAGS": "-I $EXT_BUILD_ROOT/bazel-out/k8-opt/bin/external/org_tensorflow/ \
-I $EXT_BUILD_ROOT/external/org_tensorflow/ \
```

Contributor guide

Open the contributing guide

Research direction

Start by locating the implementation of cmake_external(.. deps = [...]) and how it assembles EXT_BUILD_DEPS/include and EXT_BUILD_DEPS/lib. Reproduce the nested-header case with core/platform/utils/foo.h and verify how the current workaround flags resolve dependencies. Done means dependency directory structure is preserved without collisions such as time.h.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.