[MacPorts] #60611: go: Undefined symbols _macports_legacy_sysconf

MacPorts noreply at macports.org
Mon Jan 25 18:53:09 UTC 2021


#60611: go: Undefined symbols _macports_legacy_sysconf
---------------------------------+-----------------------
  Reporter:  Wowfunhappy         |      Owner:  ci42
      Type:  defect              |     Status:  assigned
  Priority:  Normal              |  Milestone:
 Component:  ports               |    Version:
Resolution:                      |   Keywords:  mavericks
      Port:  go, legacy-support  |
---------------------------------+-----------------------

Comment (by Ionic):

 I finally was able to enable some debugging to my go build (after locally
 debugging and fixing errors when using the "-x" go flag for days...) and
 here's finally the gist:

 {{{
 :info:build os/user
 :info:build mkdir -p $WORK/b035/
 :info:build cd
 /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_go/go/work/go/src/os/user
 :info:build CGO_LDFLAGS='"-g" "-O2"'
 /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_go/go/work/go/pkg/tool/darwin_amd64/cgo
 -objdir $WORK/b035/ -importpath os/user -- -I $WORK/b035/ -g -O2
 ./cgo_lookup_unix.go ./getgrouplist_darwin.go ./listgroups_unix.go
 :info:build cd $WORK/b035
 :info:build TERM='dumb' /usr/bin/clang -I
 /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_go/go/work/go/src/os/user
 -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-
 length=0 -gno-record-gcc-switches -fno-common -I ./ -g -O2 -o ./_x001.o -c
 _cgo_export.c
 :info:build TERM='dumb' /usr/bin/clang -I
 /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_go/go/work/go/src/os/user
 -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-
 length=0 -gno-record-gcc-switches -fno-common -I ./ -g -O2 -o ./_x002.o -c
 cgo_lookup_unix.cgo2.c
 :info:build TERM='dumb' /usr/bin/clang -I
 /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_go/go/work/go/src/os/user
 -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-
 length=0 -gno-record-gcc-switches -fno-common -I ./ -g -O2 -o ./_x003.o -c
 getgrouplist_darwin.cgo2.c
 :info:build TERM='dumb' /usr/bin/clang -I
 /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_go/go/work/go/src/os/user
 -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-
 length=0 -gno-record-gcc-switches -fno-common -I ./ -g -O2 -o ./_x004.o -c
 listgroups_unix.cgo2.c
 :info:build TERM='dumb' /usr/bin/clang -I
 /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_go/go/work/go/src/os/user
 -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-
 length=0 -gno-record-gcc-switches -fno-common -I ./ -g -O2 -o
 ./_cgo_main.o -c _cgo_main.c
 :info:build cd
 /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_go/go/work/go/src/os/user
 :info:build TERM='dumb' /usr/bin/clang -I . -fPIC -m64 -pthread -fno-
 caret-diagnostics -Qunused-arguments -fmessage-length=0 -gno-record-gcc-
 switches -fno-common -o $WORK/b035/_cgo_.o $WORK/b035/_cgo_main.o
 $WORK/b035/_x001.o $WORK/b035/_x002.o $WORK/b035/_x003.o
 $WORK/b035/_x004.o -g -O2
 :info:build # os/user
 :info:build Undefined symbols for architecture x86_64:
 :info:build   "_macports_legacy_sysconf", referenced from:
 :info:build       __cgo_a722341dd114_Cfunc_sysconf in _x002.o
 :info:build ld: symbol(s) not found for architecture x86_64
 :info:build clang: error: linker command failed with exit code 1 (use -v
 to see invocation)
 }}}

 As already suspected, I can now say for sure that external linking is not
 done for this package, leading to an error. Also, I can finally see what
 exactly is being executed, so that's helpful. Maybe.

 It seems that all cgo-based packages are not using the "usual" external
 linker LDFLAGS we pass it.

 The fix, luckily, seems to be easy.

 I'll push it once I confirm that it works with the newest version.

-- 
Ticket URL: <https://trac.macports.org/ticket/60611#comment:15>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list