Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dlb: upgrade to 8.8 #33834

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

dlb: upgrade to 8.8 #33834

wants to merge 1 commit into from

Conversation

daixiang0
Copy link
Member

Commit Message: Upgrade libdlb to 8.8
Additional Description:
Risk Level: Low
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

@repokitteh-read-only repokitteh-read-only bot added the deps Approval required for changes to Envoy's external dependencies label Apr 28, 2024
Copy link

CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to (bazel/.*repos.*\.bzl)|(bazel/dependency_imports\.bzl)|(api/bazel/.*\.bzl)|(.*/requirements\.txt)|(.*\.patch).
envoyproxy/dependency-shepherds assignee is @moderation

🐱

Caused by: #33834 was opened by daixiang0.

see: more, trace.

@daixiang0 daixiang0 changed the title dlb: upgrade to 8.8 [WIP] dlb: upgrade to 8.8 Apr 28, 2024
@daixiang0 daixiang0 marked this pull request as draft April 28, 2024 06:25
@daixiang0
Copy link
Member Author

daixiang0 commented Apr 28, 2024

Now the latest layout is like:

dlb
├── driver
│   └── dlb2
│       ├── user.h
└── libdlb
    ├── Makefile

I want to run make under libdlb dir and it depends on driver/dlb2/user.h.

I can not use filegroup() to include the user.h since it would make bazel cannot find Makefile.

I also tried to copy this header file into libdlb dir, but failed to find a way to do it.

@phlax is there a way to do it?

@daixiang0 daixiang0 marked this pull request as ready for review April 28, 2024 08:23
Copy link
Contributor

@adisuissa adisuissa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/wait

bazel/repositories_extra.bzl Outdated Show resolved Hide resolved
contrib/dlb/source/BUILD Show resolved Hide resolved
contrib/contrib_build_config.bzl Outdated Show resolved Hide resolved
@adisuissa adisuissa self-assigned this Apr 29, 2024
ci/do_ci.sh Outdated Show resolved Hide resolved
@phlax phlax marked this pull request as draft April 29, 2024 13:03
@daixiang0
Copy link
Member Author

