Khem Raj <raj.k...@gmail.com> escreveu (sexta, 19/04/2024 à(s) 19:17):

> On Fri, Apr 19, 2024 at 10:53 AM Jose Quaresma via
> lists.openembedded.org
> <quaresma.jose=gmail....@lists.openembedded.org> wrote:
> >
> > This will make possible to restore the default dynamic linking globally
> > which is what we had before the 1.20.X release.
> >
>
> Looks good overall. how do we support the static linking if user wanted ?
>

To disable the dynamic linking, which is the default, we need to unset the
GO_DYNLINK
but this needs to be done with a machine arch override otherwise has no
effect.

GO_DYNLINK:machine_arch = ""

As an example the below patch enables the static linkiging for all the
architectures
https://git.yoctoproject.org/poky/commit/meta/classes-recipe/goarch.bbclass?id=fd2e5e0b89d9c69acc9f813f07cd052630596ad5

Jose


> > Signed-off-by: Jose Quaresma <jose.quare...@foundries.io>
> > ---
> >  meta/classes-recipe/go.bbclass          | 2 --
> >  meta/recipes-devtools/go/go-runtime.inc | 2 +-
> >  2 files changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/meta/classes-recipe/go.bbclass
> b/meta/classes-recipe/go.bbclass
> > index cc3564c36a..d32509aa6d 100644
> > --- a/meta/classes-recipe/go.bbclass
> > +++ b/meta/classes-recipe/go.bbclass
> > @@ -48,8 +48,6 @@ GO_RPATH:class-native = "${@'-r
> ${STAGING_LIBDIR_NATIVE}/go/pkg/${TARGET_GOTUPLE
> >  GO_RPATH_LINK:class-native =
> "${@'-Wl,-rpath-link=${STAGING_LIBDIR_NATIVE}/go/pkg/${TARGET_GOTUPLE}_dynlink'
> if d.getVar('GO_DYNLINK') else ''}"
> >  GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${GO_RPATH_LINK}
> ${LDFLAGS}"
> >  GO_LINKMODE ?= ""
> > -GO_LINKMODE:class-nativesdk = "--linkmode=external"
> > -GO_LINKMODE:class-native = "--linkmode=external"
> >  GO_EXTRA_LDFLAGS ?= ""
> >  GO_LINUXLOADER ?= "-I ${@get_linuxloader(d)}"
> >  # Use system loader. If uninative is used, the uninative loader will be
> patched automatically
> > diff --git a/meta/recipes-devtools/go/go-runtime.inc
> b/meta/recipes-devtools/go/go-runtime.inc
> > index 3f1e795dd9..413cf6d33f 100644
> > --- a/meta/recipes-devtools/go/go-runtime.inc
> > +++ b/meta/recipes-devtools/go/go-runtime.inc
> > @@ -15,7 +15,7 @@ export CGO_LDFLAGS = "${@ ' '.join(filter(lambda f:
> not f.startswith('-fdebug-pr
> >  export GOCACHE = "${B}/.cache"
> >
> >  GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}"
> > -GO_SHLIB_LDFLAGS ?= '-ldflags="--linkmode=external -extldflags
> '${GO_EXTLDFLAGS}'"'
> > +GO_SHLIB_LDFLAGS ?= '-ldflags="-extldflags '${GO_EXTLDFLAGS}'"'
> >
> >  do_configure() {
> >         :
> > --
> > 2.44.0
> >
> >
> > 
> >
>


-- 
Best regards,

José Quaresma
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#198561): 
https://lists.openembedded.org/g/openembedded-core/message/198561
Mute This Topic: https://lists.openembedded.org/mt/105623011/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to