bazel-contrib / rules_foreign_cc

Build rules for interfacing with "foreign" (non-Bazel) build systems (CMake, configure-make, GNU Make, boost, ninja, Meson)
https://bazel-contrib.github.io/rules_foreign_cc
Apache License 2.0
660 stars 241 forks source link

configure_make - File name too long #550

Open ivan-mudrak opened 3 years ago

ivan-mudrak commented 3 years ago

While building xz library with configure_make on macOS BigSur I got the following error:

_____ BEGIN BUILD LOGS _____

Bazel external C/C++ Rules. Building library lzma

Environment:______________
TMPDIR=/var/folders/9d/7jyrhm613cqg7slstfx8hy540000gn/T/
BUILD_WRAPPER_SCRIPT=bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma_scripts/Configure_wrapper_script.sh
EXT_BUILD_ROOT=/private/var/tmp/_bazel_ivanmudrak/f75fc8c60a9e5eb41177351c0f74c835/sandbox/darwin-sandbox/434/execroot/on_server
INSTALLDIR=/private/var/tmp/_bazel_ivanmudrak/f75fc8c60a9e5eb41177351c0f74c835/sandbox/darwin-sandbox/434/execroot/on_server/bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
PATH=/private/var/tmp/_bazel_ivanmudrak/f75fc8c60a9e5eb41177351c0f74c835/sandbox/darwin-sandbox/434/execroot/on_server:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.
BUILD_TMPDIR=/private/var/tmp/_bazel_ivanmudrak/f75fc8c60a9e5eb41177351c0f74c835/sandbox/darwin-sandbox/434/execroot/on_server/bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma.build_tmpdir
PWD=/private/var/tmp/_bazel_ivanmudrak/f75fc8c60a9e5eb41177351c0f74c835/sandbox/darwin-sandbox/434/execroot/on_server
EXT_BUILD_DEPS=/private/var/tmp/_bazel_ivanmudrak/f75fc8c60a9e5eb41177351c0f74c835/sandbox/darwin-sandbox/434/execroot/on_server/bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma.ext_build_deps
SHLVL=2
BUILD_LOG=bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma_logs/Configure.log
BUILD_SCRIPT=bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma_scripts/Configure_script.sh
_=/usr/bin/env
__________________________
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
Can not copy 
mkdir: /private/var/tmp/_bazel_ivanmudrak/f75fc8c60a9e5eb41177351c0f74c835/sandbox/darwin-sandbox/434/execroot/on_server/bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma.build_tmpdir/bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma.build_tmpdir/bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma.build_tmpdir/bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma.build_tmpdir/bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma.build_tmpdir/bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma.build_tmpdir/bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma.build_tmpdir/bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma.build_tmpdir/bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma.build_tmpdir/bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma.build_tmpdir/bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma.build_tmpdir/bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma.build_tmpdir/bazel-out/darwin-fastbuild/bin/external/lzma.dev/lzma.build_tmpdir/bazel-out/host/bin/external/rules_foreign_cc: File name too long
_____ END BUILD LOGS _____

For some reason, it creates a few nested folder levels with the same pattern.

Build file:

load("@rules_foreign_cc//tools/build_defs:configure.bzl", "configure_make")

filegroup(
    name = "lzma_files",
    srcs = glob(
        include=[
            "xz-5.2.5/**/*"
        ]
    )
)

configure_make(
    name = "lzma",
    lib_source = ":lzma_files",
    configure_in_place = True,
    autogen = True,
    static_libraries = [
        "liblzma.a"
    ],
    shared_libraries = [
        "liblzma.so"
    ],
    visibility = ["//visibility:public"]
)

WORKSPACE:

http_archive(
   name = "rules_foreign_cc",
   sha256 = "d038a5cafe5faacaa79e37ca19a30c203556844356bae89fc22147eea0fd8325",
   strip_prefix = "rules_foreign_cc-c309ec13192f69a46aaaba39587c3d7ff684eb35",
   url = "https://github.com/bazelbuild/rules_foreign_cc/archive/c309ec13192f69a46aaaba39587c3d7ff684eb35.tar.gz",
)

load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies")

rules_foreign_cc_dependencies()

...

http_archive(
    name = "lzma.dev",
    build_file = "//:lzma.BUILD.bazel",
    sha256 = "f6f4910fd033078738bd82bfba4f49219d03b17eb0794eb91efbae419f4aba10",
    strip_prefix = "xz-5.2.5",
    urls = [
        "https://tukaani.org/xz/xz-5.2.5.tar.gz",
        "https://iweb.dl.sourceforge.net/project/lzmautils/xz-5.2.5.tar.gz"],
)

I got a similar error while building secp256k1 with configure_make.

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_foreign_cc!

github-actions[bot] commented 2 years ago

This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"

tsarevfs commented 2 years ago

I have the same issue when use configure_in_place = True

BUILD:


filegroup(
    name = "source",
    srcs = [
        "config",
    ],
)

configure_make(
    name = "example",
    configure_command = "config",
    configure_in_place = False,
    lib_source = ":source",
    targets = ["hello"],
)

config:

#!/bin/bash
printf "hello:\n\techo \"hello world\"; mkdir -p example/lib  example/lib/example.a\n" > Makefile

error:

cp: cannot stat '<prefix removed>/d4d2a4ac7852ade4cdad0c6a53eb3994/sandbox/linux-sandbox/9/execroot/test_workspace/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example.build_tmpdir/bazel-out/k8-fastbuild/bin/example_foreign_cc/wrapper_build_script.sh': File name too long
daixiang0 commented 2 years ago

@ivan-mudrak @tsarevfs do you know how to fix it?

daixiang0 commented 2 years ago

@irengrig @jsharpe @jheaff1 do you know how to fix it?

Missmiaom commented 2 years ago

I have encountered this too, is there a solution?

Missmiaom commented 2 years ago

cp: cannot stat '/root/.cache/bazel/_bazelroot/0fc3f217f434c77c7876931e2f59fce0/sandbox/processwrapper-sandbox/19/execroot/main/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.buildtmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc.build_tmpdir/bazel-out/k8-fastbuild-ST-bef989340b83/bin/jemalloc__foreign_cc/wrapper_build_script.sh': File name too long

bazel version: 3.7.1