@phlax @adisuissa sorry that I add some local changes here :(

Signed-off-by: Loong <loong.dai@intel.com>
@daixiang0 daixiang0 changed the title [WIP] dlb: upgrade to 8.8 dlb: upgrade to 8.8 May 7, 2024
@daixiang0 daixiang0 marked this pull request as ready for review May 7, 2024 02:38
@daixiang0
Copy link
Member Author

I try to move files into one dir by Bazel and fail, so I just move the file by patch.

@@ -16,7 +16,6 @@ envoy_contrib_package()
make(
name = "dlb",
env = {"DLB_DISABLE_DOMAIN_SERVER": "TRUE"},
includes = [],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than patching the whole file in could you do as i suggested offline, add a filegroup for the includes directory, and then add it here - ie @intel_dlb//:libdlb_includes

Copy link
Member Author

@daixiang0 daixiang0 May 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I tried it but fail:

--- a/bazel/repositories.bzl
+++ b/bazel/repositories.bzl
@@ -1370,6 +1370,12 @@ def _intel_dlb():
     external_http_archive(
         name = "intel_dlb",
         build_file_content = """
+filegroup(
+    name = "libdlb_header",
+    srcs = glob(["**/dlb2_user.h"]),
+    visibility = ["@envoy//contrib/dlb/source:__pkg__"],
+)
+
 filegroup(
     name = "libdlb",
     srcs = glob(["dlb/libdlb/*"]),
diff --git a/contrib/dlb/source/BUILD b/contrib/dlb/source/BUILD
index 46c28a3dad..98c12bf526 100644
--- a/contrib/dlb/source/BUILD
+++ b/contrib/dlb/source/BUILD
@@ -16,6 +16,7 @@ envoy_contrib_package()
 make(
     name = "dlb",
     env = {"DLB_DISABLE_DOMAIN_SERVER": "TRUE"},
+    includes = ["@intel_dlb//:libdlb_header"],
     lib_source = "@intel_dlb//:libdlb",
     out_static_libs = ["libdlb.a"],
     postfix_script = "mv libdlb.a $INSTALLDIR/lib && rm -rf $INSTALLDIR/include && mkdir -p $INSTALLDIR/include && cp -L *.h $INSTALLDIR/include",

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error is still not found:

+ /build/.cache/bazel/_bazel_envoybuild/b570b5ccd0454dc9af9f65ab1833764d/sandbox/processwrapper-sandbox/1/execroot/envoy/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make libdlb.a PREFIX=/build/.cache/bazel/_bazel_envoybuild/b570b5ccd0454dc9af9f65ab1833764d/sandbox/processwrapper-sandbox/1/execroot/envoy/bazel-out/k8-fastbuild/bin/contrib/dlb/source/dlb
Compiling build/dlb.o
In file included from dlb.c:25:
dlb_priv.h:15:10: fatal error: dlb2_user.h: No such file or directory
   15 | #include "dlb2_user.h"
      |          ^~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:60: build/dlb.o] Error 1
_____ END BUILD LOGS _____
rules_foreign_cc: Build wrapper script location: bazel-out/k8-fastbuild/bin/contrib/dlb/source/dlb_foreign_cc/wrapper_build_script.sh
rules_foreign_cc: Build script location: bazel-out/k8-fastbuild/bin/contrib/dlb/source/dlb_foreign_cc/build_script.sh
rules_foreign_cc: Build log location: bazel-out/k8-fastbuild/bin/contrib/dlb/source/dlb_foreign_cc/Make.log

Target //contrib/dlb/source:dlb failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.843s, Critical Path: 0.19s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess filegroup keep the dir layout so that Make cannot find it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably so - wondering what layout is expected

see here for how to mangle file paths in a filegroup https://groups.google.com/g/bazel-discuss/c/x0nyiuQ5Q44/m/r7rGSQTFHAAJ

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would raise some error:

ERROR: /build/.cache/bazel/_bazel_envoybuild/b570b5ccd0454dc9af9f65ab1833764d/external/intel_dlb/BUILD.bazel:18:9: unclosed string literal
ERROR: /build/.cache/bazel/_bazel_envoybuild/b570b5ccd0454dc9af9f65ab1833764d/external/intel_dlb/BUILD.bazel:19:1: unclosed string literal
ERROR: /build/.cache/bazel/_bazel_envoybuild/b570b5ccd0454dc9af9f65ab1833764d/external/intel_dlb/BUILD.bazel:19:1: Implicit string concatenation is forbidden, use the + operator

The generated:

genrule(
  name = 'copy_the_files',
  srcs = files,
  outs = [f.replace('the_directory', 'another_place/folder') for f in files],
  cmd = '
'.join(["mkdir -p $$(dirname $(location %s)) && cp $(location %s) $(location :%s)" % (f, f, f.replace("the_directory", "another_place/folder")) for f in files]),
)

Copy link
Member Author

@daixiang0 daixiang0 May 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I simplify the copy:

filegroup(
    name = "header",
    srcs = glob(["**/dlb2_user.h"]),
    visibility = ["@envoy//contrib/dlb/source:__pkg__"],
)

genrule(
  name = "copy",
  srcs = [":header"],
  outs = ["dlb/libdlb"],
  cmd = "set -x;cp -a $(SRCS) $(OUTS)",
)

But it turns out:

cp -a external/intel_dlb/dlb/driver/dlb2/uapi/linux/dlb2_user.h bazel-out/k8-fastbuild/bin/external/intel_dlb/dlb/libdlb

@phlax as I show it in the slack, the original layout is like:

dlb
├── driver
│   └── dlb2
│       ├── user.h
└── libdlb

what I want is like:

dlb     
└── libdlb
        └── user.h

The genrule cannot operate the "external" dir since it is remote for genrule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deps Approval required for changes to Envoy's external dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants