Skip to content

Instantly share code, notes, and snippets.

@zzamboni
Last active January 30, 2021 21:27
Show Gist options
  • Save zzamboni/405e464ae056f9dadd94410d6d4cf9dc to your computer and use it in GitHub Desktop.
Save zzamboni/405e464ae056f9dadd94410d6d4cf9dc to your computer and use it in GitHub Desktop.
[~/D/P/d/g/s/g/e/elvish]─[⎇ master]|> make get
CGO_ENABLED=0 go get -buildmode=pie -trimpath -ldflags \
"-X src.elv.sh/pkg/buildinfo.VersionSuffix=-dev.$(git rev-parse HEAD)$(git diff --quiet || { echo -n '+'; uname -n; }) \
-X src.elv.sh/pkg/buildinfo.Reproducible=true" ./cmd/elvish
# src.elv.sh/cmd/elvish
/usr/local/Cellar/go/1.15.7/libexec/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
Undefined symbols for architecture x86_64:
"_CFArrayGetCount", referenced from:
_crypto/x509/internal/macos.x509_CFArrayGetCount_trampoline in go.o
"_CFArrayGetValueAtIndex", referenced from:
_crypto/x509/internal/macos.x509_CFArrayGetValueAtIndex_trampoline in go.o
"_CFDataGetBytePtr", referenced from:
_crypto/x509/internal/macos.x509_CFDataGetBytePtr_trampoline in go.o
"_CFDataGetLength", referenced from:
_crypto/x509/internal/macos.x509_CFDataGetLength_trampoline in go.o
"_CFDictionaryGetValueIfPresent", referenced from:
_crypto/x509/internal/macos.x509_CFDictionaryGetValueIfPresent_trampoline in go.o
"_CFEqual", referenced from:
_crypto/x509/internal/macos.x509_CFEqual_trampoline in go.o
"_CFNumberGetValue", referenced from:
_crypto/x509/internal/macos.x509_CFNumberGetValue_trampoline in go.o
"_CFRelease", referenced from:
_crypto/x509/internal/macos.x509_CFRelease_trampoline in go.o
"_CFStringCreateWithBytes", referenced from:
_crypto/x509/internal/macos.x509_CFStringCreateWithBytes_trampoline in go.o
"_SecItemExport", referenced from:
_crypto/x509/internal/macos.x509_SecItemExport_trampoline in go.o
"_SecPolicyCopyProperties", referenced from:
_crypto/x509/internal/macos.x509_SecPolicyCopyProperties_trampoline in go.o
"_SecTrustSettingsCopyCertificates", referenced from:
_crypto/x509/internal/macos.x509_SecTrustSettingsCopyCertificates_trampoline in go.o
"_SecTrustSettingsCopyTrustSettings", referenced from:
_crypto/x509/internal/macos.x509_SecTrustSettingsCopyTrustSettings_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)
make: *** [get] Error 2
Exception: make exited with 2
[tty 26], line 1: make get
### EDIT Makefile to remove CGO_ENABLED=0 ###
[~/D/P/d/g/s/g/e/elvish]─[⎇ master]─[●]|> git diff
Makefile
───┐
1: │
───┘
1 ⋮ 1 │default: test get
2 ⋮ 2 │
3 ⋮ 3 │get:
4 ⋮ │ CGO_ENABLED=0 go get -buildmode=pie -trimpath -ldflags \
⋮ 4 │ go get -buildmode=pie -trimpath -ldflags \
5 ⋮ 5 │ "-X src.elv.sh/pkg/buildinfo.VersionSuffix=-dev.$$(git rev-parse HEAD)$$(git diff --quiet || { echo -n '+'; uname -n; }) \
6 ⋮ 6 │ -X src.elv.sh/pkg/buildinfo.Reproducible=true" ./cmd/elvish
7 ⋮ 7 │
[~/D/P/d/g/s/g/e/elvish]─[⎇ master]─[●]|> make get
### A different error now! ###
go get -buildmode=pie -trimpath -ldflags \
"-X src.elv.sh/pkg/buildinfo.VersionSuffix=-dev.$(git rev-parse HEAD)$(git diff --quiet || { echo -n '+'; uname -n; }) \
-X src.elv.sh/pkg/buildinfo.Reproducible=true" ./cmd/elvish
# src.elv.sh/cmd/elvish
usage: link [options] main.o
-B note
add an ELF NT_GNU_BUILD_ID note when using ELF
-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 address
set text segment address (default -1)
-V print version and exit
-X definition
add string value definition of the form importpath.name=value
-a no-op (deprecated)
-benchmark string
set to 'mem' or 'cpu' to enable phase benchmarking
-benchmarkprofile base
emit phase profiles to base_phase.{cpu,mem}prof
-buildid id
record id as Go toolchain build id
-buildmode mode
set build mode
-c dump call graph
-compressdwarf
compress DWARF if possible (default true)
-cpuprofile file
write cpu profile to file
-d disable dynamic executable
-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
-go115newobj
use new object file format (default true)
-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 dump symbol table
-o file
write output to file
-pluginpath string
full path name for plugin
-r path
set the ELF dynamic linker search path to dir1:dir2:...
-race
enable race detector
-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
-u reject unsafe packages
-v print link trace
-w disable DWARF generation
make: *** [get] Error 2
Exception: make exited with 2
[tty 28], line 1: make get
#### Commit the change #####
[~/D/P/d/g/s/g/e/elvish]─[⎇ master]─[●]|> git ci -m 'Testing' -a
[master 9d4b4a51] Testing
1 file changed, 1 insertion(+), 1 deletion(-)
#### And now it works ####
[~/D/P/d/g/s/g/e/elvish]─[⎇ master]─[⬆]|> make get
go get -buildmode=pie -trimpath -ldflags \
"-X src.elv.sh/pkg/buildinfo.VersionSuffix=-dev.$(git rev-parse HEAD)$(git diff --quiet || { echo -n '+'; uname -n; }) \
-X src.elv.sh/pkg/buildinfo.Reproducible=true" ./cmd/elvish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment