From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13180 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: How to use MUSL without installing it? Date: Tue, 4 Sep 2018 08:27:20 -0400 Message-ID: <20180904122720.GZ1878@brightrain.aerifal.cx> References: <20180903232441.0c0e1e868bac54e3b9b31226@asm32.info> <20180904094020.GM4418@port70.net> <20180904143439.121b6867f3e7fb99d4f1b527@asm32.info> <20180904115828.GN4418@port70.net> <20180904152012.ba537d4bb4d775753bfe8f72@asm32.info> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1536063931 15589 195.159.176.226 (4 Sep 2018 12:25:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 4 Sep 2018 12:25:31 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-13196-gllmg-musl=m.gmane.org@lists.openwall.com Tue Sep 04 14:25:27 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1fxAOc-0003vT-7t for gllmg-musl@m.gmane.org; Tue, 04 Sep 2018 14:25:26 +0200 Original-Received: (qmail 3217 invoked by uid 550); 4 Sep 2018 12:27:33 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 3195 invoked from network); 4 Sep 2018 12:27:33 -0000 Content-Disposition: inline In-Reply-To: <20180904152012.ba537d4bb4d775753bfe8f72@asm32.info> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:13180 Archived-At: On Tue, Sep 04, 2018 at 03:20:12PM +0300, John Found wrote: > On Tue, 4 Sep 2018 13:58:28 +0200 > Szabolcs Nagy wrote: > > > * John Found [2018-09-04 14:34:39 +0300]: > > > On Tue, 4 Sep 2018 11:40:20 +0200 > > > Szabolcs Nagy 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