Skip to content

Commit

Permalink
TMP: Debug CI failure
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Jun 4, 2022
1 parent fd9a38a commit 1ed2b13
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions go/tools/builders/cgo2.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ func cgo2(goenv *env, goSrcs, cgoSrcs, cSrcs, cxxSrcs, objcSrcs, objcxxSrcs, sSr
mainBin := filepath.Join(workDir, "_cgo_.o") // .o is a lie; it's an executable
args = append([]string{cc, "-o", mainBin, mainObj}, cObjs...)
args = append(args, combinedLdFlags...)
println(strings.Join(args, " "))
if err := goenv.runCommand(args); err != nil {
// If linking the binary for cgo fails, this is usually because the
// object files reference external symbols that can't be resolved yet.
Expand All @@ -204,17 +205,21 @@ func cgo2(goenv *env, goSrcs, cgoSrcs, cSrcs, cxxSrcs, objcSrcs, objcxxSrcs, sSr
// symbols - the real link that happens at the end will fail if they
// rightfully can't be resolved.
var allowUnresolvedSymbolsLdFlags []string
println(os.Getenv("GOOS"))
switch os.Getenv("GOOS") {
case "windows":
// MinGW's linker doesn't seem to support --unresolved-symbols
// and MSVC isn't supported at all.
return "", nil, nil, err
case "darwin":
case "ios":
println("darwin case")
allowUnresolvedSymbolsLdFlags = []string{"-Wl,-undefined,dynamic_lookup"}
default:
println("linux case")
allowUnresolvedSymbolsLdFlags = []string{"-Wl,--unresolved-symbols=ignore-all"}
}
println(strings.Join(append(args, allowUnresolvedSymbolsLdFlags...), " "))
if err2 := goenv.runCommand(append(args, allowUnresolvedSymbolsLdFlags...)); err2 != nil {
// Return the original error if we can't link the binary with the
// additional linker flags as they may simply be incorrect for the
Expand Down

0 comments on commit 1ed2b13

Please sign in to comment.