-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[RFC/tracking issue] deprecating -lib32 multilib system #27337
Comments
In general this seems like a great idea. Are there any issues with rpaths in this scheme? I believe there are at least a few packages that install executables or shared libs that rely on rpaths to find some dependencies. Of course, if they are hard coded in a way that breaks your proposal, they would probably be broken under the current i686 multilib anyway... |
if there are they are already broken in the current scheme, but things with rpaths don't need to concern us much since the whole 32-bit multilib thing is largely for compatibility libraries, it is rare that you'd use it for 32-bit programs (and most of these should still be okay even then) |
Seems pretty good all around. Standardizing the existing lib32/64 setup while pointing the multilib component to a separate prefix is a pragmatic approach that still leaves room for flexibility. I do want to address the prefix location thing: cross toolchain prefixes are weird because they have libraries for the prefix arch in |
yeah the cross prefix unification thing is just an idea but not something we necessarily have to do it also has other problems, e.g. gccgo's libgo in crossprefix is built with a dummy static libucontext on musl so it probably does not work, and the libc is built with a partial compiler and sometimes lower optimization level so we likely do not actually want to run anything relying on the crosstoolchain's target libs :P |
This initial setup will be rather clunky, since it's not really possible to derive the repo path from whatever is configured in Just as a note for something that may not be immediately obvious, the reason we need the A few concerns that came to mind now were:
At least one package that I know of is aspell. EDIT: I was mistaken about aspell, it did put the files in |
Packages that receive special treatment for i686 (due to multilib) and should be fixed (like #27291) for this project to work (I will be updating this list as I find them; feel free to edit. checks will be added when the package has been fixed and rebuilt):
|
Our 32bit nvidia packages are created manually, we'd have to figure out how to make them work. For this, we could try to build the nvidia stuff inside a i686 masterdir and make packages only with the libraries, without the DKMS module. |
I just did this on an mkdir -p /usr/armv7l/etc/xbps.d
echo "repository=https://mirrors.servercentral.com/voidlinux/current" > /usr/armv7l/etc/xbps.d/00-repository-main.conf
XBPS_ARCH=armv7l xbps-install -S -C /usr/armv7l/etc/xbps.d retroarch mesa-dri
rm -rf /usr/lib32 && ln -s armv7l/usr/lib /usr/lib32
ln -s /usr/armv7l/usr/lib/ld-2.30.so /usr/lib/ld-linux-armhf.so.3
/usr/armv7l/usr/bin/retroarch We could wrap this in a simple script that derives |
Issues become stale 90 days after last activity and are closed 14 days after that. If this issue is still relevant bump it or assign it. |
We'd certainly like to keep this going, I'm going to exempt this from bot actions with the request label, its not quite the right label, but its the quick fix I have right now. |
So, right now we have a system in place that works like this:
i686
packages, andi686
specifically and only, libraries are taken and special-32bit
packages are also generated forx86_64
in the specialmultilib/
repository, whether it's just libraries or full package is then controlled via the mode and so onx86_64
ones and not conflict,i686
packages are usually configured to use/usr/lib32
and all other packages are configured to use/usr/lib
; through hooks, we make sure everything ends up in/usr/lib
in the end, except the-lib32
packages which are populated intolib32
(this is also needed in case programs, e.g. mesa, dynamically load library plugins from somewhere else)i686
on glibc, and only works withx86_64
on glibcx86_64
andi686
targets cannot be separatedlib32
/lib64
symlinks did not exist in unconfigured chroots, so toolchains had to be configured to always use dynamic linkers fromlib
and that was terrible and ABI breaking, but has since been mitigated and will be fully put into place with gcc10 upgrade; we could fix this because/usr/lib64
is now a symlink to/usr/lib
on 64-bit systems, and/usr/lib32
is a symlink to/usr/lib
on 32-bit systems, and these symlinks are a part ofbase-files
, alwaysProposed new system
Therefore, I am proposing a new system. The goals of this system should be:
There are distributions, mainly Debian, that solve this by having a complete multiarch system in place. That involves having support for handling multiple architectures at once in their package manager, and having everything built in a way that
/usr/lib
is never used directly, but rather libraries use a special prefix that contains the target triplet, so there are never conflicts. While I considered implementing such system in Void, it quickly turned out to be too large of a can of worms, without that much benefit, which would also require a considerable amount of effort put everywhere. So, instead I am proposing what I call multilib prefixes, which is a simplified, generalized system that only handles the common case of running 32-bit processes on 64-bit systems (or alternatively, 64-bit processes on systems running 64-bit kernel with 32-bit userland).How do multilib prefixes work?
Before explaining how this is going to work, I'm going to describe the steps needed to get there, it will make it easier. The ones marked so are already done.
lib32
on 32-bit systems andlib64
on 64-bit systems, unconditionally (this is actually not truly important, as the real libdir is handled separately by build systems, but still, for correctness)xbps-src
to allowlib64
paths in addition tolib32
, by fixing thexbps-src
hooksglibc
(done) and other related base bits (crosstoolchains and so on) to uselib32
andlib64
instead oflib
build-style
need to be fixed to follow this (uselib${XBPS_TARGET_WORDSIZE}
), and all templates that explicitly setlib32
oni686
need to be generalized (e.g.mesa
,pulseaudio
and so on; these generally load plugins at runtime, so the path is important there; for most programs, it's not, since library paths are not written in executables/shared libs, only names are, and the lookup paths are controlled by dynamic linker)gcc
is updated to 10 and so on - we already did this for most known things, others will be done as they are foundmusl
, we will need to ship custom/etc/ld-musl-ARCHITECTURE.path
which will override the default dynlinker search paths to use the appropriatelib32
orlib64
ones -musl
by default always useslib
glibc
, this can be (and already is, though a bit by accident) handled byld.so.conf.d
musl
to always use/usr/share/locale
Now, to get to how it works, and also why it works.
For one, the
/usr/lib
path we currently use will be preserved. This is becausexbps-src
is already updated to intercept anything installing intolib32
orlib64
and properly migrating it tolib
using symlinks. This is important.On 64-bit systems,
base-files
contains symlinks so that e.g./usr/lib64
points to/usr/lib
. Similar thing happens forlib32
on 32-bit systems. However, since the build systems and so on will automatically default tolib32
orlib64
, all library lookups will happen through those symlinks, and not through the actual path. What does this mean?In order to deal with the case of 32-bit binaries on 64-bit systems, all we have to do is simply create a new Void "root". Let's say this root will be
/usr/i686-linux-gnu
. This root will contain all the usual files. So your 32-bit libraries will be located in/usr/i686-linux-gnu/usr/lib
.How to install things into this prefix? That is easy; you can just use
xbps-install
. For example,XBPS_ARCH=i686 xbps-install -r /usr/i686-linux-gnu ...
. That means you will be able to make use of the entire standard 32-bit repo without any special handling. This is in fact howxbps-src
already managesmakedepends
when cross-compiling.What is needed now is to hook this prefix into your system. Since 64-bit systems will use
lib64
and 32-bit ones will uselib32
for lookups, they are non-conflicting. Therefore, what you can do is make your/usr/lib32
a symlink to/usr/i686-linux-gnu/usr/lib
. And that's it; if you run any 32-bit process in your 64-bit system, it will look up its libraries through/usr/lib32
, which will point to your custom prefix, containing all the dependencies.If you think about it, that's not very different from how the current 32bit libs are handled. It's just generalized, and does not use any special tooling.
Of course, this is actually not going to work as is, out of box. There is also the dynamic linker to take care of. This dynamic linker does not always respect
lib32
paths or whatever, so it's going to be slightly more involved. Notably onmusl
, dynamic linker always comes from/lib
. E.g./lib/ld-musl-i686.so.1
.However, the dynamic linkers are the one thing where we are sure there will never be file conflicts. Therefore, you can just symlink the dynamic linker from your multilib prefix to the path where it's expected to be, and everything will just work.
And that is basically the gist of it; there is nothing much more complicated about it conceptually. Of course, there are issues we need to work out, because in practice it's not as smooth.
Problems
/usr/<target-triplet>
as the default multilib prefix, it will conflict with cross-toolchains. What we could do is integrate this with managing of cross-toolchains on your host system and make them a lot more useful. However, cross-toolchains also provide the libc and other packages that would otherwise be installed. Inxbps-src
,cross-vpkg-dummy
is installed.xbps
as it is is fairly clunky, because by default these prefixes don't have repos set up in them and so on. Especially initial setup is relatively involved. Another problem is making sure the symlinks are properly set up, forlib32
(orlib64
) as well as the dynamic linker symlinks if necessary. The hypothetical management tool could deal with this automatically, besides providing functionality for installing the packages into the prefix./usr/lib32
is actually not a symlink on 64-bit systems, but a directory. This is because/usr/lib32/locale
is a symlink, to your native locale data. We would need to replace that. This is actually a glibc-only problem; application locale data go in/usr/share/locale
but glibc puts some autogenerated files in/usr/lib/locale
which need to be shared./usr/share
. These need to be found, and such files need to go to/usr/lib(32|64)
. This is the right thing to do either way, since they're no different from binary files,/usr/share
should only contain architecture-independent data.foo-libs
, for example). This is not a hard requirement, but since multilib prefixes should generally only contain libraries and data files are useless, it might reduce how much disk space we waste./usr/bin
, probably upon user request.There might be more issues to work out, these are just ones I can think of right now. I think all of them are solvable, so we should be able to make a concept like this into reality sometime in near future, and deprecate/remove the current multilib repos.
@void-linux/pkg-committers
The text was updated successfully, but these errors were encountered: