MCPcopy Index your code
hub / github.com/jetify-com/devbox / setGcc

Method setGcc

internal/patchpkg/patch.go:70–94  ·  view source on GitHub ↗

setGlibc configures the patcher to use the standard C++ and gcc libraries in pkg.

(pkg *packageFS)

Source from the content-addressed store, hash-verified

68// setGlibc configures the patcher to use the standard C++ and gcc libraries in
69// pkg.
70func (p *libPatcher) setGcc(pkg *packageFS) error {
71 // Verify that we can find a directory with libstdc++.so in it.
72 glob := "lib*/libstdc++.so*"
73 matches, _ := fs.Glob(pkg, glob)
74 if len(matches) == 0 {
75 return fmt.Errorf("cannot find libstdc++.so file matching %q", glob)
76 }
77 for i := range matches {
78 matches[i] = path.Dir(matches[i])
79 }
80 // Pick the shortest name: lib < lib32 < lib64 < libx32
81 //
82 // - lib is usually a symlink to the correct arch (e.g., lib -> lib64)
83 // - *.so is usually a symlink to the correct version (e.g., foo.so -> foo.so.2)
84 slices.Sort(matches)
85
86 lib, err := pkg.OSPath(matches[0])
87 if err != nil {
88 return err
89 }
90 p.rpath = append(p.rpath, lib)
91 p.needed = append(p.needed, "libstdc++.so")
92 slog.Debug("found new libstdc++ directory", "path", lib)
93 return nil
94}
95
96func (p *libPatcher) prependRPATH(libPkg *packageFS) {
97 glob := "lib*/*.so*"

Callers 1

initMethod · 0.80

Calls 1

OSPathMethod · 0.80

Tested by

no test coverage detected