"DEBUG_JUJU=1 make build" fails because of extra -X

Bug #2032938 reported by Pedro Guimarães
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
Medium
Jack Shaw

Bug Description

Hi,

I've tried both Juju 3.3 and main branches and I've noticed that every time I run:

$ DEBUG_JUJU=1 make build

I get the following error:

Building github.com/juju/juju/cmd/jujuc for linux/amd64
github.com/juju/juju/cmd/jujuc
# github.com/juju/juju/cmd/jujuc
/snap/go/current/pkg/tool/linux_amd64/link: -X flag requires argument of the form importpath.name=value
make: *** [Makefile:348: /home/pguimaraes/Documents/Canonical/Engineering/DATAPLATFORM/juju/_build/linux_amd64/bin/jujuc] Error 1

That is because there is an extra -X in the Makefile:

define link_flags_version
        -X $(PROJECT)/version.GitCommit=$(GIT_COMMIT) \
        -X $(PROJECT)/version.GitTreeState=$(GIT_TREE_STATE) \
        -X $(PROJECT)/version.build=$(JUJU_BUILD_NUMBER) \
        -X $(PROJECT)/version.GoBuildTags=$(FINAL_BUILD_TAGS)
endef

# Compile with debug flags if requested.
ifeq ($(DEBUG_JUJU), 1)
    COMPILE_FLAGS = -gcflags "all=-N -l"
- LINK_FLAGS = "-X $(link_flags_version)"
+ LINK_FLAGS = "$(link_flags_version)"
        CGO_LINK_FLAGS = "-linkmode 'external' -extldflags '-static' $(link_flags_version)"
else

The change above resolves the issue.

Changed in juju:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → Jack Shaw (jack-shaw)
milestone: none → 3.3-beta2
Changed in juju:
milestone: 3.3-beta2 → 3.3-rc1
Changed in juju:
milestone: 3.3-rc1 → 3.3-rc2
Changed in juju:
milestone: 3.3-rc2 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.