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

Unable to build 1.0.1 with LTO #706

Open
dvzrv opened this issue Feb 20, 2022 · 4 comments
Open

Unable to build 1.0.1 with LTO #706

dvzrv opened this issue Feb 20, 2022 · 4 comments
Labels
keep Prevent from being treated as stale and closed. Stale

Comments

@dvzrv
Copy link

dvzrv commented Feb 20, 2022

Hi! I am currently rebuilding cni-plugins as a package for Arch Linux. In the meantime we have switched to LTO by default (which can be switched off per package).
Unfortunately this fails with cni-plugins:

Building plugins
  bandwidth
# github.com/containernetworking/plugins/plugins/meta/bandwidth
_cgo_callers: relocation target x_cgo_callers not defined
_cgo_init: relocation target x_cgo_init not defined
_cgo_mmap: relocation target x_cgo_mmap not defined
_cgo_munmap: relocation target x_cgo_munmap not defined
_cgo_notify_runtime_init_done: relocation target x_cgo_notify_runtime_init_done not defined
_cgo_sigaction: relocation target x_cgo_sigaction not defined
_cgo_thread_start: relocation target x_cgo_thread_start not defined
runtime._cgo_setenv: relocation target x_cgo_setenv not defined
runtime._cgo_unsetenv: relocation target x_cgo_unsetenv not defined
runtime.cgo_yield: relocation target _cgo_yield not defined
.rela: relocation target _cgo_yield not defined
.rela: relocation target x_cgo_setenv not defined
.rela: relocation target x_cgo_unsetenv not defined
.rela: relocation target x_cgo_init not defined
.rela: relocation target x_cgo_thread_start not defined
.rela: relocation target x_cgo_notify_runtime_init_done not defined
.rela: relocation target x_cgo_callers not defined
.rela: relocation target x_cgo_mmap not defined
.rela: relocation target x_cgo_munmap not defined
.rela: relocation target x_cgo_sigaction not defined`

Full build log:
cni-plugins-1.0.1-build.log

We are currently building the plugins as follows:

  export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
  export CGO_LDFLAGS="${LDFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  ./build_linux.sh

Here CFLAGS, CPPFLAGS, CXXFLAGS and LDFLAGS are our distribution wide build flags.

Is this intentional or a bug?

archlinux-github pushed a commit to archlinux/svntogit-community that referenced this issue Feb 20, 2022
As netavark is now in the repositories, we have two providers of container-network-stack,
so we add container-network-stack to provides.
Disable LTO, as the plugins seem not compatible with it:
containernetworking/plugins#706
Update the info around why we install to /opt/cni/bin as well.
Remove unneeded explicit installation of /opt/cni/bin.
Update maintainer info.

git-svn-id: file:///srv/repos/svn-community/svn@1135253 9fca08f4-af9d-4005-b8df-a31f2cc04f65
archlinux-github pushed a commit to archlinux/svntogit-community that referenced this issue Feb 20, 2022
As netavark is now in the repositories, we have two providers of container-network-stack,
so we add container-network-stack to provides.
Disable LTO, as the plugins seem not compatible with it:
containernetworking/plugins#706 
Update the info around why we install to /opt/cni/bin as well.
Remove unneeded explicit installation of /opt/cni/bin.
Update maintainer info.

git-svn-id: file:///srv/repos/svn-community/svn@1135253 9fca08f4-af9d-4005-b8df-a31f2cc04f65
@github-actions github-actions bot added the Stale label Apr 22, 2022
@dvzrv
Copy link
Author

dvzrv commented Jan 17, 2023

@dcbw this problem is still around with 1.2.0.

Using a stale bot to hide this problem is not really great, as it means that this is likely never going to be fixed and actively discourages people to even report bugs 😢

@squeed
Copy link
Member

squeed commented Jan 17, 2023

Yeah, I suspect I need to tweak the stale bot's settings :-/. It's nice to have some old things cleaned out but it's too aggressive.

(FYI I added a "keep" label for things that shouldn't go stale).

@squeed squeed reopened this Jan 17, 2023
@squeed squeed added the keep Prevent from being treated as stale and closed. label Jan 17, 2023
@squeed
Copy link
Member

squeed commented Jan 17, 2023

@dvzrv none of us have enough go internals knowledge to fix this; do you know someone who could help out?

@invidian
Copy link

It seems to me with 1.3.0 enabling LTO builds just fine, so perhaps this can be closed?

In case you try it @dvzrv, perhaps you can also add -X github.com/containernetworking/plugins/pkg/utils/buildversion.BuildVersion=${pkgver}' flag, so binaries show version properly:

$ /opt/cni/bin/bandwidth -v
CNI bandwidth plugin version unknown
CNI protocol versions supported: 0.3.0, 0.3.1, 0.4.0, 1.0.0

Similar issue to microsoft/azurelinux#6339.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keep Prevent from being treated as stale and closed. Stale
Projects
None yet
Development

No branches or pull requests

3 participants