fix: Don't static link agent binary (FIPS requirement) #738
Merged
Conversation
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
Collaborator
Author
|
Failure logs for a static build github.com/argoproj-labs/argocd-agent/principal/registration
github.com/argoproj-labs/argocd-agent/principal/apis/eventstream
github.com/argoproj-labs/argocd-agent/agent
github.com/argoproj-labs/argocd-agent/principal/apis/auth
github.com/argoproj-labs/argocd-agent/principal
github.com/argoproj-labs/argocd-agent/cmd/argocd-agent
# github.com/argoproj-labs/argocd-agent/cmd/argocd-agent
/usr/lib/golang/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/gcc -m64 -Wl,-z,now -Wl,-z,nocopyreloc -Wl,--build-id=0x10f70f367127f3ab3649cab44380b06a267f8c59 -o $WORK/b001/exe/a.out -static -Wl,--compress-debug-sections=zlib /tmp/go-link-4108206518/go.o /tmp/go-link-4108206518/000000.o /tmp/go-link-4108206518/000001.o /tmp/go-link-4108206518/000002.o /tmp/go-link-4108206518/000003.o /tmp/go-link-4108206518/000004.o /tmp/go-link-4108206518/000005.o /tmp/go-link-4108206518/000006.o /tmp/go-link-4108206518/000007.o /tmp/go-link-4108206518/000008.o /tmp/go-link-4108206518/000009.o /tmp/go-link-4108206518/000010.o /tmp/go-link-4108206518/000011.o /tmp/go-link-4108206518/000012.o /tmp/go-link-4108206518/000013.o /tmp/go-link-4108206518/000014.o /tmp/go-link-4108206518/000015.o /tmp/go-link-4108206518/000016.o /tmp/go-link-4108206518/000017.o /tmp/go-link-4108206518/000018.o /tmp/go-link-4108206518/000019.o /tmp/go-link-4108206518/000020.o /tmp/go-link-4108206518/000021.o /tmp/go-link-4108206518/000022.o /tmp/go-link-4108206518/000023.o /tmp/go-link-4108206518/000024.o /tmp/go-link-4108206518/000025.o /tmp/go-link-4108206518/000026.o /tmp/go-link-4108206518/000027.o /tmp/go-link-4108206518/000028.o /tmp/go-link-4108206518/000029.o /tmp/go-link-4108206518/000030.o /tmp/go-link-4108206518/000031.o /tmp/go-link-4108206518/000032.o /tmp/go-link-4108206518/000033.o /tmp/go-link-4108206518/000034.o /tmp/go-link-4108206518/000035.o /tmp/go-link-4108206518/000036.o /tmp/go-link-4108206518/000037.o /tmp/go-link-4108206518/000038.o /tmp/go-link-4108206518/000039.o /tmp/go-link-4108206518/000040.o /tmp/go-link-4108206518/000041.o /tmp/go-link-4108206518/000042.o /tmp/go-link-4108206518/000043.o /tmp/go-link-4108206518/000044.o /tmp/go-link-4108206518/000045.o /tmp/go-link-4108206518/000046.o /tmp/go-link-4108206518/000047.o /tmp/go-link-4108206518/000048.o /tmp/go-link-4108206518/000049.o /tmp/go-link-4108206518/000050.o /tmp/go-link-4108206518/000051.o -O2 -g -lresolv -O2 -g -lpthread -O2 -g -O2 -g -ldl -pthread -O2 -g -ldl -no-pie -static
/usr/bin/ld: cannot find -lresolv
/usr/bin/ld: have you installed the static version of the resolv library ?
/usr/bin/ld: cannot find -lc
/usr/bin/ld: have you installed the static version of the c library ?
collect2: error: ld returned 1 exit status
make: *** [Makefile:189: argocd-agent] Error 1
subprocess exited with status 2
subprocess exited with status 2
Error: building at STEP "RUN . /cachi2/cachi2.env && CGO_ENABLED=1 GOEXPERIMENT=strictfipsruntime GO_TAGS=strictfipsruntime GO_MOD=mod make argocd-agent BIN_NAME_AGENT=argocd-agent": exit status 2
|
anandf
approved these changes
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The static link flag in the Makefile is causing downstream build failures, as we cannot build static binaries for FIPS. In the agent Makefile, the
-staticflag is forced, which prevents it from being overridden when calling the make target from the Dockerfile.We need to allow overriding
LDFLAGSso that the-staticflag can be removed or skipped. One way to achieve this is by dropping the override at https://github.com/argoproj-labs/argocd-agent/blob/840b84916eea783f3f0c9208ab31b770b55aaa84/Makefile#L64.This would allow us to supply
LDFLAGSfrom the CLI while still benefiting from the next override statement that adds the version information.For now, I have reverted the change made in #620.