Opened 4 weeks ago

Last modified 3 weeks ago

#70626 new defect

gh: Upgrading to version 2.55.0 Fails -- Invalid value for flag -extldflags

Reported by: RobK88 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.10.1
Keywords: Cc: herbygillot (Herby Gillot)
Port: gh golang

Description

The upgrade of the port gh from version 2.53.0 to version 2.55.0 fails on High Sierra.. The error is Invalid value for flag -extldflags.

bash-3.2$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.13.6
BuildVersion:	17G14042

bash-3.2$ sudo port clean gh
Password:
--->  Cleaning gh

bash-3.2$ sudo port -v upgrade gh
--->  Computing dependencies for gh.
--->  Fetching archive for gh

Etc. Etc.

go: downloading github.com/pelletier/go-toml/v2 v2.1.0
# github.com/cli/cli/v2/cmd/gh
invalid value "'-Wl,-headerpad_max_install_names" for flag -extldflags: unterminated ' string
usage: link [options] main.o
  -B note
    	add an ELF NT_GNU_BUILD_ID note when using ELF; use "gobuildid" to generate it from the Go build ID
  -E entry
    	set entry symbol name
  -H type
    	set header type
  -I linker
    	use linker as ELF dynamic linker
  -L directory
    	add specified directory to library path
  -R quantum
    	set address rounding quantum (default -1)
  -T int
    	set the start address of text symbols (default -1)
  -V	print version and exit
  -X definition
    	add string value definition of the form importpath.name=value
  -a	no-op (deprecated)
  -asan
    	enable ASan interface
  -aslr
    	enable ASLR for buildmode=c-shared on windows (default true)
  -benchmark string
    	set to 'mem' or 'cpu' to enable phase benchmarking
  -benchmarkprofile base
    	emit phase profiles to base_phase.{cpu,mem}prof
  -bindnow
    	mark a dynamically linked ELF object for immediate function binding
  -buildid id
    	record id as Go toolchain build id
  -buildmode mode
    	set build mode
  -c	dump call graph
  -capturehostobjs string
    	capture host object files loaded during internal linking to specified dir
  -checklinkname
    	check linkname symbol references (default true)
  -compressdwarf
    	compress DWARF if possible (default true)
  -cpuprofile file
    	write cpu profile to file
  -d	disable dynamic executable
  -debugnosplit
    	dump nosplit call graph
  -debugtextsize int
    	debug text section max size
  -debugtramp int
    	debug trampolines
  -dumpdep
    	dump symbol dependency graph
  -extar string
    	archive program for buildmode=c-archive
  -extld linker
    	use linker when linking in external mode
  -extldflags flags
    	pass flags to external linker
  -f	ignore version mismatch
  -g	disable go package data checks
  -h	halt on error
  -importcfg file
    	read import configuration from file
  -installsuffix suffix
    	set package directory suffix
  -k symbol
    	set field tracking symbol
  -libgcc string
    	compiler support lib for internal linking; use "none" to disable
  -linkmode mode
    	set link mode
  -linkshared
    	link against installed Go shared libraries
  -memprofile file
    	write memory profile to file
  -memprofilerate rate
    	set runtime.MemProfileRate to rate
  -msan
    	enable MSan interface
  -n	no-op (deprecated)
  -o file
    	write output to file
  -pluginpath string
    	full path name for plugin
  -pruneweakmap
    	prune weak mapinit refs (default true)
  -r path
    	set the ELF dynamic linker search path to dir1:dir2:...
  -race
    	enable race detector
  -randlayout int
    	randomize function layout
  -s	disable symbol table
  -strictdups int
    	sanity check duplicate symbol contents during object file reading (1=warn 2=err).
  -tmpdir directory
    	use directory for temporary files
  -v	print link trace
  -w	disable DWARF generation
exit status 1
build.go: building task `bin/gh` failed.
make: *** [bin/gh] Error 1
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gh/gh/work/gopath/src/github.com/cli/cli/v2'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gh/gh/work/gopath/src/github.com/cli/cli/v2" && make -w GH_VERSION=2.55.0 bin/gh manpages 
Exit code: 2
Error: Failed to build gh: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gh/gh/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.

Attachments (1)

main.log (30.7 KB) - added by RobK88 4 weeks ago.

Download all attachments as: .zip

Change History (7)

Changed 4 weeks ago by RobK88

Attachment: main.log added

comment:1 Changed 4 weeks ago by RobK88

Summary: gu: Upgrading to version 2.55.0 Fails -- Invalid value for flag -extldflagsgh: Upgrading to version 2.55.0 Fails -- Invalid value for flag -extldflags

comment:2 Changed 4 weeks ago by herbygillot (Herby Gillot)

This isn't an issue within gh's Portfile... these flags are being set by legacysupport sorcery happening in the golang portgroup.

Can you do a go version?

comment:3 Changed 4 weeks ago by RobK88

Here is the go version on this old Macbook Pro running High Sierra...

bash-3.2$ go version
go version go1.23.0 darwin/amd64

comment:4 Changed 4 weeks ago by RobK88

I see the problem...

"'-Wl,-headerpad_max_install_names" is an unterminated string. Missing a single quote.

Rob

comment:5 Changed 3 weeks ago by RobK88

I am baffled with this bug.

Below is the only place in the golang PortGroup where the -extldflags is set:

post-extract {
        build.env-append \
            "CC=[compwrap::wrap_compiler cc]" \
            "CXX=[compwrap::wrap_compiler cxx]" \
            "OBJC=[compwrap::wrap_compiler objc]" \
            "OBJCXX=[compwrap::wrap_compiler objcxx]" \
            "FC=[compwrap::wrap_compiler fc]" \
            "F90=[compwrap::wrap_compiler f90]" \
            "F77=[compwrap::wrap_compiler f77]"
        if { ${os.major} <= [option legacysupport.newest_darwin_requires_legacy] } {
            build.env-append \
                "GO_EXTLINK_ENABLED=1" \
                "BOOT_GO_LDFLAGS=-extldflags='${configure.ldflags}'" \
                "CGO_CFLAGS=${configure.cflags} [get_canonical_archflags cc]" \
                "CGO_CXXFLAGS=${configure.cxxflags} [get_canonical_archflags cxx]" \
                "CGO_LDFLAGS=${configure.cflags} ${configure.ldflags} [get_canonical_archflags ld]" \
                "GO_LDFLAGS=-extldflags='${configure.ldflags} [get_canonical_archflags ld]'"
        }

It looks okay. I do not see golang setting -extldflag to an unterminated string...

Rob

comment:6 Changed 3 weeks ago by RobK88

Port: golang added
Note: See TracTickets for help on using tickets.