From 1ed2b136e944271e85b708343d1a418eaa2b9924 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Sat, 4 Jun 2022 15:25:34 +0200 Subject: [PATCH] TMP: Debug CI failure --- go/tools/builders/cgo2.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/go/tools/builders/cgo2.go b/go/tools/builders/cgo2.go index d6cd6a2d0e..b945370b89 100644 --- a/go/tools/builders/cgo2.go +++ b/go/tools/builders/cgo2.go @@ -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. @@ -204,6 +205,7 @@ 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 @@ -211,10 +213,13 @@ func cgo2(goenv *env, goSrcs, cgoSrcs, cSrcs, cxxSrcs, objcSrcs, objcxxSrcs, sSr 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