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

bpftool: Fix failure with static linkage #4739

Closed

Conversation

kernel-patches-daemon-bpf-rc[bot]
Copy link

Pull request for series with
subject: bpftool: Fix failure with static linkage
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=914710

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: e2f0791
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=914710
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: e2f0791
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=914710
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: dff8470
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=914710
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: dff8470
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=914710
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: dd42e01
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=914710
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: e10500b
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=914710
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: e10500b
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=914710
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: e10500b
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=914710
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: d6212d8
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=914710
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 442bc81
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=914710
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 82c1f13
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=914710
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 4d33dc1
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=914710
version: 1

When building perf with static linkage:

  make O=/build LDFLAGS="-static" -C tools/perf VF=1 DEBUG=1
  ...
  LINK    /build/util/bpf_skel/.tmp/bootstrap/bpftool
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_compress':
  (.text+0x113): undefined reference to `ZSTD_createCCtx'
  /usr/bin/ld: (.text+0x2a9): undefined reference to `ZSTD_compressStream2'
  /usr/bin/ld: (.text+0x2b4): undefined reference to `ZSTD_isError'
  /usr/bin/ld: (.text+0x2db): undefined reference to `ZSTD_freeCCtx'
  /usr/bin/ld: (.text+0x5a0): undefined reference to `ZSTD_compressStream2'
  /usr/bin/ld: (.text+0x5ab): undefined reference to `ZSTD_isError'
  /usr/bin/ld: (.text+0x6b9): undefined reference to `ZSTD_freeCCtx'
  /usr/bin/ld: (.text+0x835): undefined reference to `ZSTD_freeCCtx'
  /usr/bin/ld: (.text+0x86f): undefined reference to `ZSTD_freeCCtx'
  /usr/bin/ld: (.text+0x91b): undefined reference to `ZSTD_freeCCtx'
  /usr/bin/ld: (.text+0xa12): undefined reference to `ZSTD_freeCCtx'
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_decompress':
  (.text+0xbfc): undefined reference to `ZSTD_decompress'
  /usr/bin/ld: (.text+0xc04): undefined reference to `ZSTD_isError'
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_decompress_elf':
  (.text+0xd45): undefined reference to `ZSTD_decompress'
  /usr/bin/ld: (.text+0xd4d): undefined reference to `ZSTD_isError'
  collect2: error: ld returned 1 exit status

Building bpftool with static linkage also fails with the same errors:

  make O=/build -C tools/bpf/bpftool/ V=1

To fix the issue, explicitly link libzstd.

Signed-off-by: Leo Yan <[email protected]>
Tested-by: Namhyung Kim <[email protected]>
@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 6e8ba49
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=914710
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=914710 expired. Closing PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant