mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: How to use MUSL without installing it?
Date: Tue, 4 Sep 2018 08:27:20 -0400	[thread overview]
Message-ID: <20180904122720.GZ1878@brightrain.aerifal.cx> (raw)
In-Reply-To: <20180904152012.ba537d4bb4d775753bfe8f72@asm32.info>

On Tue, Sep 04, 2018 at 03:20:12PM +0300, John Found wrote:
> On Tue, 4 Sep 2018 13:58:28 +0200
> Szabolcs Nagy <nsz@port70.net> wrote:
> 
> > * John Found <johnfound@asm32.info> [2018-09-04 14:34:39 +0300]:
> > > On Tue, 4 Sep 2018 11:40:20 +0200
> > > Szabolcs Nagy <nsz@port70.net> wrote:
> > > > i think you can pass 'CROSS_COMPILE=' to configure
> > > > and then you don't need such symlinks.
> > > > 
> > > What value should I set CROSS_COMPILE to? i386?
> > > 
> > 
> > leave it empty (by default it is '386-')
> > ./configure --host=i386 CROSS_COMPILE=
> > 
> > > Well, I will keep it the right way then. BTW, "make install"
> > > tries to create symlink for ld-musl-i386.so in /usr/lib/ directory
> > > How to prevent this attempt?
> > 
> > if you don't use dynamic linking then --disable-shared
> > 
> > if you want to build dynamic linked executables that work
> > locally with your musl install, but not portable to other
> > musl systems then --syslibdir='$(prefix)/lib'
> > (then the binaries will use that path for the dynamic linker)
> > 
> > if you want to build dynamic linked executables that are
> > portable, but don't run locally, then ignore that failure
> > (it is not fatal, binaries will have standard dynamic linker
> > path, but your system will not have it set up)
> > 
> > if you want to build dynamic linked executables that are
> > portable and work locally, then you must have the dynamic
> > linker in /lib so you have to put the symlink there.
> 
> Thanks for this detailed explanation. It is very helpful.
> 
> Actually I am using dynamic linked executables, 
> but I am setting the interpreter section to 
> relative path: "./ld-musl-i386.so" and shiping
> a portable package with my executable, sqlite3.so and 
> ld-musl-i386.so in one directory. This way providing 
> running on 64bit systems without installed 32bit libraries.

This won't work -- a relative path is relative to the current working
directory, not the location of the executable. If you want users to be
able to invoke your program normally, you need to just provide a
wrapper script that does something like

	exec $(basedir)/ld-musl-i386.so --library-path ... -- $(basedir)/your_program.bin "$@"

I'm actually working on a design to allow direct invocation of
dynamic-linked programs without absolute dynamic linker paths, but it
will be a while before it's done and included in musl.

Rich


  reply	other threads:[~2018-09-04 12:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-03 20:24 John Found
2018-09-04  9:40 ` Szabolcs Nagy
2018-09-04 11:34   ` John Found
2018-09-04 11:58     ` Szabolcs Nagy
2018-09-04 12:20       ` John Found
2018-09-04 12:27         ` Rich Felker [this message]
2018-09-04 12:39           ` John Found
2018-09-04 14:30             ` Rich Felker
2018-09-04 13:00           ` Jon Chesterfield
2018-09-04 14:38             ` Rich Felker
2018-09-04 13:27       ` John Found

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180904122720.GZ1878@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).