From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26016 invoked from network); 4 Jun 2020 19:37:58 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 4 Jun 2020 19:37:58 -0000 Received: (qmail 9493 invoked by uid 550); 4 Jun 2020 19:37:53 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 9475 invoked from network); 4 Jun 2020 19:37:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=Kt6d+Z4+tIxuqNeKCr5ghNi/PODBDC/D41nLrzQCl1o=; b=adb31SuR3ZwvkZbDOAfwqangQn4Y3+2NmEK93q3bPwCAznnYH9OGEUY0T+34MBfV5Z r3ue0nqUtHxyowoMqptMPqUxrbc8q0+qh6Df5incruO55jvmuuvpQKu1YSHrg/gPafav aHGMyb+x9lgqBLld67FHoC3WsTHhreSdBXKr9K9+i2SmW2H6SOWnr8CBmOutAaC2ZLGt rs1kSV9FHw0pPxtKBslhqO2rjjm+pn1HzwNM7VGt9MPPUo197K7eTlcVzukG37R2s4Iw tjdjHMaOEIxB3IcvEymEoXcVMhp4ru2MfRojWkiV73DpjnPJ28X1vBBH1oI2Vn3JW+hx EteQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Kt6d+Z4+tIxuqNeKCr5ghNi/PODBDC/D41nLrzQCl1o=; b=SPlw5Upj7n2OAmK3wu1lS7z27cc8jb4kFOWa/KKnwRxx723/cgcKfn7loVXiDJNOM/ PuVFvE0SgfGqbTW+GnA0oSxHfnFrSyQHNYqH3/Y2cmtvYY+vwTHt7zS69Q3kYOrLss8a lgQ8/EJsvhl3ivcC4QK7RfNKX5z05RUVYMCHKyjzP5B9gfLtj0Gtw5LkzTQmMd/ZTig+ zJua8tN8pvexzteg8k1KVCYlZ4CB7U5YbrSTXfhiV7ct7S0LBNsU7DpMIAs+D1/5Svzo z5qPWxfr/Nf686fWm+uXre45hWiQeAhzH+gSRH8dXVk8O2nlJY7gNodycWucpQuaPGW5 vjTQ== X-Gm-Message-State: AOAM532aHyyzib/MD4HHBSrpVChvBj/RC3BQKzuqfqURxDhhBPGHaghk go87aRSsgR1qZ0Vbz1GrYJYDzBR9ReA= X-Google-Smtp-Source: ABdhPJwKMYWWTL5To0//v5zz0qq4pAFp07MBuH6cMP24/SFcY8ffd8F24DLXhyOoTiowOC/hvrNQVQ== X-Received: by 2002:a2e:2e0b:: with SMTP id u11mr2943719lju.281.1591299461992; Thu, 04 Jun 2020 12:37:41 -0700 (PDT) To: Rich Felker Cc: musl@lists.openwall.com, Markus Wichmann References: <20200521152121.GA6521@voyager> <883535a2-1b26-183d-22f4-c3c158da2dbb@bell-sw.com> <20200522182555.GA1079@brightrain.aerifal.cx> <96367f9c-4b02-c512-9d46-96de9e39a059@bell-sw.com> <20200525174633.GA31470@brightrain.aerifal.cx> From: Alexander Scherbatiy Message-ID: Date: Thu, 4 Jun 2020 22:37:40 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200525174633.GA31470@brightrain.aerifal.cx> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Subject: Re: [musl] Shared library loading On 25.05.2020 20:46, Rich Felker wrote: > On Mon, May 25, 2020 at 08:26:51PM +0300, Alexander Scherbatiy wrote: >>   What is the suggested way in musl to load $libdir/myapp/libfoo.so >> from a custom directory so libbar.so can find it? > Probably putting the dir in your application's rpath (or in the rpath > of libbar). dlopen is not a tool for (effectively) adding additional > directories to the library search path. OpenJDK can have several jvm variants (like server, client, minimal). Each of variants contains its own version of libjvm.so lib.   jdk/bin/java   jdk/lib/server/libjvm.so   jdk/lib/client/libjvm.so   jdk/lib/minimal/libjvm.so When java is executed it first loads libjvm.so for the requested variant using dlopen() with RTLD_NOW | RTLD_GLOBAL flags [1] and then loads libraries from jdk/lib dir with dlopen() and RTLD_LAZY flag. To make it works with musl JDK implements workaround where it puts libjvm.so into LD_LIBRARY_PATH [2] and re-executes itself. Is there a better way to handle the case where an application with several lib variants can load common libraries without changing LD_LIBRARY_PATH? [1] https://hg.openjdk.java.net/portola/portola/file/7ff60204a181/src/java.base/unix/native/libjli/java_md_solinux.c#l590 [2] https://hg.openjdk.java.net/portola/portola/file/7ff60204a181/src/java.base/unix/native/libjli/java_md_solinux.c#l244 Thanks, Alexander. > Rich