* [musl] Absolute symlink breaks cross compilation
@ 2020-01-17 23:24 Андрей Аладьев
2020-01-18 4:29 ` Khem Raj
2020-01-18 5:14 ` Rich Felker
0 siblings, 2 replies; 5+ messages in thread
From: Андрей Аладьев @ 2020-01-17 23:24 UTC (permalink / raw)
To: musl
[-- Attachment #1.1: Type: text/plain, Size: 247 bytes --]
Hello. Gentoo users find that it is not possible to cross compile musl. See
here https://bugs.gentoo.org/645626 more details.
I am sending to you proposed patch that is related to upstream. Please keep
all installed symlinks relative. Thank you.
[-- Attachment #1.2: Type: text/html, Size: 340 bytes --]
[-- Attachment #2: relative_libc_symlink.musl.patch --]
[-- Type: text/x-patch, Size: 520 bytes --]
diff --git a/Makefile b/Makefile
index bd8f5c38..81bf33d5 100644
--- a/Makefile
+++ b/Makefile
@@ -209,7 +209,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/include/%
$(INSTALL) -D -m 644 $< $@
$(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
- $(INSTALL) -D -l $(libdir)/libc.so $@ || true
+ $(INSTALL) -D -l $$(realpath --no-symlinks --relative-to=$$(dirname $@) $(DESTDIR)$(libdir)/libc.so) $@ || true
install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [musl] Absolute symlink breaks cross compilation
2020-01-17 23:24 [musl] Absolute symlink breaks cross compilation Андрей Аладьев
@ 2020-01-18 4:29 ` Khem Raj
2020-01-18 5:14 ` Rich Felker
1 sibling, 0 replies; 5+ messages in thread
From: Khem Raj @ 2020-01-18 4:29 UTC (permalink / raw)
To: musl
On Fri, Jan 17, 2020 at 6:19 PM Андрей Аладьев <aladjev.andrew@gmail.com> wrote:
>
> Hello. Gentoo users find that it is not possible to cross compile musl. See here https://bugs.gentoo.org/645626 more details.
>
> I am sending to you proposed patch that is related to upstream. Please keep all installed symlinks relative. Thank you.
In yocto we are carrying slightly different patch to achieve same
https://github.com/kraj/musl/commit/102f35b194a3405b30001ff08cfd54752179376f
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [musl] Absolute symlink breaks cross compilation
2020-01-17 23:24 [musl] Absolute symlink breaks cross compilation Андрей Аладьев
2020-01-18 4:29 ` Khem Raj
@ 2020-01-18 5:14 ` Rich Felker
2020-01-18 19:27 ` Khem Raj
1 sibling, 1 reply; 5+ messages in thread
From: Rich Felker @ 2020-01-18 5:14 UTC (permalink / raw)
To: musl
On Sat, Jan 18, 2020 at 02:24:49AM +0300, Андрей Аладьев wrote:
> Hello. Gentoo users find that it is not possible to cross compile musl. See
> here https://bugs.gentoo.org/645626 more details.
>
> I am sending to you proposed patch that is related to upstream. Please keep
> all installed symlinks relative. Thank you.
> diff --git a/Makefile b/Makefile
> index bd8f5c38..81bf33d5 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -209,7 +209,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/include/%
> $(INSTALL) -D -m 644 $< $@
>
> $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
> - $(INSTALL) -D -l $(libdir)/libc.so $@ || true
> + $(INSTALL) -D -l $$(realpath --no-symlinks --relative-to=$$(dirname $@) $(DESTDIR)$(libdir)/libc.so) $@ || true
>
> install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
>
I don't understand what you mean by it "breaks cross compilation". The
ldso link produced is not used for compiling anything; it's only used
for executing programs, which you don't do when cross compiling musl
or cross compiling applications against it. The link is setup to be
installed on the $host, not to be used on the $build where it's not
needed.
Could you could explain what specifically you're trying to do that's
not working as desired?
Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [musl] Absolute symlink breaks cross compilation
2020-01-18 5:14 ` Rich Felker
@ 2020-01-18 19:27 ` Khem Raj
2020-01-18 21:54 ` Rich Felker
0 siblings, 1 reply; 5+ messages in thread
From: Khem Raj @ 2020-01-18 19:27 UTC (permalink / raw)
To: musl
On Fri, Jan 17, 2020 at 9:15 PM Rich Felker <dalias@libc.org> wrote:
>
> On Sat, Jan 18, 2020 at 02:24:49AM +0300, Андрей Аладьев wrote:
> > Hello. Gentoo users find that it is not possible to cross compile musl. See
> > here https://bugs.gentoo.org/645626 more details.
> >
> > I am sending to you proposed patch that is related to upstream. Please keep
> > all installed symlinks relative. Thank you.
>
> > diff --git a/Makefile b/Makefile
> > index bd8f5c38..81bf33d5 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -209,7 +209,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/include/%
> > $(INSTALL) -D -m 644 $< $@
> >
> > $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
> > - $(INSTALL) -D -l $(libdir)/libc.so $@ || true
> > + $(INSTALL) -D -l $$(realpath --no-symlinks --relative-to=$$(dirname $@) $(DESTDIR)$(libdir)/libc.so) $@ || true
> >
> > install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
> >
>
> I don't understand what you mean by it "breaks cross compilation". The
> ldso link produced is not used for compiling anything; it's only used
> for executing programs, which you don't do when cross compiling musl
> or cross compiling applications against it. The link is setup to be
> installed on the $host, not to be used on the $build where it's not
> needed.
>
> Could you could explain what specifically you're trying to do that's
> not working as desired?
>
If you look at commit msg
for https://github.com/kraj/musl/commit/102f35b194a3405b30001ff08cfd54752179376f
then you will see the usecase we have in for Yocto/OE
> Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [musl] Absolute symlink breaks cross compilation
2020-01-18 19:27 ` Khem Raj
@ 2020-01-18 21:54 ` Rich Felker
0 siblings, 0 replies; 5+ messages in thread
From: Rich Felker @ 2020-01-18 21:54 UTC (permalink / raw)
To: musl
On Sat, Jan 18, 2020 at 11:27:43AM -0800, Khem Raj wrote:
> On Fri, Jan 17, 2020 at 9:15 PM Rich Felker <dalias@libc.org> wrote:
> >
> > On Sat, Jan 18, 2020 at 02:24:49AM +0300, Андрей Аладьев wrote:
> > > Hello. Gentoo users find that it is not possible to cross compile musl. See
> > > here https://bugs.gentoo.org/645626 more details.
> > >
> > > I am sending to you proposed patch that is related to upstream. Please keep
> > > all installed symlinks relative. Thank you.
> >
> > > diff --git a/Makefile b/Makefile
> > > index bd8f5c38..81bf33d5 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -209,7 +209,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/include/%
> > > $(INSTALL) -D -m 644 $< $@
> > >
> > > $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
> > > - $(INSTALL) -D -l $(libdir)/libc.so $@ || true
> > > + $(INSTALL) -D -l $$(realpath --no-symlinks --relative-to=$$(dirname $@) $(DESTDIR)$(libdir)/libc.so) $@ || true
> > >
> > > install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
> > >
> >
> > I don't understand what you mean by it "breaks cross compilation". The
> > ldso link produced is not used for compiling anything; it's only used
> > for executing programs, which you don't do when cross compiling musl
> > or cross compiling applications against it. The link is setup to be
> > installed on the $host, not to be used on the $build where it's not
> > needed.
> >
> > Could you could explain what specifically you're trying to do that's
> > not working as desired?
> >
>
> If you look at commit msg
> for https://github.com/kraj/musl/commit/102f35b194a3405b30001ff08cfd54752179376f
>
> then you will see the usecase we have in for Yocto/OE
OK. So it's specifically execution of target binaries via qemu-user
that's broken.
The above patch isn't suitable because it introduces a dependency on a
nonstandard utility, GNU realpath, and thereby breaks cross compiling
of musl from non-GNU-like systems. It also might introduce
dependencies of the staged-area symlink structure into the link
contents.
I'd probably be happy with a solution that involves a make or shell
expression to convert $(syslibdir) into a suitable number of
repetitions of ../ to prepend to $(libdir)/libc.so, but I'm mildly
concerned about whether there may be setups with symlinks where this
breaks.
There's also always been a school of thought that the direction of the
symlink should be reversed, so that libc.so is the symlink and ldso is
the actual file, but I believe I tried to do this at least once and
ran into reasons it was problematic. I'd have to go dig up old
conversations to try to remember why...
Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-01-18 21:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-17 23:24 [musl] Absolute symlink breaks cross compilation Андрей Аладьев
2020-01-18 4:29 ` Khem Raj
2020-01-18 5:14 ` Rich Felker
2020-01-18 19:27 ` Khem Raj
2020-01-18 21:54 ` Rich Felker
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).