bazel-contrib / bazel-contrib/rules_foreign_cc

cmake toolchain archive tools issues

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

Description

While building a big Cmake Project (Qt6) with cmake() rule the following error occurs:

**CMake Error: archive_write_header: Raw format only supports filetype AE_IFREG**
CMake Error at src/corelib/CMakeLists.txt:1236 (file):
file failed to compress:
/private/var/tmp/_bazel_im/ef20e9a172588342b056f208aba834f5/sandbox/darwin-sandbox/48/execroot/Qt/bazel-out/darwin_arm64-fastbuild/bin/qtbase.build_tmpdir/src/corelib/.rcc/qmimeprovider_database.cpp.archive

This appears to be caused by improper packaging of the bundled Cmake in intermediary source files fast compression described here:

https://gitlab.kitware.com/cmake/cmake/-/issues/21552
https://bugreports.qt.io/browse/QTBUG-89108

Platform: Apple Silicon(M1)
rules_foreign_cc versions tested: 0.3.0 - 0.9.0
Reproduction:
WORKSPACE:
```
workspace(name = "Qt")
load("@bazel_tools//tools/build_defs/repo:http.bzl","http_archive")
http_archive(
name = "rules_foreign_cc",
strip_prefix = "rules_foreign_cc-0.9.0",
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.9.0.tar.gz",
)
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
rules_foreign_cc_dependencies()

all_content = """filegroup(
name = "all_srcs",
srcs = glob(["**"]),
visibility = ["//visibility:public"]
)
"""
http_archive(
name = "md4c",
build_file_content = all_content,
strip_prefix = "md4c-master",
urls = ["https://github.com/mity/md4c/archive/refs/heads/master.zip"]
)
http_archive(
name = "qt",
build_file_content = all_content,
strip_prefix = "qtbase-6.4",
urls = ["https://github.com/qt/qtbase/archive/refs/heads/6.4.zip"],
)
```
BUILD:
```
cmake(
name = "md4c",
build_args = [
"--verbose",
"--", # <- Pass remaining options to the native tool.
"-j 12",
"-l 8"],
cache_entries = {
"CMAKE_BUILD_TYPE" : "Release",
"BUILD_SHARED_LIBS" : "ON"
},
lib_source = "@md4c//:all_srcs",
out_shared_libs = select({
"@platforms//os:osx" : [ "libmd4c.dylib"],
"@platforms//os:linux" : ["libmd4c.so"],
"@platforms//os:windows" : ["libmd4c.dll"],
"//conditions:default" : []
}),
install = True,
)
cmake(
name = "qtbase",
build_args = [
"--verbose",
"--",
"-j 12",
"-l 8"],
cache_entries = {
"CMAKE_PREFIX_PATH" : "/usr/local",
"BUILD_SHARED_LIBS" : "ON",
# "FEATURE_system_zlib" : "OFF",
"FEATURE_framework" : "OFF",
#"QT_USE_CCACHE" : "ON",
# "QT_BUILD_TESTS" : "ON",
},
deps = [":ccache", ":md4c"],
# generate_args = ["-GNinja"],
out_include_dir = "include",
lib_source = "@qt//:all_srcs",
install = True,
)
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure using the provided WORKSPACE and BUILD examples on Apple Silicon, then inspect the rules_foreign_cc CMake toolchain and archive-handling path involved by the cmake() rule. Compare the behavior with the linked CMake and Qt reports; done means the archive error has a confirmed resolution or a clearly documented limitation and workaround.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.