bazel-contrib / bazel-contrib/rules_foreign_cc

cmake not copy directory correct

Open
#1,010 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

A depend B, notic B include directory struct is include/*.h , include/mysql/*.h, cmake not copy mysql director to mysqlcppconn-static.ext_build_deps/include, so cannot find include file, because file was included "#include

A build file
```

filegroup(
name = "all_srcs",
srcs = glob(["**"]),
)

cmake(
name = "mysqlcppconn-static",
build_args = [
"-j6",
],
build_data = [
"@mysqlclient//:mysqlclient-bin",
],
cache_entries = {
"MYSQL_DIR": "$$EXT_BUILD_DEPS$$",
! #"MYSQL_INCLUDE_DIR": "$$EXT_BUILD_DEPS$$/include",
! "MYSQL_LIB_DIR": "$$EXT_BUILD_DEPS$$/lib",
+ "MYSQL_VERSION": "5.7.16",
+ "MYSQL_VERSION_ID": "50716",
+ #"MYSQL_CONFIG_EXECUTABLE": "$$(location @mysqlclient//:mysqlclient-bin)/mysql-config$$",
+ #"MYSQLCLIENT_STATIC_LINKING": "1", # if want link dymamic, .so file cannot be a symbol link if bazel compile use sancbox
+ #"BOOST_ROOT": "$$EXT_BUILD_DEPS$$",
"CMAKE_ENABLE_C++11": "ON",
},
_ copts = [
"-std=c++11",
],
generate_args = [],
lib_source = ":all_srcs",
linkopts = [
"-pthread",
],
out_static_libs = [
"libmysqlcppconn-static.a",
],
visibility = ["//visibility:public"],
_8 deps = [
"@mysqlclient",
"@openssl//:crypto",
"@openssl//:ssl",
],
)
```

B build file
```
cc_library(
name = "mysqlclient",
srcs = glob([
"lib/*.so",
"lib/*.a",
+ ]),
+ hdrs = glob([
"include/*.h",
"include/mysql/*.h",
]),
~ includes = [
+ "include",
+ "include/mysql",
+ ],
visibility = ["//visibility:public"],
deps = [
],
)

```

Contributor guide

Open the contributing guide

Research direction

The issue shows the A and B build-file snippets and the cmake rule; start by locating those definitions and tracing how @mysqlclient's include/*.h and include/mysql/*.h are staged into mysqlcppconn-static.ext_build_deps/include. Reproduce the missing mysql/xxx.h lookup, then verify the staged directory and dependent compilation resolve the header.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.