Repository navigation
Description
meson compile -C builddir
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /usr/sbin/ninja -C /home/dimko/compiled/toolbox/builddir
ninja: Entering directory `/home/dimko/compiled/toolbox/builddir'
[1/1] Generating src/zsh-completion with a custom command (wrapped by meson to capture output)
FAILED: src/_toolbox
/usr/lib/python-exec/python3.13/meson --internal exe --capture src/_toolbox -- /usr/bin/python3.13 /home/dimko/compiled/toolbox/src/meson_generate_completions.py /home/dimko/compiled/toolbox/src zsh
--- stderr ---
/tmp/go-build2866398736/b001/exe/toolbox: symbol lookup error: /tmp/go-build2866398736/b001/exe/toolbox: undefined symbol: nvmlGpuInstanceGetComputeInstanceProfileInfoV
exit status 127
Traceback (most recent call last):
File "/home/dimko/compiled/toolbox/src/meson_generate_completions.py", line 32, in
output = subprocess.run(['go', 'run', '.', 'completion', completion_type], check=True)
File "/usr/lib/python3.13/subprocess.py", line 577, in run
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['go', 'run', '.', 'completion', 'zsh']' returned non-zero exit status 1.
ninja: build stopped: subcommand failed.
Expected behaviour
No errors after compilation attempt
Actual behaviour
as per output above
Toolbx package info (rpm -q toolbox)
compiling from source
Output of podman version
e.g.,
Version: 1.9.2
RemoteAPI Version: 1
Go Version: go1.14.2
OS/Arch: linux/amd64
Podman package info (rpm -q podman)
[ebuild R ] app-containers/podman-5.3.2::gentoo USE="seccomp systemd -apparmor -btrfs (-selinux) -wrapper" 0 KiB
Info about your OS
current one only and latest Gentoo.(ongoing release)
Additional context
Attempting to follow those instructions:
https://containertoolbx.org/install/
meson compile -C builddir
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /usr/sbin/ninja -C /home/dimko/compiled/toolbox/builddir
ninja: Entering directory `/home/dimko/compiled/toolbox/builddir'
[12/12] Generating src/zsh-completion with a custom command (wrapped by meson to capture output)
FAILED: src/_toolbox
/usr/lib/python-exec/python3.13/meson --internal exe --capture src/_toolbox -- /usr/bin/python3.13 /home/dimko/compiled/toolbox/src/meson_generate_completions.py /home/dimko/compiled/toolbox/src zsh
--- stderr ---
/home/dimko/.cache/go-build/8a/8acae153aba024568e3f0ca5d79f7f48544f8f994b124b69c9e8514ee61f787e-d/toolbox: symbol lookup error: /home/dimko/.cache/go-build/8a/8acae153aba024568e3f0ca5d79f7f48544f8f994b124b69c9e8514ee61f787e-d/toolbox: undefined symbol: nvmlGpuInstanceGetComputeInstanceProfileInfoV
exit status 127
Traceback (most recent call last):
File "/home/dimko/compiled/toolbox/src/meson_generate_completions.py", line 32, in
output = subprocess.run(['go', 'run', '.', 'completion', completion_type], check=True)
File "/usr/lib/python3.13/subprocess.py", line 577, in run
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['go', 'run', '.', 'completion', 'zsh']' returned non-zero exit status 1.
ninja: build stopped: subcommand failed.
Not sure if relevant, I have modern AMD GPU with AMDGPU drivers.(because, undefined symbol: nvmlGpuInstanceGetComputeInstanceProfileInfoV)
Activity
drjoms commentedon Aug 12, 2025
dev-lang/go-1.24.6
debarshiray commentedon Aug 12, 2025
Which version of Toolbx are you trying to compile? Are you using your own linker flags?
This error makes me think that this about the linker flags. See these two commits:
I will be away for two weeks, starting from tomorrow, so I won't be able to respond immediately.
debarshiray commentedon Sep 4, 2025
Ping.
drjoms commentedon Sep 4, 2025
I am not entirely sure how those two commits relevant to my case. I am not owning any nvidia hardware, only AMD CPU and GPU.(amdgpu driver)
I went with what was in README.
I dont think Gentoo has tinkered with settings of "ld"(I assume this is what you asked?). I certainly did not put any specific ld options.
drjoms commentedon Sep 4, 2025
i dont know if this helps
sys-devel/binutils-2.44-r4:2.44::gentoo USE="(cet) nls pgo plugins zstd -debuginfod -doc -gprofng -hardened -multitarget -static-libs -test -vanilla -xxhash" 0 KiB
debarshiray commentedon Sep 10, 2025
The code to support the proprietary NVIDIA driver is always compiled, regardless of whether the hardware is present or not. Some of it is used at runtime to find out if the hardware and the proprietary driver is present. If it's present, then the rest of it used, else not.
debarshiray commentedon Sep 10, 2025
The error above when compiling Toolbx is exactly the same as described in commit 83f28c52e47c2d44:
In your case, when you are compiling Toolbx, it's trying to run
toolbox(1)to generate the shell completions, and that's failing.You mean https://containertoolbx.org/install/ ? The upstream Toolbx CI uses the same way to build Toolbx, so it should work.
I am not familiar enough with Gentoo to dig into it and pinpoint what's exactly wrong. Right now my theory is that for some reason you are ending up using the
-z nowlinker flag.[-]failing to compile[/-][+]failing to compile because it can't lookup undefined symbol nvmlGpuInstanceGetComputeInstanceProfileInfoV[/+]drjoms commentedon Sep 17, 2025
Can you please give me an example of command that allows me to check linker settings for go programming language?(right?)
I understand that every (compiled)language can have custom flags for compilation of a specific program, due to making process?
is there a verbose way to compile toolbox?
PeakKS commentedon Sep 21, 2025
I'm also on gentoo, and I also get this issue.
If I explicitly set
-Wl,-z,lazyingo-build-wrapperthe binary inbuilddir/src/toolboxworks okay:However the on in the go build cache does not work correctly:
And since go tries to generate completions with the one in the cache, the build fails:
They list different dependencies with ldd as well.
PeakKS commentedon Sep 21, 2025
@drjoms If it helps I now have updated the toolbox ebuild in my overlay to the latest release plus the patches I have pending in #1722 : https://github.com/PeakKS/peakover/blob/master/app-containers/toolbox/toolbox-0.3.ebuild
debarshiray commentedon Sep 22, 2025
I see. Thanks for tracking this down!
Yes, the binary in the cache is broken. Containers created with it might have trouble starting.
I am curious, does the problem go away if you delete the cache or the cached binary?
fix: ensure -zlazy for systems that default to -znow
debarshiray commentedon Jun 5, 2026
I am looking into this again in the context of this pull request from @xandris The code changes look correct to me. I think we should merge it to enforce
-z lazybecause it's a hard requirement for Toolbx.Before doing that, I am trying to get a better understanding of what exactly happened here. I am unable to understand how Gentoo or any other distributor managed to disable lazy binding by default (ie., enforce
-z now) for Toolbx.As far as I can make out, GNU ld.bfd doesn't have any build-time option to change its default. Were you using some other linker? If not, the only way to make the change seems to be to pass the
-z nowoption at runtime, which will require either editing Toolbx'ssrc/go-build-wrapperor changing the defaults passed by the Go toolchain to the linker.After digging around, I came across this request to make Gentoo default to
-z now. However, the changes there are for the GCC and LLVM toolchains, not Go.xandris commentedon Jun 6, 2026
could this be due toany code that uses or imports code withgithub.com/NVIDIA/go-nvml/pkg/nvmlitself? it uses cgoimport "C"forces Go to use cgo, which uses$CC. on Gentoo, GCC has the DEF_GENTOO_ZNOW patch, affecting the linker spec.i thought CC=clang would sidestep the issue but i found this in clang-common:
Details
... host link: "clang" "-m64" "-s" "-Wl,--build-id=0x95cb0bc13341216f9aa2a0b9af945305fdbf7721" "-o" "/tmp/go-build2661240062/b001/exe/m" "-Wl,--export-dynamic-symbol=_cgo_panic" "-Wl,--export-dynamic-symbol=_cgo_topofstack" "-Wl,--export-dynamic-symbol=crosscall2" "-Qunused-arguments" "-Wl,--compress-debug-sections=zlib" "/tmp/go-link-2952583088/go.o" "/tmp/go-link-2952583088/000000.o" "/tmp/go-link-2952583088/000001.o" "/tmp/go-link-2952583088/000002.o" "/tmp/go-link-2952583088/000003.o" "/tmp/go-link-2952583088/000004.o" "/tmp/go-link-2952583088/000005.o" "/tmp/go-link-2952583088/000006.o" "/tmp/go-link-2952583088/000007.o" "/tmp/go-link-2952583088/000008.o" "/tmp/go-link-2952583088/000009.o" "/tmp/go-link-2952583088/000010.o" "/tmp/go-link-2952583088/000011.o" "/tmp/go-link-2952583088/000012.o" "/tmp/go-link-2952583088/000013.o" "/tmp/go-link-2952583088/000014.o" "/tmp/go-link-2952583088/000015.o" "/tmp/go-link-2952583088/000016.o" "-O2" "-g" "-O2" "-g" "-lpthread" "-no-pie" "-v" ... "/usr/lib/llvm/22/bin/ld.lld" -s --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o $WORK/b001/exe/m /usr/lib/gcc/x86_64-pc-linux-gnu/16/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/16/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/16/crtbegin.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/16 -L/usr/lib/gcc/x86_64-pc-linux-gnu/16/../../../../lib64 -L/lib/../lib64 -L/usr/lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/16/../../../../x86_64-pc-linux-gnu/lib -L/lib -L/usr/lib -z relro -z now --build-id=0x95cb0bc13341216f9aa2a0b9af945305fdbf7721 --export-dynamic-symbol=_cgo_panic --export-dynamic-symbol=_cgo_topofstack --export-dynamic-symbol=crosscall2 --compress-debug-sections=zlib /tmp/go-link-2952583088/go.o /tmp/go-link-2952583088/000000.o /tmp/go-link-2952583088/000001.o /tmp/go-link-2952583088/000002.o /tmp/go-link-2952583088/000003.o /tmp/go-link-2952583088/000004.o /tmp/go-link-2952583088/000005.o /tmp/go-link-2952583088/000006.o /tmp/go-link-2952583088/000007.o /tmp/go-link-2952583088/000008.o /tmp/go-link-2952583088/000009.o /tmp/go-link-2952583088/000010.o /tmp/go-link-2952583088/000011.o /tmp/go-link-2952583088/000012.o /tmp/go-link-2952583088/000013.o /tmp/go-link-2952583088/000014.o /tmp/go-link-2952583088/000015.o /tmp/go-link-2952583088/000016.o -lpthread -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-pc-linux-gnu/16/crtend.o /usr/lib/gcc/x86_64-pc-linux-gnu/16/../../../../lib64/crtn.onote that it uses
$CCto do the linking, not$LD. i think it's to get the C runtime stuff likecrt*.owithout having to reimplement the lookup logic but i don't really know. so no matter what, Go code that uses C interop is at the mercy of the host C compiler and whatever hardening efforts the vendor has done to themdrjoms commentedon Jun 6, 2026
I dont remember why i needed toolbox, i found alternative to what i needed. I have no reason to reproduce or fix issue now. May be it was specific to my installation and my fault. Closing this.
debarshiray commentedon Jun 9, 2026
Thanks for digging up the reference to Gentoo's downstream GCC build and spec file! I didn't know where to look.
This explains why we didn't see this problem in the Fedora family and other distributions so far. Fedora passes
-Wl,z,nowto theclang(1)andgcc(1)compiler drivers through theLDFLAGSenvironment variable, and Gentoo uses a Clang configuration file and a GCC spec file. The hacky and messy wiring between Meson andgo buildfilters outLDFLAGS, but not the spec or configuration file.Thanks again for the reference! It makes sense that the default Clang and GCC configurations match.
Thanks for the experiment!
I see that the Go toolchain (ie.,
gc, notgccgo) always uses theclang(1)orgcc(1)compiler drivers when external linking mode (ie.,go build -ldflags "-linkmode external"orgo tool link -linkmode external) is used.The online documentation of
go tool linkhints at this, but notgo tool link --help. It's confirmed by reading the code of go tool link, go build and friends, and the implementation notes of go tool cgo.build: Tweak the external linker flags for brevity
debarshiray commentedon Jun 9, 2026
While staring at this issue, I started wondering if we should switch to
go build -ldflags "-I $dynamic_linker"instead of the currentgo build -ldflags "-extldflags '-Wl,-dynamic-linker,$dynamic_linker' -linkmode external"to specify the runtime dynamic linker of the ELF executable (ie.,PT_INTERP).It seems slightly better because it's not tied to the external linking mode and removes one layer of indirection/quotes/wrapping. In my quick test, it seems to work. What do you think?
I wonder if
-rcan similarly replace-rpath, but I haven't tried it.[-]failing to compile because it can't lookup undefined symbol nvmlGpuInstanceGetComputeInstanceProfileInfoV[/-][+]failing to compile when C compiler driver defaults to `-z now`[/+]xandris commentedon Jun 9, 2026
that makes sense to me, no need to reinvent the plumbing that cmd/link already has
debarshiray commentedon Jun 9, 2026
Do you want to submit a pull request?
xandris commentedon Jun 9, 2026
sure i can do that when i get home :)
build: Ensure lazy binding for operating systems defaulting to '-z now'
build: Notify distributors that the '-z now' linker flag is unsupported