[MacPorts] #60611: go: Undefined symbols _macports_legacy_sysconf

MacPorts noreply at macports.org
Fri Jul 10 01:23:57 UTC 2020


#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 erikbs):

 Thanks, adding

 {{{
 #define __DISABLE_MP_LEGACY_SUPPORT_SYSCONF_WRAP__ 1
 }}}

 (note the value, `1`) immediately after

 {{{
 #define _MACPORTS_LEGACYSUPPORTDEFS_H_
 }}}

 in `MacportsLegacySupport.h` allowed me to compile go successfully on
 10.9.5.

 I did, however, encounter some problems with the recommended environment
 variables, i.e.:


 {{{
 GO_EXTLINK_ENABLED="1"
 GO_LDFLAGS="\"-extldflags=-L/opt/local/lib
 -Wl,-headerpad_max_install_names -lMacportsLegacySupport\""
 }}}

 For some reason `go run` does not seem to honor them and just spits out
 the following error:

 {{{
 # command-line-arguments
 /opt/local/lib/go/pkg/tool/darwin_amd64/link: running /usr/bin/clang
 failed: exit status 1
 Undefined symbols for architecture x86_64:
   "_fdopendir$INODE64", referenced from:
       _syscall.libc_fdopendir_trampoline in go.o
 ld: symbol(s) not found for architecture x86_64
 clang: error: linker command failed with exit code 1 (use -v to see
 invocation)
 }}}

 Passing the values through the `-ldflags` parameter instead does seem to
 work, at least with a [https://medium.com/rungo/how-to-write-a-simple-go-
 program-13fd104f3018 simple test program]:

 {{{
 go run -ldflags "-linkmode external -extldflags \"-L/opt/local/lib
 -Wl,-headerpad_max_install_names -lMacportsLegacySupport\"" hello.go
 }}}

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


More information about the macports-tickets mailing list