• Wine MinGW system libraries

    From Zebediah Figura@21:1/5 to All on Sun Sep 5 03:40:02 2021
    Hello all,

    I'm a contributor to the Wine project. To summarize the following mail,
    Wine needs special versions of some of its normal dependencies, such as libfreetype and libgnutls, built using the MinGW cross-compiler, and I'm sending out a mail to major distributions in order to get some feedback
    from our packagers on how these should be built and packaged.

    For a long time Wine has built all of its Win32 libraries (DLLs and
    EXEs) as ELF binaries. For various reasons related to application compatibility, we have started building our binaries as PE instead,
    using the MinGW cross-compiler. It is our intent to expand this to some
    of our dependencies as well. The list of dependencies that we intend to
    build using MinGW is not quite fixed yet, but we expect it to include
    and be mostly limited to the following:

    * libvkd3d
    * libFAudio
    * libgnutls
    * zlib (currently included via manual source import)
    * libmpg123
    * libgsm
    * libpng
    * libjpeg-turbo
    * libtiff
    * libfreetype
    * liblcms2
    * jxrlib

    and dependencies of the above packages (not including CRT dependencies,
    which Wine provides).

    There is currently some internal discussion about how these dependencies
    should be built and linked. There are essentially three questions I see
    that need to be resolved, and while these resolutions have a significant
    impact on the Wine building and development process, they also have an
    impact on distributions, and accordingly I'd like to get input from our packagers to ensure that their considerations are accurately taken into account.

    (1) Should we build via source import, or link statically, or dynamically?

    Source imports are dispreferred by Debian [1], on the grounds that they
    cause duplication of libraries on disk and in memory, and make it harder
    to handle security updates. They also make building and bisecting
    harder. Static libraries don't seem to be expressly discouraged, but
    share most of the same downsides (see also [2]).

    Note however that if they are linked dynamically, we need to make sure
    that we load our packages instead of MinGW builds of open-source
    libraries with applications ship with. There's some internal discussion
    about whether this is possible while using "stock" builds of MinGW
    libraries, but, due to the way the Win32 loader works, we will probably
    need to compile each library, and its dependencies, with a separate, wine-specific name, e.g. "libwinefreetype-6.dll" and
    "libwineharfbuzz.dll". For a detailed explantion see footnote [3]. Note
    that all we actually need to change is the name; we don't need to patch
    the source.

    Accordingly, although static linking and source imports are generally disprefered, it may quite likely be preferable in our case. We don't get
    the benefits of on-disk deduplication, since Wine is essentially the
    only piece of software which needs these libraries.

    (2) If we use dynamic libraries, should dependencies be included in the
    main wine package, or packaged separately?

    This is mostly a question for packagers, although it also relates to (3).

    I expect that Debian will want to answer "packaged separately" here, on
    the grounds that this lets them update (say) Wine's libgnutls
    separately, and in sync with ELF libgnutls, if some security fix is
    needed. There is a snag, though: we need libraries to be copied into the
    prefix (there's some internal effort to allow using something like
    symlinks instead, but this hard and not done yet). Normally we perform
    this copy every time Wine is updated, but if Wine and its dependencies
    aren't updated on the same schedule, we may end up loading an old
    version of a dependency in the prefix.

    (3) If dependencies are packaged separately, should Wine build them as
    part of its build tree (e.g. using submodules), or find and link
    (statically or dynamically) to existing binaries?

    Linking to existing binaries is generally preferable: it avoids
    duplication on disk; it reduces compile times when compiling a single
    package from source (especially the first time). However, we aren't
    going to benefit from on-disk duplication. And, most importantly, unlike
    with ELF dependencies, there is no standardized way to locate MinGW libraries—especially if it comes to Wine-specific libraries. We would
    need a way for Wine's configure script to find these packages—and
    ideally find them automatically, or else fall back to a submodule-based approach.

    If we rely on distributions to provide our dependencies, the best idea I
    have here would be something like a x86_64-w64-mingw32-pkg-config
    (Fedora actually already ships this, but I think Fedora is the only
    one). And if we use shared libraries rather than static, things get
    worse: we need to know the exact path of each library and its
    dependencies at runtime so that we can copy (or symlink) them into a
    user's WINEPREFIX. For ELF this is the job of ld.so. For MinGW there is
    no standardized install location across distributions.


    For what it's worth, the current proposed solution (which has the
    support of the Wine maintainer) involves source imports and submodules.
    There's probably room for changing our approach even after things are committed, but I'd still like to get early feedback from distributions,
    and make sure that their interests are accurately represented, before we commit.

    ἔρρωσθε,
    Zebediah
    (she/her)

    [1] https://www.debian.org/doc/debian-policy/ch-source.html#embedded-code-copies

    [2] https://wiki.debian.org/StaticLinking

    [3] The basic problem is that applications can and often do ship with PE
    builds of cross-platform libraries. These libraries can be ahead of
    Wine's system libraries, behind them, or even built with custom patches. Accordingly we really don't want to load "our" freetype in place of
    "their" freetype, or "theirs" in place of "ours". But because of the way
    the Win32 loader works, you can generally only have one DLL of a given
    name loaded in a process, and further attempts to dlopen() [as it were] "libfreetype-6.dll" will return the handle to the already loaded
    library, potentially breaking either Wine or the application. There
    *may* be ways we can hack around this internally, but it's not clear
    that it's feasible yet, and so it's probably best to assume that we'll
    need special builds of dynamic libraries.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastien ROUCARIES@21:1/5 to All on Sun Sep 5 09:20:01 2021
    Le dim. 5 sept. 2021 à 03:34, Zebediah Figura <zfigura@codeweavers.com> a écrit :

    Hello all,

    I'm a contributor to the Wine project. To summarize the following mail,
    Wine needs special versions of some of its normal dependencies, such as libfreetype and libgnutls, built using the MinGW cross-compiler, and I'm sending out a mail to major distributions in order to get some feedback
    from our packagers on how these should be built and packaged.

    For a long time Wine has built all of its Win32 libraries (DLLs and
    EXEs) as ELF binaries. For various reasons related to application compatibility, we have started building our binaries as PE instead,
    using the MinGW cross-compiler. It is our intent to expand this to some
    of our dependencies as well. The list of dependencies that we intend to
    build using MinGW is not quite fixed yet, but we expect it to include
    and be mostly limited to the following:

    * libvkd3d
    * libFAudio
    * libgnutls
    * zlib (currently included via manual source import)
    * libmpg123
    * libgsm
    * libpng
    * libjpeg-turbo
    * libtiff
    * libfreetype
    * liblcms2
    * jxrlib

    and dependencies of the above packages (not including CRT dependencies,
    which Wine provides).

    There is currently some internal discussion about how these dependencies should be built and linked. There are essentially three questions I see
    that need to be resolved, and while these resolutions have a significant impact on the Wine building and development process, they also have an
    impact on distributions, and accordingly I'd like to get input from our packagers to ensure that their considerations are accurately taken into account.

    (1) Should we build via source import, or link statically, or dynamically?

    Source imports are dispreferred by Debian [1], on the grounds that they
    cause duplication of libraries on disk and in memory, and make it harder
    to handle security updates. They also make building and bisecting
    harder. Static libraries don't seem to be expressly discouraged, but
    share most of the same downsides (see also [2]).

    Note however that if they are linked dynamically, we need to make sure
    that we load our packages instead of MinGW builds of open-source
    libraries with applications ship with. There's some internal discussion
    about whether this is possible while using "stock" builds of MinGW
    libraries, but, due to the way the Win32 loader works, we will probably
    need to compile each library, and its dependencies, with a separate, wine-specific name, e.g. "libwinefreetype-6.dll" and
    "libwineharfbuzz.dll". For a detailed explantion see footnote [3]. Note
    that all we actually need to change is the name; we don't need to patch
    the source.

    Accordingly, although static linking and source imports are generally disprefered, it may quite likely be preferable in our case. We don't get
    the benefits of on-disk deduplication, since Wine is essentially the
    only piece of software which needs these libraries.

    (2) If we use dynamic libraries, should dependencies be included in the
    main wine package, or packaged separately?



    Improve dpkg to support partial arch. I volonteer to implement none arch
    but i am waiting from guillem here.



    This is mostly a question for packagers, although it also relates to (3).

    I expect that Debian will want to answer "packaged separately" here, on
    the grounds that this lets them update (say) Wine's libgnutls
    separately, and in sync with ELF libgnutls, if some security fix is
    needed. There is a snag, though: we need libraries to be copied into the prefix (there's some internal effort to allow using something like
    symlinks instead, but this hard and not done yet). Normally we perform
    this copy every time Wine is updated, but if Wine and its dependencies
    aren't updated on the same schedule, we may end up loading an old
    version of a dependency in the prefix.

    (3) If dependencies are packaged separately, should Wine build them as
    part of its build tree (e.g. using submodules), or find and link
    (statically or dynamically) to existing binaries?

    Linking to existing binaries is generally preferable: it avoids
    duplication on disk; it reduces compile times when compiling a single
    package from source (especially the first time). However, we aren't
    going to benefit from on-disk duplication. And, most importantly, unlike
    with ELF dependencies, there is no standardized way to locate MinGW libraries—especially if it comes to Wine-specific libraries. We would
    need a way for Wine's configure script to find these packages—and
    ideally find them automatically, or else fall back to a submodule-based approach.

    If we rely on distributions to provide our dependencies, the best idea I
    have here would be something like a x86_64-w64-mingw32-pkg-config
    (Fedora actually already ships this, but I think Fedora is the only
    one). And if we use shared libraries rather than static, things get
    worse: we need to know the exact path of each library and its
    dependencies at runtime so that we can copy (or symlink) them into a
    user's WINEPREFIX. For ELF this is the job of ld.so. For MinGW there is
    no standardized install location across distributions


    Partial arch is the solution hère.


    I can help also here


    For what it's worth, the current proposed solution (which has the
    support of the Wine maintainer) involves source imports and submodules. There's probably room for changing our approach even after things are committed, but I'd still like to get early feedback from distributions,
    and make sure that their interests are accurately represented, before we commit.

    ἔρρωσθε,
    Zebediah
    (she/her)

    [1]

    https://www.debian.org/doc/debian-policy/ch-source.html#embedded-code-copies

    [2] https://wiki.debian.org/StaticLinking

    [3] The basic problem is that applications can and often do ship with PE builds of cross-platform libraries. These libraries can be ahead of
    Wine's system libraries, behind them, or even built with custom patches. Accordingly we really don't want to load "our" freetype in place of
    "their" freetype, or "theirs" in place of "ours". But because of the way
    the Win32 loader works, you can generally only have one DLL of a given
    name loaded in a process, and further attempts to dlopen() [as it were] "libfreetype-6.dll" will return the handle to the already loaded
    library, potentially breaking either Wine or the application. There
    *may* be ways we can hack around this internally, but it's not clear
    that it's feasible yet, and so it's probably best to assume that we'll
    need special builds of dynamic libraries.



    <div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le dim. 5 sept. 2021 à 03:34, Zebediah Figura &lt;<a href="mailto:zfigura@codeweavers.com">zfigura@codeweavers.com</a>&gt; a écrit :<br></div><blockquote class="
    gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello all,<br>

    I&#39;m a contributor to the Wine project. To summarize the following mail, <br>
    Wine needs special versions of some of its normal dependencies, such as <br> libfreetype and libgnutls, built using the MinGW cross-compiler, and I&#39;m <br>
    sending out a mail to major distributions in order to get some feedback <br> from our packagers on how these should be built and packaged.<br>

    For a long time Wine has built all of its Win32 libraries (DLLs and <br>
    EXEs) as ELF binaries. For various reasons related to application <br> compatibility, we have started building our binaries as PE instead, <br>
    using the MinGW cross-compiler. It is our intent to expand this to some <br>
    of our dependencies as well. The list of dependencies that we intend to <br> build using MinGW is not quite fixed yet, but we expect it to include <br>
    and be mostly limited to the following:<br>

    * libvkd3d<br>
    * libFAudio<br>
    * libgnutls<br>
    * zlib (currently included via manual source import)<br>
    * libmpg123<br>
    * libgsm<br>
    * libpng<br>
    * libjpeg-turbo<br>
    * libtiff<br>
    * libfreetype<br>
    * liblcms2<br>
    * jxrlib<br>

    and dependencies of the above packages (not including CRT dependencies, <br> which Wine provides).<br>

    There is currently some internal discussion about how these dependencies <br> should be built and linked. There are essentially three questions I see <br> that need to be resolved, and while these resolutions have a significant <br> impact on the Wine building and development process, they also have an <br> impact on distributions, and accordingly I&#39;d like to get input from our <br>
    packagers to ensure that their considerations are accurately taken into <br> account.<br>

    (1) Should we build via source import, or link statically, or dynamically?<br>

    Source imports are dispreferred by Debian [1], on the grounds that they <br> cause duplication of libraries on disk and in memory, and make it harder <br> to handle security updates. They also make building and bisecting <br>
    harder. Static libraries don&#39;t seem to be expressly discouraged, but <br> share most of the same downsides (see also [2]).<br>

    Note however that if they are linked dynamically, we need to make sure <br> that we load our packages instead of MinGW builds of open-source <br>
    libraries with applications ship with. There&#39;s some internal discussion <br>
    about whether this is possible while using &quot;stock&quot; builds of MinGW <br>
    libraries, but, due to the way the Win32 loader works, we will probably <br> need to compile each library, and its dependencies, with a separate, <br> wine-specific name, e.g. &quot;libwinefreetype-6.dll&quot; and <br> &quot;libwineharfbuzz.dll&quot;. For a detailed explantion see footnote [3]. Note <br>
    that all we actually need to change is the name; we don&#39;t need to patch <br>
    the source.<br>

    Accordingly, although static linking and source imports are generally <br> disprefered, it may quite likely be preferable in our case. We don&#39;t get <br>
    the benefits of on-disk deduplication, since Wine is essentially the <br>
    only piece of software which needs these libraries.<br>

    (2) If we use dynamic libraries, should dependencies be included in the <br> main wine package, or packaged separately?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">Improve dpkg to support partial arch. I volonteer to implement none arch but i am waiting from guillem here.</div><
    div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

    This is mostly a question for packagers, although it also relates to (3).<br>

    I expect that Debian will want to answer &quot;packaged separately&quot; here, on <br>
    the grounds that this lets them update (say) Wine&#39;s libgnutls <br> separately, and in sync with ELF libgnutls, if some security fix is <br> needed. There is a snag, though: we need libraries to be copied into the <br> prefix (there&#39;s some internal effort to allow using something like <br> symlinks instead, but this hard and not done yet). Normally we perform <br> this copy every time Wine is updated, but if Wine and its dependencies <br> aren&#39;t updated on the same schedule, we may end up loading an old <br> version of a dependency in the prefix.<br>

    (3) If dependencies are packaged separately, should Wine build them as <br> part of its build tree (e.g. using submodules), or find and link <br> (statically or dynamically) to existing binaries?<br>

    Linking to existing binaries is generally preferable: it avoids <br> duplication on disk; it reduces compile times when compiling a single <br> package from source (especially the first time). However, we aren&#39;t <br> going to benefit from on-disk duplication. And, most importantly, unlike <br> with ELF dependencies, there is no standardized way to locate MinGW <br> libraries—especially if it comes to Wine-specific libraries. We would <br> need a way for Wine&#39;s configure script to find these packages—and <br> ideally find them automatically, or else fall back to a submodule-based <br> approach.<br>

    If we rely on distributions to provide our dependencies, the best idea I <br> have here would be something like a x86_64-w64-mingw32-pkg-config <br>
    (Fedora actually already ships this, but I think Fedora is the only <br>
    one). And if we use shared libraries rather than static, things get <br>
    worse: we need to know the exact path of each library and its <br>
    dependencies at runtime so that we can copy (or symlink) them into a <br> user&#39;s WINEPREFIX. For ELF this is the job of ld.so. For MinGW there is <br>
    no standardized install location across distributions<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Partial arch is the solution hère.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">I can help also here</
    <div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

    For what it&#39;s worth, the current proposed solution (which has the <br> support of the Wine maintainer) involves source imports and submodules. <br> There&#39;s probably room for changing our approach even after things are <br> committed, but I&#39;d still like to get early feedback from distributions, <br>
    and make sure that their interests are accurately represented, before we <br> commit.<br>

    ἔρρωσθε,<br>
    Zebediah<br>
    (she/her)<br>

    [1] <br>
    <a href="https://www.debian.org/doc/debian-policy/ch-source.html#embedded-code-copies" rel="noreferrer noreferrer" target="_blank">https://www.debian.org/doc/debian-policy/ch-source.html#embedded-code-copies</a><br>

    [2] <a href="https://wiki.debian.org/StaticLinking" rel="noreferrer noreferrer" target="_blank">https://wiki.debian.org/StaticLinking</a><br>

    [3] The basic problem is that applications can and often do ship with PE <br> builds of cross-platform libraries. These libraries can be ahead of <br> Wine&#39;s system libraries, behind them, or even built with custom patches. <br>
    Accordingly we really don&#39;t want to load &quot;our&quot; freetype in place of <br>
    &quot;their&quot; freetype, or &quot;theirs&quot; in place of &quot;ours&quot;. But because of the way <br>
    the Win32 loader works, you can generally only have one DLL of a given <br> name loaded in a process, and further attempts to dlopen() [as it were] <br> &quot;libfreetype-6.dll&quot; will return the handle to the already loaded <br> library, potentially breaking either Wine or the application. There <br>
    *may* be ways we can hack around this internally, but it&#39;s not clear <br> that it&#39;s feasible yet, and so it&#39;s probably best to assume that we&#39;ll <br>
    need special builds of dynamic libraries.<br>

    </blockquote></div></div></div>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Kitt@21:1/5 to All on Sun Sep 5 18:20:02 2021
    Hi Zebediah,

    On Sat, 4 Sep 2021 20:17:53 -0500, Zebediah Figura <zfigura@codeweavers.com> wrote:
    I'm a contributor to the Wine project. To summarize the following mail,
    Wine needs special versions of some of its normal dependencies, such as libfreetype and libgnutls, built using the MinGW cross-compiler, and I'm sending out a mail to major distributions in order to get some feedback
    from our packagers on how these should be built and packaged.

    For a long time Wine has built all of its Win32 libraries (DLLs and
    EXEs) as ELF binaries. For various reasons related to application compatibility, we have started building our binaries as PE instead,
    using the MinGW cross-compiler. It is our intent to expand this to some
    of our dependencies as well. The list of dependencies that we intend to build using MinGW is not quite fixed yet, but we expect it to include
    and be mostly limited to the following:

    * libvkd3d
    * libFAudio
    * libgnutls
    * zlib (currently included via manual source import)
    * libmpg123
    * libgsm
    * libpng
    * libjpeg-turbo
    * libtiff
    * libfreetype
    * liblcms2
    * jxrlib

    and dependencies of the above packages (not including CRT dependencies, which Wine provides).

    There is currently some internal discussion about how these dependencies should be built and linked. There are essentially three questions I see
    that need to be resolved, and while these resolutions have a significant impact on the Wine building and development process, they also have an impact on distributions, and accordingly I'd like to get input from our packagers to ensure that their considerations are accurately taken into account.

    (1) Should we build via source import, or link statically, or dynamically?

    Source imports are dispreferred by Debian [1], on the grounds that they cause duplication of libraries on disk and in memory, and make it harder
    to handle security updates. They also make building and bisecting
    harder. Static libraries don't seem to be expressly discouraged, but
    share most of the same downsides (see also [2]).

    Note however that if they are linked dynamically, we need to make sure
    that we load our packages instead of MinGW builds of open-source
    libraries with applications ship with. There's some internal discussion about whether this is possible while using "stock" builds of MinGW libraries, but, due to the way the Win32 loader works, we will probably
    need to compile each library, and its dependencies, with a separate, wine-specific name, e.g. "libwinefreetype-6.dll" and
    "libwineharfbuzz.dll". For a detailed explantion see footnote [3]. Note
    that all we actually need to change is the name; we don't need to patch
    the source.

    Assuming Debian provides the dependencies (which is currently true only for zlib), this could be handled in packaging by providing symlinks, couldn’t it? Not in the Wine prefixes, but elsewhere.

    (The Wine team also maintains libvkd3d and libFaudio, so we can take care of those at least.)

    Accordingly, although static linking and source imports are generally disprefered, it may quite likely be preferable in our case. We don't get
    the benefits of on-disk deduplication, since Wine is essentially the
    only piece of software which needs these libraries.

    (2) If we use dynamic libraries, should dependencies be included in the
    main wine package, or packaged separately?

    This is mostly a question for packagers, although it also relates to (3).

    I expect that Debian will want to answer "packaged separately" here, on
    the grounds that this lets them update (say) Wine's libgnutls
    separately, and in sync with ELF libgnutls, if some security fix is
    needed. There is a snag, though: we need libraries to be copied into the prefix (there's some internal effort to allow using something like
    symlinks instead, but this hard and not done yet). Normally we perform
    this copy every time Wine is updated, but if Wine and its dependencies aren't updated on the same schedule, we may end up loading an old
    version of a dependency in the prefix.

    Debian packaging doesn’t touch anything in users’ home directories, so this would have to be handled in Wine itself, perhaps in a similar fashion to existing provisions for Gecko and Mono.

    (3) If dependencies are packaged separately, should Wine build them as
    part of its build tree (e.g. using submodules), or find and link
    (statically or dynamically) to existing binaries?

    Linking to existing binaries is generally preferable: it avoids
    duplication on disk; it reduces compile times when compiling a single package from source (especially the first time). However, we aren't
    going to benefit from on-disk duplication. And, most importantly, unlike with ELF dependencies, there is no standardized way to locate MinGW libraries—especially if it comes to Wine-specific libraries. We would
    need a way for Wine's configure script to find these packages—and
    ideally find them automatically, or else fall back to a submodule-based approach.

    If we rely on distributions to provide our dependencies, the best idea I have here would be something like a x86_64-w64-mingw32-pkg-config
    (Fedora actually already ships this, but I think Fedora is the only
    one). And if we use shared libraries rather than static, things get
    worse: we need to know the exact path of each library and its
    dependencies at runtime so that we can copy (or symlink) them into a
    user's WINEPREFIX. For ELF this is the job of ld.so. For MinGW there is
    no standardized install location across distributions.

    This also works in Debian:

    $ sudo apt install libz-mingw-w64-dev mingw-w64-tools
    $ x86_64-w64-mingw32-pkg-config --libs zlib
    -L/usr/x86_64-w64-mingw32/lib -lz

    For what it's worth, the current proposed solution (which has the
    support of the Wine maintainer) involves source imports and submodules. There's probably room for changing our approach even after things are committed, but I'd still like to get early feedback from distributions,
    and make sure that their interests are accurately represented, before we commit.

    Realistically, I think this is the best approach for now. As Debian adds support for PE libraries, we can replace the source imports in the Wine
    source code; this is done in many other Debian packages for projects which vendor dependencies.

    Regards,

    Stephen

    -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCgAdFiEEnPVX/hPLkMoq7x0ggNMC9Yhtg5wFAmE07hMACgkQgNMC9Yht g5xO+g//TnP4cCireJlB3ZIdYoJr9l8JILuHg0LWY+Dr23N/9uCrbTuKtwHunP9f 79+K/6Ar6DE2ecaTBQfp9596exOW0BREaY2tBxPyXX0sl75o8WwubZk+7XKx078l mo9+j2X8OI8ACztNrUMl22EY9ms51Hds4cyY5sCzbZp47o9j1+QTeZ6LRS6uUvcX 86aL/BGSWPACwash6FaNZbfV/4RbR4iTRIRSi+u11Gx245Nhh8Stl2wJfAB92XFj +JxVLut6wKH/cMhxgbyCaJDZ04YL8MfUx17PNLfuogeKYMFGVxK+iIi2Ip2byV1w Q0qYZh+DkA+BdOL+kraghv0XOSyr0anQbys49mziek8DBbwuS8L54mPr/f98olXS gQcQpIheKHkUupuIZsut9pY9lcxv5FHTqElMTPc1aslM1RKaHgN7DIdz4bzPKNL4 +/G0VDGUI0IqJ1Py1GoivRuBCEQl/6ZqG0zKE3TvhMJqiDPcFw8gy9BPUYNLKwos N66JlPHDbyaYZtVokJKXVcoGUGqmD8Vn5//peEh2ZzrG3UJTNZArfBsJAHMu+8zr trDwFEbvA5ZEPhQhoZ7+PVot2jv34mqOabs1TlK7aXsVT/FXHkbW3UdWp+vIH4Yc VlurbIFNI4G9rQ2feLtbRfPw2/2TBYQhypx+YuZMGb2DOtiGx1w=
    =O/J/
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Kitt@21:1/5 to roucaries.bastien@gmail.com on Sun Sep 5 18:30:01 2021
    Hi Bastien,

    On Sun, 5 Sep 2021 08:53:49 +0200, Bastien ROUCARIES <roucaries.bastien@gmail.com> wrote:
    Le dim. 5 sept. 2021 à 03:34, Zebediah Figura <zfigura@codeweavers.com> a écrit :
    I'm a contributor to the Wine project. To summarize the following mail, Wine needs special versions of some of its normal dependencies, such as libfreetype and libgnutls, built using the MinGW cross-compiler, and I'm sending out a mail to major distributions in order to get some feedback from our packagers on how these should be built and packaged.

    For a long time Wine has built all of its Win32 libraries (DLLs and
    EXEs) as ELF binaries. For various reasons related to application compatibility, we have started building our binaries as PE instead,
    using the MinGW cross-compiler. It is our intent to expand this to some
    of our dependencies as well. The list of dependencies that we intend to build using MinGW is not quite fixed yet, but we expect it to include
    and be mostly limited to the following:

    * libvkd3d
    * libFAudio
    * libgnutls
    * zlib (currently included via manual source import)
    * libmpg123
    * libgsm
    * libpng
    * libjpeg-turbo
    * libtiff
    * libfreetype
    * liblcms2
    * jxrlib

    and dependencies of the above packages (not including CRT dependencies, which Wine provides).

    There is currently some internal discussion about how these dependencies should be built and linked. There are essentially three questions I see that need to be resolved, and while these resolutions have a significant impact on the Wine building and development process, they also have an impact on distributions, and accordingly I'd like to get input from our packagers to ensure that their considerations are accurately taken into account.

    (1) Should we build via source import, or link statically, or dynamically?

    Source imports are dispreferred by Debian [1], on the grounds that they cause duplication of libraries on disk and in memory, and make it harder
    to handle security updates. They also make building and bisecting
    harder. Static libraries don't seem to be expressly discouraged, but
    share most of the same downsides (see also [2]).

    Note however that if they are linked dynamically, we need to make sure
    that we load our packages instead of MinGW builds of open-source
    libraries with applications ship with. There's some internal discussion about whether this is possible while using "stock" builds of MinGW libraries, but, due to the way the Win32 loader works, we will probably need to compile each library, and its dependencies, with a separate, wine-specific name, e.g. "libwinefreetype-6.dll" and
    "libwineharfbuzz.dll". For a detailed explantion see footnote [3]. Note that all we actually need to change is the name; we don't need to patch
    the source.

    Accordingly, although static linking and source imports are generally disprefered, it may quite likely be preferable in our case. We don't get the benefits of on-disk deduplication, since Wine is essentially the
    only piece of software which needs these libraries.

    (2) If we use dynamic libraries, should dependencies be included in the main wine package, or packaged separately?



    Improve dpkg to support partial arch. I volonteer to implement none arch
    but i am waiting from guillem here.

    Thanks for stepping up!

    For MinGW-w64 dependencies, an additional requirement is figuring out a solution for https://bugs.debian.org/606825; https://wiki.debian.org/Teams/Dpkg/FAQ#Q._Can_we_add_support_for_new_dpkg_architectures.3F
    gives additional context.

    Regards,

    Stephen

    -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCgAdFiEEnPVX/hPLkMoq7x0ggNMC9Yhtg5wFAmE07q4ACgkQgNMC9Yht g5z0AQ//VnBjSWrYk3bxJxo2SZ07bgKykzhRHezzo7HCQJ1rXOxmUA8baRxe2JfT z/jr46LGLxrLu59+XTKolp9xfCLfR0xGWfQt7M36pXK+qJBt5XNChlA0oiYpsfcr xtgWmpiLRzrNNHIDiiUbomyGnvxG55hzenvcq4gRSJFZQxjEcpqDSB2RGZcIYsBN qL5YFlxPSfxSoBkVR04PrNu0d2hB6Es/DSL8wwO3cWZ7gM/NE6U1Tk66Fnx3ssyL Z8VQ8FjSc1GFe7spJhodgXqjG++jI3VO02pSEFySWALO+bplKPNuRppbN/c1vQf8 Zgx+vpnHWUJIxPjpPO09sQoptkr/DpLjyAHijkahaD5v+XsACFusYUIkZdwGQNo8 n3BXmaaM1KXbK9m7Npjm0Qe0hMvKAqRdoOlBxOOt9SgpxgVLsk9AyFVLzUw1jjFY tMBpdDwlnHvg6TB2WVdbViblTVPxEhcrGGMtbEamB9P5NJ9TPkw41OdRJqvKYW8R KrdD0XN1pfIo84q6j1CJcUta/RsCkthBEbanJ1jPsRO4yTsykGuAoxTyeFGc9ake IPZBci3n+YEV0QCukuqP9GJSL9jR75KbNXtoVrBSYsp7AKg4yWFTxG/Gx++/4tuv MCIcEIICNSTxWu1EiuJEL19gJtzFMCqEDR1+HtwSkoCxTRnoAbA=
    =CyS+
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zebediah Figura@21:1/5 to Stephen Kitt on Sun Sep 5 19:20:04 2021
    On 9/5/21 11:19 AM, Stephen Kitt wrote:
    Hi Zebediah,

    On Sat, 4 Sep 2021 20:17:53 -0500, Zebediah Figura <zfigura@codeweavers.com> wrote:
    I'm a contributor to the Wine project. To summarize the following mail,
    Wine needs special versions of some of its normal dependencies, such as
    libfreetype and libgnutls, built using the MinGW cross-compiler, and I'm
    sending out a mail to major distributions in order to get some feedback
    from our packagers on how these should be built and packaged.

    For a long time Wine has built all of its Win32 libraries (DLLs and
    EXEs) as ELF binaries. For various reasons related to application
    compatibility, we have started building our binaries as PE instead,
    using the MinGW cross-compiler. It is our intent to expand this to some
    of our dependencies as well. The list of dependencies that we intend to
    build using MinGW is not quite fixed yet, but we expect it to include
    and be mostly limited to the following:

    * libvkd3d
    * libFAudio
    * libgnutls
    * zlib (currently included via manual source import)
    * libmpg123
    * libgsm
    * libpng
    * libjpeg-turbo
    * libtiff
    * libfreetype
    * liblcms2
    * jxrlib

    and dependencies of the above packages (not including CRT dependencies,
    which Wine provides).

    There is currently some internal discussion about how these dependencies
    should be built and linked. There are essentially three questions I see
    that need to be resolved, and while these resolutions have a significant
    impact on the Wine building and development process, they also have an
    impact on distributions, and accordingly I'd like to get input from our
    packagers to ensure that their considerations are accurately taken into
    account.

    (1) Should we build via source import, or link statically, or dynamically? >>
    Source imports are dispreferred by Debian [1], on the grounds that they
    cause duplication of libraries on disk and in memory, and make it harder
    to handle security updates. They also make building and bisecting
    harder. Static libraries don't seem to be expressly discouraged, but
    share most of the same downsides (see also [2]).

    Note however that if they are linked dynamically, we need to make sure
    that we load our packages instead of MinGW builds of open-source
    libraries with applications ship with. There's some internal discussion
    about whether this is possible while using "stock" builds of MinGW
    libraries, but, due to the way the Win32 loader works, we will probably
    need to compile each library, and its dependencies, with a separate,
    wine-specific name, e.g. "libwinefreetype-6.dll" and
    "libwineharfbuzz.dll". For a detailed explantion see footnote [3]. Note
    that all we actually need to change is the name; we don't need to patch
    the source.

    Assuming Debian provides the dependencies (which is currently true only for zlib), this could be handled in packaging by providing symlinks, couldn’t it?
    Not in the Wine prefixes, but elsewhere.

    Almost :-/

    Copying/symlinking libfreetype-1.dll to libwinefreetype-1.dll is easy.
    The problem is that libwinefreetype-1.dll is still going to link to libharfbuzz-1.dll, but we need it to link to libwineharfbuzz-1.dll.

    (The Wine team also maintains libvkd3d and libFaudio, so we can take care of those at least.)

    Accordingly, although static linking and source imports are generally
    disprefered, it may quite likely be preferable in our case. We don't get
    the benefits of on-disk deduplication, since Wine is essentially the
    only piece of software which needs these libraries.

    (2) If we use dynamic libraries, should dependencies be included in the
    main wine package, or packaged separately?

    This is mostly a question for packagers, although it also relates to (3).

    I expect that Debian will want to answer "packaged separately" here, on
    the grounds that this lets them update (say) Wine's libgnutls
    separately, and in sync with ELF libgnutls, if some security fix is
    needed. There is a snag, though: we need libraries to be copied into the
    prefix (there's some internal effort to allow using something like
    symlinks instead, but this hard and not done yet). Normally we perform
    this copy every time Wine is updated, but if Wine and its dependencies
    aren't updated on the same schedule, we may end up loading an old
    version of a dependency in the prefix.

    Debian packaging doesn’t touch anything in users’ home directories, so this
    would have to be handled in Wine itself, perhaps in a similar fashion to existing provisions for Gecko and Mono.

    (3) If dependencies are packaged separately, should Wine build them as
    part of its build tree (e.g. using submodules), or find and link
    (statically or dynamically) to existing binaries?

    Linking to existing binaries is generally preferable: it avoids
    duplication on disk; it reduces compile times when compiling a single
    package from source (especially the first time). However, we aren't
    going to benefit from on-disk duplication. And, most importantly, unlike
    with ELF dependencies, there is no standardized way to locate MinGW
    libraries—especially if it comes to Wine-specific libraries. We would
    need a way for Wine's configure script to find these packages—and
    ideally find them automatically, or else fall back to a submodule-based
    approach.

    If we rely on distributions to provide our dependencies, the best idea I
    have here would be something like a x86_64-w64-mingw32-pkg-config
    (Fedora actually already ships this, but I think Fedora is the only
    one). And if we use shared libraries rather than static, things get
    worse: we need to know the exact path of each library and its
    dependencies at runtime so that we can copy (or symlink) them into a
    user's WINEPREFIX. For ELF this is the job of ld.so. For MinGW there is
    no standardized install location across distributions.

    This also works in Debian:

    $ sudo apt install libz-mingw-w64-dev mingw-w64-tools
    $ x86_64-w64-mingw32-pkg-config --libs zlib
    -L/usr/x86_64-w64-mingw32/lib -lz

    Ah, cool, I looked for that and somehow missed it.

    Note that's the wrong path for dynamic libraries, though; those go in /usr/x86_64-w64-mingw32/bin/. We'll need a way to find those. Maybe
    hardcoding a list won't be too painful, though...

    For what it's worth, the current proposed solution (which has the
    support of the Wine maintainer) involves source imports and submodules.
    There's probably room for changing our approach even after things are
    committed, but I'd still like to get early feedback from distributions,
    and make sure that their interests are accurately represented, before we
    commit.

    Realistically, I think this is the best approach for now. As Debian adds support for PE libraries, we can replace the source imports in the Wine source code; this is done in many other Debian packages for projects which vendor dependencies.

    Regards,

    Stephen


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Kitt@21:1/5 to All on Mon Sep 6 09:10:03 2021
    On Sun, 5 Sep 2021 12:14:47 -0500, Zebediah Figura <zfigura@codeweavers.com> wrote:
    On 9/5/21 11:19 AM, Stephen Kitt wrote:
    On Sat, 4 Sep 2021 20:17:53 -0500, Zebediah Figura <zfigura@codeweavers.com> wrote:
    I'm a contributor to the Wine project. To summarize the following mail,
    Wine needs special versions of some of its normal dependencies, such as
    libfreetype and libgnutls, built using the MinGW cross-compiler, and I'm >> sending out a mail to major distributions in order to get some feedback
    from our packagers on how these should be built and packaged.

    For a long time Wine has built all of its Win32 libraries (DLLs and
    EXEs) as ELF binaries. For various reasons related to application
    compatibility, we have started building our binaries as PE instead,
    using the MinGW cross-compiler. It is our intent to expand this to some
    of our dependencies as well. The list of dependencies that we intend to
    build using MinGW is not quite fixed yet, but we expect it to include
    and be mostly limited to the following:

    * libvkd3d
    * libFAudio
    * libgnutls
    * zlib (currently included via manual source import)
    * libmpg123
    * libgsm
    * libpng
    * libjpeg-turbo
    * libtiff
    * libfreetype
    * liblcms2
    * jxrlib

    and dependencies of the above packages (not including CRT dependencies,
    which Wine provides).

    There is currently some internal discussion about how these dependencies >> should be built and linked. There are essentially three questions I see
    that need to be resolved, and while these resolutions have a significant >> impact on the Wine building and development process, they also have an
    impact on distributions, and accordingly I'd like to get input from our
    packagers to ensure that their considerations are accurately taken into
    account.

    (1) Should we build via source import, or link statically, or
    dynamically?

    Source imports are dispreferred by Debian [1], on the grounds that they
    cause duplication of libraries on disk and in memory, and make it harder >> to handle security updates. They also make building and bisecting
    harder. Static libraries don't seem to be expressly discouraged, but
    share most of the same downsides (see also [2]).

    Note however that if they are linked dynamically, we need to make sure
    that we load our packages instead of MinGW builds of open-source
    libraries with applications ship with. There's some internal discussion
    about whether this is possible while using "stock" builds of MinGW
    libraries, but, due to the way the Win32 loader works, we will probably
    need to compile each library, and its dependencies, with a separate,
    wine-specific name, e.g. "libwinefreetype-6.dll" and
    "libwineharfbuzz.dll". For a detailed explantion see footnote [3]. Note
    that all we actually need to change is the name; we don't need to patch
    the source.

    Assuming Debian provides the dependencies (which is currently true only
    for zlib), this could be handled in packaging by providing symlinks, couldn’t it? Not in the Wine prefixes, but elsewhere.

    Almost :-/

    Copying/symlinking libfreetype-1.dll to libwinefreetype-1.dll is easy.
    The problem is that libwinefreetype-1.dll is still going to link to libharfbuzz-1.dll, but we need it to link to libwineharfbuzz-1.dll.

    Ah yes, I hadn’t thought it through. So really Wine needs its own parallel ecosystem of DLLs in any case, which effectively means building them along
    with Wine (from Wine’s perspective, ignoring distribution constraints and preferences).

    This also works in Debian:

    $ sudo apt install libz-mingw-w64-dev mingw-w64-tools
    $ x86_64-w64-mingw32-pkg-config --libs zlib
    -L/usr/x86_64-w64-mingw32/lib -lz

    Ah, cool, I looked for that and somehow missed it.

    Note that's the wrong path for dynamic libraries, though; those go in /usr/x86_64-w64-mingw32/bin/. We'll need a way to find those. Maybe hardcoding a list won't be too painful, though...

    In Debian they go in /usr/x86_64-w64-mingw32/lib currently, which is why
    the .pc file points there. But as you point out, that doesn’t help at runtime.

    Also, having pkg-config support doesn’t really help with a parallel set of DLLs, does it?

    For what it's worth, the current proposed solution (which has the
    support of the Wine maintainer) involves source imports and submodules.
    There's probably room for changing our approach even after things are
    committed, but I'd still like to get early feedback from distributions,
    and make sure that their interests are accurately represented, before we >> commit.

    Realistically, I think this is the best approach for now. As Debian adds support for PE libraries, we can replace the source imports in the Wine source code; this is done in many other Debian packages for projects which vendor dependencies.

    I still think this is true. With requirement for a Wine-specific set of DLLs, improving the situation in Debian would involve supporting source build-dependencies, i.e. being able to say that a given package wants access
    to the source code of another package. That’s something that’s been brought up previously, and is worked around by providing binary packages containing package source code (e.g. binutils-source, gcc-11-source etc.), but isn’t really upstream’s concern, in that it’s a Debian implementation detail.

    Going back to your original three questions, I think that the best approach
    for you as upstream is to focus on providing a complete set of source code (including dependencies) which works, and to make it friendlier to distributions, make the build process capable of handling alternative
    locations for the dependencies’ source code or even build artifacts. (This has a number of knock-on effects — in particular, you should ensure that the upstream source code for all your dependencies works with Wine, i.e. that
    Wine doesn’t require Wine-specific patches to any of its dependencies.)

    Given how varied MinGW-w64 handling is in different distributions, pushing things further risks making it easier for one distribution and harder for the others...

    Regards,

    Stephen

    -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCgAdFiEEnPVX/hPLkMoq7x0ggNMC9Yhtg5wFAmE1u9AACgkQgNMC9Yht g5w3rxAAjjII8TJKeRWaOVCrI6oQIv9w4LP4tPs3MlcaZMu8rbTin2zLBjDEyEVW AFBmkVFPsGPFdd5q4z0upSONKn3VyTSNOZLQuEHCcbY1kSoBi5FlGf7QTXpg66x1 3WN9mAC6zaqMLnJw8oqJvA75aoh8yig9dU71ClbjPIUS06qr8CIb9KpssXbQQVko PZfwF5mtVmZuFjUkJ6pOTPCII5JA5PhuQBo5CKGWFcGiWl32IOCnazWkitLyRqSE bJOHXd+A6BWA5KRINjtpHzUp+0hEgUqKl40YPkXFkztp60rS3OLz1Lq6GcVRFAH3 Lftj5Wvmwrj8UEdZPrX6BTjrd3s5M68BNW/cd+APQ0x38VfXWhv/i26DunKc5fZ+ 7h5f0hfnZN1Y9/W2Udx2OjWTSVX6SFTO/epsDS93YEobre6ZR85a7ty61g9HIrQH S8DdQPf5plREvBc7by1SfeK/lBlJ+EfxrS+ey7s1xQdiTmCSHsZhYVmIhNKXCCFA zNNRXTGB0aaMbGAguqACygyZy6P2nShvrauQEG2jjgcIJLa6sbhc1cVJhWzjV4He MD9UocI4xiwvOk//x9pl+AWUyPhTKPrNbj+AVN+5likxhbAHeyW3Ird4OfGtJ4Dk ySKF4LHftUz/4xNP4Zlr2F/LMTAYhsoMSh3Tn2vDs2j7p/hLgVk=
    =AdCl
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastien ROUCARIES@21:1/5 to All on Mon Sep 6 10:20:02 2021
    Le lun. 6 sept. 2021 à 06:57, Stephen Kitt <skitt@debian.org> a écrit :

    On Sun, 5 Sep 2021 12:14:47 -0500, Zebediah Figura <zfigura@codeweavers.com> wrote:
    On 9/5/21 11:19 AM, Stephen Kitt wrote:
    On Sat, 4 Sep 2021 20:17:53 -0500, Zebediah Figura <zfigura@codeweavers.com> wrote:
    I'm a contributor to the Wine project. To summarize the following mail, >> Wine needs special versions of some of its normal dependencies, such as >> libfreetype and libgnutls, built using the MinGW cross-compiler, and I'm >> sending out a mail to major distributions in order to get some feedback >> from our packagers on how these should be built and packaged.

    For a long time Wine has built all of its Win32 libraries (DLLs and
    EXEs) as ELF binaries. For various reasons related to application
    compatibility, we have started building our binaries as PE instead,
    using the MinGW cross-compiler. It is our intent to expand this to some >> of our dependencies as well. The list of dependencies that we intend to >> build using MinGW is not quite fixed yet, but we expect it to include
    and be mostly limited to the following:

    * libvkd3d
    * libFAudio
    * libgnutls
    * zlib (currently included via manual source import)
    * libmpg123
    * libgsm
    * libpng
    * libjpeg-turbo
    * libtiff
    * libfreetype
    * liblcms2
    * jxrlib

    and dependencies of the above packages (not including CRT dependencies, >> which Wine provides).

    There is currently some internal discussion about how these dependencies >> should be built and linked. There are essentially three questions I see >> that need to be resolved, and while these resolutions have a significant >> impact on the Wine building and development process, they also have an >> impact on distributions, and accordingly I'd like to get input from our >> packagers to ensure that their considerations are accurately taken into >> account.

    (1) Should we build via source import, or link statically, or
    dynamically?

    Source imports are dispreferred by Debian [1], on the grounds that they >> cause duplication of libraries on disk and in memory, and make it harder >> to handle security updates. They also make building and bisecting
    harder. Static libraries don't seem to be expressly discouraged, but
    share most of the same downsides (see also [2]).

    Note however that if they are linked dynamically, we need to make sure >> that we load our packages instead of MinGW builds of open-source
    libraries with applications ship with. There's some internal discussion >> about whether this is possible while using "stock" builds of MinGW
    libraries, but, due to the way the Win32 loader works, we will probably >> need to compile each library, and its dependencies, with a separate,
    wine-specific name, e.g. "libwinefreetype-6.dll" and
    "libwineharfbuzz.dll". For a detailed explantion see footnote [3]. Note >> that all we actually need to change is the name; we don't need to patch >> the source.

    Assuming Debian provides the dependencies (which is currently true only for zlib), this could be handled in packaging by providing symlinks, couldn’t it? Not in the Wine prefixes, but elsewhere.

    Almost :-/

    Copying/symlinking libfreetype-1.dll to libwinefreetype-1.dll is easy.
    The problem is that libwinefreetype-1.dll is still going to link to libharfbuzz-1.dll, but we need it to link to libwineharfbuzz-1.dll.

    Ah yes, I hadn’t thought it through. So really Wine needs its own parallel ecosystem of DLLs in any case, which effectively means building them along with Wine (from Wine’s perspective, ignoring distribution constraints and preferences).

    I will really prefer something less laborious. Like using flexdll for
    your own library.

    Moreover using a custom loader will decrease the patching burden for
    debian side, so a win win.

    Bastien

    This also works in Debian:

    $ sudo apt install libz-mingw-w64-dev mingw-w64-tools
    $ x86_64-w64-mingw32-pkg-config --libs zlib
    -L/usr/x86_64-w64-mingw32/lib -lz

    Ah, cool, I looked for that and somehow missed it.

    Note that's the wrong path for dynamic libraries, though; those go in /usr/x86_64-w64-mingw32/bin/. We'll need a way to find those. Maybe hardcoding a list won't be too painful, though...

    In Debian they go in /usr/x86_64-w64-mingw32/lib currently, which is why
    the .pc file points there. But as you point out, that doesn’t help at runtime.

    Also, having pkg-config support doesn’t really help with a parallel set of DLLs, does it?

    For what it's worth, the current proposed solution (which has the
    support of the Wine maintainer) involves source imports and submodules. >> There's probably room for changing our approach even after things are
    committed, but I'd still like to get early feedback from distributions, >> and make sure that their interests are accurately represented, before we >> commit.

    Realistically, I think this is the best approach for now. As Debian adds support for PE libraries, we can replace the source imports in the Wine source code; this is done in many other Debian packages for projects which
    vendor dependencies.

    I still think this is true. With requirement for a Wine-specific set of DLLs, improving the situation in Debian would involve supporting source build-dependencies, i.e. being able to say that a given package wants access to the source code of another package. That’s something that’s been brought
    up previously, and is worked around by providing binary packages containing package source code (e.g. binutils-source, gcc-11-source etc.), but isn’t really upstream’s concern, in that it’s a Debian implementation detail.

    Going back to your original three questions, I think that the best approach for you as upstream is to focus on providing a complete set of source code (including dependencies) which works, and to make it friendlier to distributions, make the build process capable of handling alternative locations for the dependencies’ source code or even build artifacts. (This has a number of knock-on effects — in particular, you should ensure that the
    upstream source code for all your dependencies works with Wine, i.e. that Wine doesn’t require Wine-specific patches to any of its dependencies.)

    Given how varied MinGW-w64 handling is in different distributions, pushing things further risks making it easier for one distribution and harder for the others...

    Regards,

    Stephen

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zebediah Figura@21:1/5 to Stephen Kitt on Mon Sep 6 18:40:01 2021
    On 9/6/21 1:57 AM, Stephen Kitt wrote:
    On Sun, 5 Sep 2021 12:14:47 -0500, Zebediah Figura <zfigura@codeweavers.com> wrote:
    On 9/5/21 11:19 AM, Stephen Kitt wrote:
    On Sat, 4 Sep 2021 20:17:53 -0500, Zebediah Figura
    <zfigura@codeweavers.com> wrote:
    I'm a contributor to the Wine project. To summarize the following mail, >>>> Wine needs special versions of some of its normal dependencies, such as >>>> libfreetype and libgnutls, built using the MinGW cross-compiler, and I'm >>>> sending out a mail to major distributions in order to get some feedback >>>> from our packagers on how these should be built and packaged.

    For a long time Wine has built all of its Win32 libraries (DLLs and
    EXEs) as ELF binaries. For various reasons related to application
    compatibility, we have started building our binaries as PE instead,
    using the MinGW cross-compiler. It is our intent to expand this to some >>>> of our dependencies as well. The list of dependencies that we intend to >>>> build using MinGW is not quite fixed yet, but we expect it to include
    and be mostly limited to the following:

    * libvkd3d
    * libFAudio
    * libgnutls
    * zlib (currently included via manual source import)
    * libmpg123
    * libgsm
    * libpng
    * libjpeg-turbo
    * libtiff
    * libfreetype
    * liblcms2
    * jxrlib

    and dependencies of the above packages (not including CRT dependencies, >>>> which Wine provides).

    There is currently some internal discussion about how these dependencies >>>> should be built and linked. There are essentially three questions I see >>>> that need to be resolved, and while these resolutions have a significant >>>> impact on the Wine building and development process, they also have an >>>> impact on distributions, and accordingly I'd like to get input from our >>>> packagers to ensure that their considerations are accurately taken into >>>> account.

    (1) Should we build via source import, or link statically, or
    dynamically?

    Source imports are dispreferred by Debian [1], on the grounds that they >>>> cause duplication of libraries on disk and in memory, and make it harder >>>> to handle security updates. They also make building and bisecting
    harder. Static libraries don't seem to be expressly discouraged, but
    share most of the same downsides (see also [2]).

    Note however that if they are linked dynamically, we need to make sure >>>> that we load our packages instead of MinGW builds of open-source
    libraries with applications ship with. There's some internal discussion >>>> about whether this is possible while using "stock" builds of MinGW
    libraries, but, due to the way the Win32 loader works, we will probably >>>> need to compile each library, and its dependencies, with a separate,
    wine-specific name, e.g. "libwinefreetype-6.dll" and
    "libwineharfbuzz.dll". For a detailed explantion see footnote [3]. Note >>>> that all we actually need to change is the name; we don't need to patch >>>> the source.

    Assuming Debian provides the dependencies (which is currently true only
    for zlib), this could be handled in packaging by providing symlinks,
    couldn’t it? Not in the Wine prefixes, but elsewhere.

    Almost :-/

    Copying/symlinking libfreetype-1.dll to libwinefreetype-1.dll is easy.
    The problem is that libwinefreetype-1.dll is still going to link to
    libharfbuzz-1.dll, but we need it to link to libwineharfbuzz-1.dll.

    Ah yes, I hadn’t thought it through. So really Wine needs its own parallel ecosystem of DLLs in any case, which effectively means building them along with Wine (from Wine’s perspective, ignoring distribution constraints and preferences).

    This also works in Debian:

    $ sudo apt install libz-mingw-w64-dev mingw-w64-tools
    $ x86_64-w64-mingw32-pkg-config --libs zlib
    -L/usr/x86_64-w64-mingw32/lib -lz

    Ah, cool, I looked for that and somehow missed it.

    Note that's the wrong path for dynamic libraries, though; those go in
    /usr/x86_64-w64-mingw32/bin/. We'll need a way to find those. Maybe
    hardcoding a list won't be too painful, though...

    In Debian they go in /usr/x86_64-w64-mingw32/lib currently, which is why
    the .pc file points there. But as you point out, that doesn’t help at runtime.

    Also, having pkg-config support doesn’t really help with a parallel set of DLLs, does it?

    I mean... eh. In theory you could say "here's a library called
    libwinefreetype, and to find it you do `pkg-config --cflags --libs libwinefreetype`", but that does strike me as more than a little janky.


    For what it's worth, the current proposed solution (which has the
    support of the Wine maintainer) involves source imports and submodules. >>>> There's probably room for changing our approach even after things are
    committed, but I'd still like to get early feedback from distributions, >>>> and make sure that their interests are accurately represented, before we >>>> commit.

    Realistically, I think this is the best approach for now. As Debian adds >>> support for PE libraries, we can replace the source imports in the Wine
    source code; this is done in many other Debian packages for projects which >>> vendor dependencies.

    I still think this is true. With requirement for a Wine-specific set of DLLs, improving the situation in Debian would involve supporting source build-dependencies, i.e. being able to say that a given package wants access to the source code of another package. That’s something that’s been brought
    up previously, and is worked around by providing binary packages containing package source code (e.g. binutils-source, gcc-11-source etc.), but isn’t really upstream’s concern, in that it’s a Debian implementation detail.

    Going back to your original three questions, I think that the best approach for you as upstream is to focus on providing a complete set of source code (including dependencies) which works, and to make it friendlier to distributions, make the build process capable of handling alternative locations for the dependencies’ source code or even build artifacts. (This has a number of knock-on effects — in particular, you should ensure that the
    upstream source code for all your dependencies works with Wine, i.e. that Wine doesn’t require Wine-specific patches to any of its dependencies.)

    Given how varied MinGW-w64 handling is in different distributions, pushing things further risks making it easier for one distribution and harder for the others...

    Thanks for the detailed response!

    It's probably worth pointing out that:

    (1) if we use static linking, we should be able to use distribution
    libraries unmodified. Of course, static linking comes with its own
    downsides...

    (2) Like I mentioned or hinted at in my original email, it *may* be
    possible to use distribution dynamic libraries unmodified. It's not
    clear that it can be done without breaking compatibility, but if it can,
    would that change anything?

    ἔρρωσθε,
    Zebediah

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastien ROUCARIES@21:1/5 to All on Mon Sep 6 21:00:03 2021
    Le lun. 6 sept. 2021 à 18:36, Zebediah Figura <zfigura@codeweavers.com> a écrit :

    On 9/6/21 1:57 AM, Stephen Kitt wrote:
    On Sun, 5 Sep 2021 12:14:47 -0500, Zebediah Figura <
    zfigura@codeweavers.com>
    wrote:
    On 9/5/21 11:19 AM, Stephen Kitt wrote:
    On Sat, 4 Sep 2021 20:17:53 -0500, Zebediah Figura
    <zfigura@codeweavers.com> wrote:
    I'm a contributor to the Wine project. To summarize the following
    mail,
    Wine needs special versions of some of its normal dependencies, such
    as
    libfreetype and libgnutls, built using the MinGW cross-compiler, and
    I'm
    sending out a mail to major distributions in order to get some
    feedback
    from our packagers on how these should be built and packaged.

    For a long time Wine has built all of its Win32 libraries (DLLs and
    EXEs) as ELF binaries. For various reasons related to application
    compatibility, we have started building our binaries as PE instead,
    using the MinGW cross-compiler. It is our intent to expand this to
    some
    of our dependencies as well. The list of dependencies that we intend
    to
    build using MinGW is not quite fixed yet, but we expect it to include >>>> and be mostly limited to the following:

    * libvkd3d
    * libFAudio
    * libgnutls
    * zlib (currently included via manual source import)
    * libmpg123
    * libgsm
    * libpng
    * libjpeg-turbo
    * libtiff
    * libfreetype
    * liblcms2
    * jxrlib

    and dependencies of the above packages (not including CRT
    dependencies,
    which Wine provides).

    There is currently some internal discussion about how these
    dependencies
    should be built and linked. There are essentially three questions I
    see
    that need to be resolved, and while these resolutions have a
    significant
    impact on the Wine building and development process, they also have an >>>> impact on distributions, and accordingly I'd like to get input from
    our
    packagers to ensure that their considerations are accurately taken
    into
    account.

    (1) Should we build via source import, or link statically, or
    dynamically?

    Source imports are dispreferred by Debian [1], on the grounds that
    they
    cause duplication of libraries on disk and in memory, and make it
    harder
    to handle security updates. They also make building and bisecting
    harder. Static libraries don't seem to be expressly discouraged, but >>>> share most of the same downsides (see also [2]).

    Note however that if they are linked dynamically, we need to make sure >>>> that we load our packages instead of MinGW builds of open-source
    libraries with applications ship with. There's some internal
    discussion
    about whether this is possible while using "stock" builds of MinGW
    libraries, but, due to the way the Win32 loader works, we will
    probably
    need to compile each library, and its dependencies, with a separate, >>>> wine-specific name, e.g. "libwinefreetype-6.dll" and
    "libwineharfbuzz.dll". For a detailed explantion see footnote [3].
    Note
    that all we actually need to change is the name; we don't need to
    patch
    the source.

    Assuming Debian provides the dependencies (which is currently true only >>> for zlib), this could be handled in packaging by providing symlinks,
    couldn’t it? Not in the Wine prefixes, but elsewhere.

    Almost :-/

    Copying/symlinking libfreetype-1.dll to libwinefreetype-1.dll is easy.
    The problem is that libwinefreetype-1.dll is still going to link to
    libharfbuzz-1.dll, but we need it to link to libwineharfbuzz-1.dll.

    Ah yes, I hadn’t thought it through. So really Wine needs its own
    parallel
    ecosystem of DLLs in any case, which effectively means building them
    along
    with Wine (from Wine’s perspective, ignoring distribution constraints and preferences).

    This also works in Debian:

    $ sudo apt install libz-mingw-w64-dev mingw-w64-tools
    $ x86_64-w64-mingw32-pkg-config --libs zlib
    -L/usr/x86_64-w64-mingw32/lib -lz

    Ah, cool, I looked for that and somehow missed it.

    Note that's the wrong path for dynamic libraries, though; those go in
    /usr/x86_64-w64-mingw32/bin/. We'll need a way to find those. Maybe
    hardcoding a list won't be too painful, though...

    In Debian they go in /usr/x86_64-w64-mingw32/lib currently, which is why the .pc file points there. But as you point out, that doesn’t help at runtime.

    Also, having pkg-config support doesn’t really help with a parallel set
    of
    DLLs, does it?

    I mean... eh. In theory you could say "here's a library called libwinefreetype, and to find it you do `pkg-config --cflags --libs libwinefreetype`", but that does strike me as more than a little janky.


    For what it's worth, the current proposed solution (which has the
    support of the Wine maintainer) involves source imports and
    submodules.
    There's probably room for changing our approach even after things are >>>> committed, but I'd still like to get early feedback from
    distributions,
    and make sure that their interests are accurately represented, before
    we
    commit.

    Realistically, I think this is the best approach for now. As Debian
    adds
    support for PE libraries, we can replace the source imports in the Wine >>> source code; this is done in many other Debian packages for projects which
    vendor dependencies.

    I still think this is true. With requirement for a Wine-specific set of
    DLLs,
    improving the situation in Debian would involve supporting source build-dependencies, i.e. being able to say that a given package wants
    access
    to the source code of another package. That’s something that’s been
    brought
    up previously, and is worked around by providing binary packages
    containing
    package source code (e.g. binutils-source, gcc-11-source etc.), but isn’t really upstream’s concern, in that it’s a Debian implementation detail.

    Going back to your original three questions, I think that the best
    approach
    for you as upstream is to focus on providing a complete set of source
    code
    (including dependencies) which works, and to make it friendlier to distributions, make the build process capable of handling alternative locations for the dependencies’ source code or even build artifacts.
    (This
    has a number of knock-on effects — in particular, you should ensure that
    the
    upstream source code for all your dependencies works with Wine, i.e. that Wine doesn’t require Wine-specific patches to any of its dependencies.)

    Given how varied MinGW-w64 handling is in different distributions,
    pushing
    things further risks making it easier for one distribution and harder
    for the
    others...

    Thanks for the detailed response!

    It's probably worth pointing out that:

    (1) if we use static linking, we should be able to use distribution
    libraries unmodified. Of course, static linking comes with its own downsides...

    (2) Like I mentioned or hinted at in my original email, it *may* be
    possible to use distribution dynamic libraries unmodified. It's not
    clear that it can be done without breaking compatibility, but if it can, would that change anything?


    Yes i really prefer (2) it means we could use multiarch easilly....

    Please try to document thé blocking point.


    ἔρρωσθε,
    Zebediah



    <div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le lun. 6 sept. 2021 à 18:36, Zebediah Figura &lt;<a href="mailto:zfigura@codeweavers.com">zfigura@codeweavers.com</a>&gt; a écrit :<br></div><blockquote class="
    gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 9/6/21 1:57 AM, Stephen Kitt wrote:<br>
    &gt; On Sun, 5 Sep 2021 12:14:47 -0500, Zebediah Figura &lt;<a href="mailto:zfigura@codeweavers.com" target="_blank" rel="noreferrer">zfigura@codeweavers.com</a>&gt;<br>
    &gt; wrote:<br>
    &gt;&gt; On 9/5/21 11:19 AM, Stephen Kitt wrote:<br>
    &gt;&gt;&gt; On Sat, 4 Sep 2021 20:17:53 -0500, Zebediah Figura<br> &gt;&gt;&gt; &lt;<a href="mailto:zfigura@codeweavers.com" target="_blank" rel="noreferrer">zfigura@codeweavers.com</a>&gt; wrote:<br>
    &gt;&gt;&gt;&gt; I&#39;m a contributor to the Wine project. To summarize the following mail,<br>
    &gt;&gt;&gt;&gt; Wine needs special versions of some of its normal dependencies, such as<br>
    &gt;&gt;&gt;&gt; libfreetype and libgnutls, built using the MinGW cross-compiler, and I&#39;m<br>
    &gt;&gt;&gt;&gt; sending out a mail to major distributions in order to get some feedback<br>
    &gt;&gt;&gt;&gt; from our packagers on how these should be built and packaged.<br>
    &gt;&gt;&gt;&gt;<br>
    &gt;&gt;&gt;&gt; For a long time Wine has built all of its Win32 libraries (DLLs and<br>
    &gt;&gt;&gt;&gt; EXEs) as ELF binaries. For various reasons related to application<br>
    &gt;&gt;&gt;&gt; compatibility, we have started building our binaries as PE instead,<br>
    &gt;&gt;&gt;&gt; using the MinGW cross-compiler. It is our intent to expand this to some<br>
    &gt;&gt;&gt;&gt; of our dependencies as well. The list of dependencies that we intend to<br>
    &gt;&gt;&gt;&gt; build using MinGW is not quite fixed yet, but we expect it to include<br>
    &gt;&gt;&gt;&gt; and be mostly limited to the following:<br> &gt;&gt;&gt;&gt;<br>
    &gt;&gt;&gt;&gt; * libvkd3d<br>
    &gt;&gt;&gt;&gt; * libFAudio<br>
    &gt;&gt;&gt;&gt; * libgnutls<br>
    &gt;&gt;&gt;&gt; * zlib (currently included via manual source import)<br> &gt;&gt;&gt;&gt; * libmpg123<br>
    &gt;&gt;&gt;&gt; * libgsm<br>
    &gt;&gt;&gt;&gt; * libpng<br>
    &gt;&gt;&gt;&gt; * libjpeg-turbo<br>
    &gt;&gt;&gt;&gt; * libtiff<br>
    &gt;&gt;&gt;&gt; * libfreetype<br>
    &gt;&gt;&gt;&gt; * liblcms2<br>
    &gt;&gt;&gt;&gt; * jxrlib<br>
    &gt;&gt;&gt;&gt;<br>
    &gt;&gt;&gt;&gt; and dependencies of the above packages (not including CRT dependencies,<br>
    &gt;&gt;&gt;&gt; which Wine provides).<br>
    &gt;&gt;&gt;&gt;<br>
    &gt;&gt;&gt;&gt; There is currently some internal discussion about how these dependencies<br>
    &gt;&gt;&gt;&gt; should be built and linked. There are essentially three questions I see<br>
    &gt;&gt;&gt;&gt; that need to be resolved, and while these resolutions have a significant<br>
    &gt;&gt;&gt;&gt; impact on the Wine building and development process, they also have an<br>
    &gt;&gt;&gt;&gt; impact on distributions, and accordingly I&#39;d like to get input from our<br>
    &gt;&gt;&gt;&gt; packagers to ensure that their considerations are accurately taken into<br>
    &gt;&gt;&gt;&gt; account.<br>
    &gt;&gt;&gt;&gt;<br>
    &gt;&gt;&gt;&gt; (1) Should we build via source import, or link statically, or<br>
    &gt;&gt;&gt;&gt; dynamically?<br>
    &gt;&gt;&gt;&gt;<br>
    &gt;&gt;&gt;&gt; Source imports are dispreferred by Debian [1], on the grounds that they<br>
    &gt;&gt;&gt;&gt; cause duplication of libraries on disk and in memory, and make it harder<br>
    &gt;&gt;&gt;&gt; to handle security updates. They also make building and bisecting<br>
    &gt;&gt;&gt;&gt; harder. Static libraries don&#39;t seem to be expressly discouraged, but<br>
    &gt;&gt;&gt;&gt; share most of the same downsides (see also [2]).<br> &gt;&gt;&gt;&gt;<br>
    &gt;&gt;&gt;&gt; Note however that if they are linked dynamically, we need to make sure<br>
    &gt;&gt;&gt;&gt; that we load our packages instead of MinGW builds of open-source<br>
    &gt;&gt;&gt;&gt; libraries with applications ship with. There&#39;s some internal discussion<br>
    &gt;&gt;&gt;&gt; about whether this is possible while using &quot;stock&quot; builds of MinGW<br>
    &gt;&gt;&gt;&gt; libraries, but, due to the way the Win32 loader works, we will probably<br>
    &gt;&gt;&gt;&gt; need to compile each library, and its dependencies, with a separate,<br>
    &gt;&gt;&gt;&gt; wine-specific name, e.g. &quot;libwinefreetype-6.dll&quot; and<br>
    &gt;&gt;&gt;&gt; &quot;libwineharfbuzz.dll&quot;. For a detailed explantion see footnote [3]. Note<br>
    &gt;&gt;&gt;&gt; that all we actually need to change is the name; we don&#39;t need to patch<br>
    &gt;&gt;&gt;&gt; the source.<br>
    &gt;&gt;&gt;<br>
    &gt;&gt;&gt; Assuming Debian provides the dependencies (which is currently true only<br>
    &gt;&gt;&gt; for zlib), this could be handled in packaging by providing symlinks,<br>
    &gt;&gt;&gt; couldn’t it? Not in the Wine prefixes, but elsewhere.<br> &gt;&gt;<br>
    &gt;&gt; Almost :-/<br>
    &gt;&gt;<br>
    &gt;&gt; Copying/symlinking libfreetype-1.dll to libwinefreetype-1.dll is easy.<br>
    &gt;&gt; The problem is that libwinefreetype-1.dll is still going to link to<br>
    &gt;&gt; libharfbuzz-1.dll, but we need it to link to libwineharfbuzz-1.dll.<br>
    &gt; <br>
    &gt; Ah yes, I hadn’t thought it through. So really Wine needs its own parallel<br>
    &gt; ecosystem of DLLs in any case, which effectively means building them along<br>
    &gt; with Wine (from Wine’s perspective, ignoring distribution constraints and<br>
    &gt; preferences).<br>
    &gt; <br>
    &gt;&gt;&gt; This also works in Debian:<br>
    &gt;&gt;&gt;<br>
    &gt;&gt;&gt; $ sudo apt install libz-mingw-w64-dev mingw-w64-tools<br> &gt;&gt;&gt; $ x86_64-w64-mingw32-pkg-config --libs zlib<br>
    &gt;&gt;&gt; -L/usr/x86_64-w64-mingw32/lib -lz<br>
    &gt;&gt;<br>
    &gt;&gt; Ah, cool, I looked for that and somehow missed it.<br>
    &gt;&gt;<br>
    &gt;&gt; Note that&#39;s the wrong path for dynamic libraries, though; those go in<br>
    &gt;&gt; /usr/x86_64-w64-mingw32/bin/. We&#39;ll need a way to find those. Maybe<br>
    &gt;&gt; hardcoding a list won&#39;t be too painful, though...<br>
    &gt; <br>
    &gt; In Debian they go in /usr/x86_64-w64-mingw32/lib currently, which is why<br>
    &gt; the .pc file points there. But as you point out, that doesn’t help at<br>
    &gt; runtime.<br>
    &gt; <br>
    &gt; Also, having pkg-config support doesn’t really help with a parallel set of<br>
    &gt; DLLs, does it?<br>

    I mean... eh. In theory you could say &quot;here&#39;s a library called <br> libwinefreetype, and to find it you do `pkg-config --cflags --libs <br> libwinefreetype`&quot;, but that does strike me as more than a little janky.<br>

    &gt; <br>
    &gt;&gt;&gt;&gt; For what it&#39;s worth, the current proposed solution (which has the<br>
    &gt;&gt;&gt;&gt; support of the Wine maintainer) involves source imports and submodules.<br>
    &gt;&gt;&gt;&gt; There&#39;s probably room for changing our approach even after things are<br>
    &gt;&gt;&gt;&gt; committed, but I&#39;d still like to get early feedback from distributions,<br>
    &gt;&gt;&gt;&gt; and make sure that their interests are accurately represented, before we<br>
    &gt;&gt;&gt;&gt; commit.<br>
    &gt;&gt;&gt;<br>
    &gt;&gt;&gt; Realistically, I think this is the best approach for now. As Debian adds<br>
    &gt;&gt;&gt; support for PE libraries, we can replace the source imports in the Wine<br>
    &gt;&gt;&gt; source code; this is done in many other Debian packages for projects which<br>
    &gt;&gt;&gt; vendor dependencies.<br>
    &gt; <br>
    &gt; I still think this is true. With requirement for a Wine-specific set of DLLs,<br>
    &gt; improving the situation in Debian would involve supporting source<br>
    &gt; build-dependencies, i.e. being able to say that a given package wants access<br>
    &gt; to the source code of another package. That’s something that’s been brought<br>
    &gt; up previously, and is worked around by providing binary packages containing<br>
    &gt; package source code (e.g. binutils-source, gcc-11-source etc.), but isn’t<br>
    &gt; really upstream’s concern, in that it’s a Debian implementation detail.<br>
    &gt; <br>
    &gt; Going back to your original three questions, I think that the best approach<br>
    &gt; for you as upstream is to focus on providing a complete set of source code<br>
    &gt; (including dependencies) which works, and to make it friendlier to<br> &gt; distributions, make the build process capable of handling alternative<br> &gt; locations for the dependencies’ source code or even build artifacts. (This<br>
    &gt; has a number of knock-on effects — in particular, you should ensure that the<br>
    &gt; upstream source code for all your dependencies works with Wine, i.e. that<br>
    &gt; Wine doesn’t require Wine-specific patches to any of its dependencies.)<br>
    &gt; <br>
    &gt; Given how varied MinGW-w64 handling is in different distributions, pushing<br>
    &gt; things further risks making it easier for one distribution and harder for the<br>
    &gt; others...<br>

    Thanks for the detailed response!<br>

    It&#39;s probably worth pointing out that:<br>

    (1) if we use static linking, we should be able to use distribution <br> libraries unmodified. Of course, static linking comes with its own <br> downsides...<br>

    (2) Like I mentioned or hinted at in my original email, it *may* be <br> possible to use distribution dynamic libraries unmodified. It&#39;s not <br> clear that it can be done without breaking compatibility, but if it can, <br> would that change anything?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Yes i really prefer (2) it means we could use multiarch easilly....</div><div dir="auto"><br></div><div dir="auto">Please try to document thé blocking
    point.</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

    ἔρρωσθε,<br>
    Zebediah<br>

    </blockquote></div></div></div>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zebediah Figura@21:1/5 to Bastien ROUCARIES on Tue Sep 7 00:00:02 2021
    On 9/6/21 1:34 PM, Bastien ROUCARIES wrote:
    Le lun. 6 sept. 2021 à 18:36, Zebediah Figura <zfigura@codeweavers.com> a écrit :

    On 9/6/21 1:57 AM, Stephen Kitt wrote:
    On Sun, 5 Sep 2021 12:14:47 -0500, Zebediah Figura <
    zfigura@codeweavers.com>
    wrote:
    On 9/5/21 11:19 AM, Stephen Kitt wrote:
    On Sat, 4 Sep 2021 20:17:53 -0500, Zebediah Figura
    <zfigura@codeweavers.com> wrote:
    I'm a contributor to the Wine project. To summarize the following
    mail,
    Wine needs special versions of some of its normal dependencies, such
    as
    libfreetype and libgnutls, built using the MinGW cross-compiler, and
    I'm
    sending out a mail to major distributions in order to get some
    feedback
    from our packagers on how these should be built and packaged.

    For a long time Wine has built all of its Win32 libraries (DLLs and >>>>>> EXEs) as ELF binaries. For various reasons related to application
    compatibility, we have started building our binaries as PE instead, >>>>>> using the MinGW cross-compiler. It is our intent to expand this to
    some
    of our dependencies as well. The list of dependencies that we intend
    to
    build using MinGW is not quite fixed yet, but we expect it to include >>>>>> and be mostly limited to the following:

    * libvkd3d
    * libFAudio
    * libgnutls
    * zlib (currently included via manual source import)
    * libmpg123
    * libgsm
    * libpng
    * libjpeg-turbo
    * libtiff
    * libfreetype
    * liblcms2
    * jxrlib

    and dependencies of the above packages (not including CRT
    dependencies,
    which Wine provides).

    There is currently some internal discussion about how these
    dependencies
    should be built and linked. There are essentially three questions I
    see
    that need to be resolved, and while these resolutions have a
    significant
    impact on the Wine building and development process, they also have an >>>>>> impact on distributions, and accordingly I'd like to get input from
    our
    packagers to ensure that their considerations are accurately taken
    into
    account.

    (1) Should we build via source import, or link statically, or
    dynamically?

    Source imports are dispreferred by Debian [1], on the grounds that
    they
    cause duplication of libraries on disk and in memory, and make it
    harder
    to handle security updates. They also make building and bisecting
    harder. Static libraries don't seem to be expressly discouraged, but >>>>>> share most of the same downsides (see also [2]).

    Note however that if they are linked dynamically, we need to make sure >>>>>> that we load our packages instead of MinGW builds of open-source
    libraries with applications ship with. There's some internal
    discussion
    about whether this is possible while using "stock" builds of MinGW >>>>>> libraries, but, due to the way the Win32 loader works, we will
    probably
    need to compile each library, and its dependencies, with a separate, >>>>>> wine-specific name, e.g. "libwinefreetype-6.dll" and
    "libwineharfbuzz.dll". For a detailed explantion see footnote [3].
    Note
    that all we actually need to change is the name; we don't need to
    patch
    the source.

    Assuming Debian provides the dependencies (which is currently true only >>>>> for zlib), this could be handled in packaging by providing symlinks, >>>>> couldn’t it? Not in the Wine prefixes, but elsewhere.

    Almost :-/

    Copying/symlinking libfreetype-1.dll to libwinefreetype-1.dll is easy. >>>> The problem is that libwinefreetype-1.dll is still going to link to
    libharfbuzz-1.dll, but we need it to link to libwineharfbuzz-1.dll.

    Ah yes, I hadn’t thought it through. So really Wine needs its own
    parallel
    ecosystem of DLLs in any case, which effectively means building them
    along
    with Wine (from Wine’s perspective, ignoring distribution constraints and >>> preferences).

    This also works in Debian:

    $ sudo apt install libz-mingw-w64-dev mingw-w64-tools
    $ x86_64-w64-mingw32-pkg-config --libs zlib
    -L/usr/x86_64-w64-mingw32/lib -lz

    Ah, cool, I looked for that and somehow missed it.

    Note that's the wrong path for dynamic libraries, though; those go in
    /usr/x86_64-w64-mingw32/bin/. We'll need a way to find those. Maybe
    hardcoding a list won't be too painful, though...

    In Debian they go in /usr/x86_64-w64-mingw32/lib currently, which is why >>> the .pc file points there. But as you point out, that doesn’t help at
    runtime.

    Also, having pkg-config support doesn’t really help with a parallel set >> of
    DLLs, does it?

    I mean... eh. In theory you could say "here's a library called
    libwinefreetype, and to find it you do `pkg-config --cflags --libs
    libwinefreetype`", but that does strike me as more than a little janky.


    For what it's worth, the current proposed solution (which has the
    support of the Wine maintainer) involves source imports and
    submodules.
    There's probably room for changing our approach even after things are >>>>>> committed, but I'd still like to get early feedback from
    distributions,
    and make sure that their interests are accurately represented, before
    we
    commit.

    Realistically, I think this is the best approach for now. As Debian
    adds
    support for PE libraries, we can replace the source imports in the Wine >>>>> source code; this is done in many other Debian packages for projects
    which
    vendor dependencies.

    I still think this is true. With requirement for a Wine-specific set of
    DLLs,
    improving the situation in Debian would involve supporting source
    build-dependencies, i.e. being able to say that a given package wants
    access
    to the source code of another package. That’s something that’s been
    brought
    up previously, and is worked around by providing binary packages
    containing
    package source code (e.g. binutils-source, gcc-11-source etc.), but isn’t >>> really upstream’s concern, in that it’s a Debian implementation detail. >>>
    Going back to your original three questions, I think that the best
    approach
    for you as upstream is to focus on providing a complete set of source
    code
    (including dependencies) which works, and to make it friendlier to
    distributions, make the build process capable of handling alternative
    locations for the dependencies’ source code or even build artifacts.
    (This
    has a number of knock-on effects — in particular, you should ensure that >> the
    upstream source code for all your dependencies works with Wine, i.e. that >>> Wine doesn’t require Wine-specific patches to any of its dependencies.) >>>
    Given how varied MinGW-w64 handling is in different distributions,
    pushing
    things further risks making it easier for one distribution and harder
    for the
    others...

    Thanks for the detailed response!

    It's probably worth pointing out that:

    (1) if we use static linking, we should be able to use distribution
    libraries unmodified. Of course, static linking comes with its own
    downsides...

    (2) Like I mentioned or hinted at in my original email, it *may* be
    possible to use distribution dynamic libraries unmodified. It's not
    clear that it can be done without breaking compatibility, but if it can,
    would that change anything?


    Yes i really prefer (2) it means we could use multiarch easilly....

    Please try to document thé blocking point.

    So this is mostly documented in the footnote to my original mail, but
    I'll copy it here for reference.

    The basic problem is that applications can and often do ship with PE
    builds of cross-platform libraries. These libraries can be ahead of
    Wine's system libraries, behind them, or even built with custom patches. Accordingly we really don't want to load "our" freetype in place of
    "their" freetype, or "theirs" in place of "ours". But because of the way
    the Win32 loader works, you can generally only have one DLL of a given
    name loaded in a process, and further attempts to dlopen() [as it were] "libfreetype-6.dll" will return the handle to the already loaded
    library, potentially breaking either Wine or the application.

    The easiest way to avoid ever doing that is by giving each library a
    different name (or by not using dynamic linking at all.)

    Failing that, we need a way to determine whether a library is a system dependency—and thus can *only* be loaded from the system DLL path—or an application dependency—and thus should *never* be loaded from the system
    DLL path. I think this can be done, but it gets tricky, and it's not
    clear that there aren't going to be subtle problems from having two
    different DLLs with the same name loaded in the same process. Especially keeping in mind that Windows programs do absolutely insane things when
    it comes to depending on OS internals.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Wise@21:1/5 to All on Tue Sep 7 02:50:01 2021
    On Mon, Sep 6, 2021 at 9:54 PM Zebediah Figura wrote:

    The basic problem is that applications can and often do ship with PE
    builds of cross-platform libraries. These libraries can be ahead of
    Wine's system libraries, behind them, or even built with custom patches. Accordingly we really don't want to load "our" freetype in place of
    "their" freetype, or "theirs" in place of "ours". But because of the way
    the Win32 loader works, you can generally only have one DLL of a given
    name loaded in a process, and further attempts to dlopen() [as it were] "libfreetype-6.dll" will return the handle to the already loaded
    library, potentially breaking either Wine or the application.

    I don't know the details here, but my immediate thought when reading
    this is that you need some kind of namespace. I then found that linker namespaces are a thing, perhaps they would provide the solution for
    you. It sounds like the OpenGL shim loader solution listed on the
    glibc wiki might work for your use-case. Or perhaps the LD_AUDIT
    feature would also work.

    https://www.sourceware.org/glibc/wiki/LinkerNamespaces

    --
    bye,
    pabs

    https://wiki.debian.org/PaulWise

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastien =?ISO-8859-1?Q?Roucari=E8s?@21:1/5 to All on Tue Sep 7 12:40:01 2021
    Le mardi 7 septembre 2021, 00:44:31 UTC Paul Wise a crit :
    On Mon, Sep 6, 2021 at 9:54 PM Zebediah Figura wrote:
    The basic problem is that applications can and often do ship with PE
    builds of cross-platform libraries. These libraries can be ahead of
    Wine's system libraries, behind them, or even built with custom patches. Accordingly we really don't want to load "our" freetype in place of
    "their" freetype, or "theirs" in place of "ours". But because of the way the Win32 loader works, you can generally only have one DLL of a given
    name loaded in a process, and further attempts to dlopen() [as it were] "libfreetype-6.dll" will return the handle to the already loaded
    library, potentially breaking either Wine or the application.

    I don't know the details here, but my immediate thought when reading
    this is that you need some kind of namespace. I then found that linker namespaces are a thing, perhaps they would provide the solution for
    you. It sounds like the OpenGL shim loader solution listed on the
    glibc wiki might work for your use-case. Or perhaps the LD_AUDIT
    feature would also work.

    https://www.sourceware.org/glibc/wiki/LinkerNamespaces
    I agree with pabs, implementing name space is a good solution
    and will allow to be distrib friendly.

    Moreover it will be best if marking a library as wine system one could be done post build. We will prefer to not modify upstream (like libpng) source.

    It is easier for us to apply small patch to upstream, or better in your case to add a post link linker script or even some compiler flag that will add some notes section to dll in order to mark it as use namespace system, or so on.

    The problem on windows side is well known as dll hell

    Renaming of the lib could be done post install. Moreover a crazy idea why not renaming system dll instead of libpng-2.0.0.dll as libpng-2.0.0.sll (note the version is manadaroty) Therefore we could use upstream source. Then add a small linker script that will rewrite the depends of libpng-2.0.0.sll to .sll file (aka binary sed s/.dll/.sll/g).

    then add a small wraper (shim) like said pab that load the .sll library, the best pratice will be a command tool that take the name of the sll and create magically the dll

    Therefore from distrib point of side we only changes the way we build the package, it could be automated, it is scalable and it does not need to patch package by package. Only to add some linker script magic

    Bastien

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zebediah Figura@21:1/5 to All on Tue Sep 7 17:50:01 2021
    On 9/7/21 5:16 AM, Bastien Roucariès wrote:
    Le mardi 7 septembre 2021, 00:44:31 UTC Paul Wise a écrit :
    On Mon, Sep 6, 2021 at 9:54 PM Zebediah Figura wrote:
    The basic problem is that applications can and often do ship with PE
    builds of cross-platform libraries. These libraries can be ahead of
    Wine's system libraries, behind them, or even built with custom patches. >>> Accordingly we really don't want to load "our" freetype in place of
    "their" freetype, or "theirs" in place of "ours". But because of the way >>> the Win32 loader works, you can generally only have one DLL of a given
    name loaded in a process, and further attempts to dlopen() [as it were]
    "libfreetype-6.dll" will return the handle to the already loaded
    library, potentially breaking either Wine or the application.

    I don't know the details here, but my immediate thought when reading
    this is that you need some kind of namespace. I then found that linker
    namespaces are a thing, perhaps they would provide the solution for
    you. It sounds like the OpenGL shim loader solution listed on the
    glibc wiki might work for your use-case. Or perhaps the LD_AUDIT
    feature would also work.

    https://www.sourceware.org/glibc/wiki/LinkerNamespaces
    I agree with pabs, implementing name space is a good solution
    and will allow to be distrib friendly.

    Moreover it will be best if marking a library as wine system one could be done
    post build. We will prefer to not modify upstream (like libpng) source.

    It is easier for us to apply small patch to upstream, or better in your case to add a post link linker script or even some compiler flag that will add some
    notes section to dll in order to mark it as use namespace system, or so on.

    The problem on windows side is well known as dll hell

    Renaming of the lib could be done post install. Moreover a crazy idea why not renaming system dll instead of libpng-2.0.0.dll as libpng-2.0.0.sll (note the version is manadaroty) Therefore we could use upstream source. Then add a small linker script that will rewrite the depends of libpng-2.0.0.sll to .sll file (aka binary sed s/.dll/.sll/g).

    then add a small wraper (shim) like said pab that load the .sll library, the best pratice will be a command tool that take the name of the sll and create magically the dll

    Therefore from distrib point of side we only changes the way we build the package, it could be automated, it is scalable and it does not need to patch package by package. Only to add some linker script magic

    The problem isn't particularly about detecting what is and isn't a
    system library; I think we can come up with a reliable heuristic for
    that, without even needing linker namespaces or anything.

    The outstanding problem seems to be more about potentially breaking applications because they see two identically named DLLs loaded in the
    same process. Applications can and do trawl the internal loader state,
    although the Win32 loader also exposes some APIs so they don't even have to.

    It may also be that the aforementioned heuristic is too hacky to be
    accepted upstream into Wine.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastien ROUCARIES@21:1/5 to All on Tue Sep 7 19:30:01 2021
    I disagree.

    Le mar. 7 sept. 2021 à 17:48, Zebediah Figura <zfigura@codeweavers.com> a écrit :

    On 9/7/21 5:16 AM, Bastien Roucariès wrote:
    Le mardi 7 septembre 2021, 00:44:31 UTC Paul Wise a écrit :
    On Mon, Sep 6, 2021 at 9:54 PM Zebediah Figura wrote:
    The basic problem is that applications can and often do ship with PE
    builds of cross-platform libraries. These libraries can be ahead of
    Wine's system libraries, behind them, or even built with custom
    patches.
    Accordingly we really don't want to load "our" freetype in place of
    "their" freetype, or "theirs" in place of "ours". But because of the
    way
    the Win32 loader works, you can generally only have one DLL of a given >>> name loaded in a process, and further attempts to dlopen() [as it were] >>> "libfreetype-6.dll" will return the handle to the already loaded
    library, potentially breaking either Wine or the application.

    I don't know the details here, but my immediate thought when reading
    this is that you need some kind of namespace. I then found that linker
    namespaces are a thing, perhaps they would provide the solution for
    you. It sounds like the OpenGL shim loader solution listed on the
    glibc wiki might work for your use-case. Or perhaps the LD_AUDIT
    feature would also work.

    https://www.sourceware.org/glibc/wiki/LinkerNamespaces
    I agree with pabs, implementing name space is a good solution
    and will allow to be distrib friendly.

    Moreover it will be best if marking a library as wine system one could
    be done
    post build. We will prefer to not modify upstream (like libpng) source.

    It is easier for us to apply small patch to upstream, or better in your
    case
    to add a post link linker script or even some compiler flag that will
    add some
    notes section to dll in order to mark it as use namespace system, or so
    on.

    The problem on windows side is well known as dll hell

    Renaming of the lib could be done post install. Moreover a crazy idea
    why not
    renaming system dll instead of libpng-2.0.0.dll as libpng-2.0.0.sll
    (note the
    version is manadaroty) Therefore we could use upstream source. Then add
    a
    small linker script that will rewrite the depends of libpng-2.0.0.sll
    to
    .sll file (aka binary sed s/.dll/.sll/g).

    then add a small wraper (shim) like said pab that load the .sll library,
    the
    best pratice will be a command tool that take the name of the sll and
    create
    magically the dll

    Therefore from distrib point of side we only changes the way we build the package, it could be automated, it is scalable and it does not need to
    patch
    package by package. Only to add some linker script magic

    The problem isn't particularly about detecting what is and isn't a
    system library; I think we can come up with a reliable heuristic for
    that, without even needing linker namespaces or anything.

    The outstanding problem seems to be more about potentially breaking applications because they see two identically named DLLs loaded in the
    same process. Applications can and do trawl the internal loader state, although the Win32 loader also exposes some APIs so they don't even have
    to.

    It may also be that the aforementioned heuristic is too hacky to be
    accepted upstream into Wine.

    I do not propose to change the loader, i propose to change the link or post link stage of system library. You could rename the lib and change the
    dépend to new name after build. So you will have an unique name per system
    lib without changing the way you build these lib.

    It is équivalent to use a namespace resolved at late build time.

    <div dir="auto"><div>I disagree. <br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 7 sept. 2021 à 17:48, Zebediah Figura &lt;<a href="mailto:zfigura@codeweavers.com">zfigura@codeweavers.com</a>&gt; a écrit :<br></div><
    blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 9/7/21 5:16 AM, Bastien Roucariès wrote:<br>
    &gt; Le mardi 7 septembre 2021, 00:44:31 UTC Paul Wise a écrit :<br>
    &gt;&gt; On Mon, Sep 6, 2021 at 9:54 PM Zebediah Figura wrote:<br>
    &gt;&gt;&gt; The basic problem is that applications can and often do ship with PE<br>
    &gt;&gt;&gt; builds of cross-platform libraries. These libraries can be ahead of<br>
    &gt;&gt;&gt; Wine&#39;s system libraries, behind them, or even built with custom patches.<br>
    &gt;&gt;&gt; Accordingly we really don&#39;t want to load &quot;our&quot; freetype in place of<br>
    &gt;&gt;&gt; &quot;their&quot; freetype, or &quot;theirs&quot; in place of &quot;ours&quot;. But because of the way<br>
    &gt;&gt;&gt; the Win32 loader works, you can generally only have one DLL of a given<br>
    &gt;&gt;&gt; name loaded in a process, and further attempts to dlopen() [as it were]<br>
    &gt;&gt;&gt; &quot;libfreetype-6.dll&quot; will return the handle to the already loaded<br>
    &gt;&gt;&gt; library, potentially breaking either Wine or the application.<br> &gt;&gt;<br>
    &gt;&gt; I don&#39;t know the details here, but my immediate thought when reading<br>
    &gt;&gt; this is that you need some kind of namespace. I then found that linker<br>
    &gt;&gt; namespaces are a thing, perhaps they would provide the solution for<br>
    &gt;&gt; you. It sounds like the OpenGL shim loader solution listed on the<br> &gt;&gt; glibc wiki might work for your use-case. Or perhaps the LD_AUDIT<br> &gt;&gt; feature would also work.<br>
    &gt;&gt;<br>
    &gt;&gt; <a href="https://www.sourceware.org/glibc/wiki/LinkerNamespaces" rel="noreferrer noreferrer" target="_blank">https://www.sourceware.org/glibc/wiki/LinkerNamespaces</a><br>
    &gt; I agree with pabs, implementing name space is a good solution<br>
    &gt; and will allow to be distrib friendly.<br>
    &gt; <br>
    &gt; Moreover it will be best if marking a library as wine system one could be done<br>
    &gt; post build. We will prefer to not modify upstream (like libpng) source.<br>
    &gt; <br>
    &gt; It is easier for us to apply small patch to upstream, or better in your case<br>
    &gt; to add a post link linker script or even some compiler flag that will add some<br>
    &gt; notes section to dll in order to mark it as use namespace system, or so on.<br>
    &gt; <br>
    &gt; The problem on windows side is well known as dll hell<br>
    &gt; <br>
    &gt; Renaming of the lib could be done post install. Moreover a crazy idea why not<br>
    &gt; renaming system dll instead of libpng-2.0.0.dll as libpng-2.0.0.sll (note the<br>
    &gt; version is manadaroty) Therefore we could use  upstream source. Then add a<br>
    &gt; small linker script that will rewrite the depends of  libpng-2.0.0.sll  to<br>
    &gt; .sll file (aka binary sed s/.dll/.sll/g).<br>
    &gt; <br>
    &gt; then add a small wraper (shim) like said pab that load the .sll library, the<br>
    &gt; best pratice will be a command tool that take the name of the sll and create<br>
    &gt; magically the dll<br>
    &gt; <br>
    &gt; Therefore from distrib point of side we only changes the way we build the<br>
    &gt; package, it could be automated, it is scalable and it does not need to patch<br>
    &gt; package by package. Only to add some linker script magic<br>

    The problem isn&#39;t particularly about detecting what is and isn&#39;t a <br> system library; I think we can come up with a reliable heuristic for <br>
    that, without even needing linker namespaces or anything.<br>

    The outstanding problem seems to be more about potentially breaking <br> applications because they see two identically named DLLs loaded in the <br> same process. Applications can and do trawl the internal loader state, <br> although the Win32 loader also exposes some APIs so they don&#39;t even have to.<br>

    It may also be that the aforementioned heuristic is too hacky to be <br> accepted upstream into Wine.<br></blockquote></div></div><div dir="auto">I do not propose to change the loader, i propose to change the link or post link stage of system library. You could rename the lib and change the dépend to new name after build. So
    you will have an unique name per system lib without changing the way you build these lib.</div><div dir="auto"><br></div><div dir="auto">It is équivalent to use a namespace resolved at late build time.</div><div dir="auto"><br></div><div dir="auto"><br><
    /div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    </blockquote></div></div></div>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastien ROUCARIES@21:1/5 to All on Tue Sep 7 20:20:01 2021
    Le mar. 7 sept. 2021 à 19:05, Bastien ROUCARIES <roucaries.bastien@gmail.com> a écrit :

    I disagree.

    Le mar. 7 sept. 2021 à 17:48, Zebediah Figura <zfigura@codeweavers.com> a écrit :

    On 9/7/21 5:16 AM, Bastien Roucariès wrote:
    Le mardi 7 septembre 2021, 00:44:31 UTC Paul Wise a écrit :
    On Mon, Sep 6, 2021 at 9:54 PM Zebediah Figura wrote:
    The basic problem is that applications can and often do ship with PE
    builds of cross-platform libraries. These libraries can be ahead of
    Wine's system libraries, behind them, or even built with custom
    patches.
    Accordingly we really don't want to load "our" freetype in place of
    "their" freetype, or "theirs" in place of "ours". But because of the
    way
    the Win32 loader works, you can generally only have one DLL of a given >> >>> name loaded in a process, and further attempts to dlopen() [as it
    were]
    "libfreetype-6.dll" will return the handle to the already loaded
    library, potentially breaking either Wine or the application.

    I don't know the details here, but my immediate thought when reading
    this is that you need some kind of namespace. I then found that linker
    namespaces are a thing, perhaps they would provide the solution for
    you. It sounds like the OpenGL shim loader solution listed on the
    glibc wiki might work for your use-case. Or perhaps the LD_AUDIT
    feature would also work.

    https://www.sourceware.org/glibc/wiki/LinkerNamespaces
    I agree with pabs, implementing name space is a good solution
    and will allow to be distrib friendly.

    Moreover it will be best if marking a library as wine system one could
    be done
    post build. We will prefer to not modify upstream (like libpng) source.

    It is easier for us to apply small patch to upstream, or better in your
    case
    to add a post link linker script or even some compiler flag that will
    add some
    notes section to dll in order to mark it as use namespace system, or so
    on.

    The problem on windows side is well known as dll hell

    Renaming of the lib could be done post install. Moreover a crazy idea
    why not
    renaming system dll instead of libpng-2.0.0.dll as libpng-2.0.0.sll
    (note the
    version is manadaroty) Therefore we could use upstream source. Then
    add a
    small linker script that will rewrite the depends of libpng-2.0.0.sll
    to
    .sll file (aka binary sed s/.dll/.sll/g).

    then add a small wraper (shim) like said pab that load the .sll
    library, the
    best pratice will be a command tool that take the name of the sll and
    create
    magically the dll

    Therefore from distrib point of side we only changes the way we build
    the
    package, it could be automated, it is scalable and it does not need to
    patch
    package by package. Only to add some linker script magic

    The problem isn't particularly about detecting what is and isn't a
    system library; I think we can come up with a reliable heuristic for
    that, without even needing linker namespaces or anything.

    The outstanding problem seems to be more about potentially breaking
    applications because they see two identically named DLLs loaded in the
    same process. Applications can and do trawl the internal loader state,
    although the Win32 loader also exposes some APIs so they don't even have
    to.

    It may also be that the aforementioned heuristic is too hacky to be
    accepted upstream into Wine.

    I do not propose to change the loader, i propose to change the link or
    post link stage of system library. You could rename the lib and change the dépend to new name after build. So you will have an unique name per system lib without changing the way you build these lib.

    It is équivalent to use a namespace resolved at late build time.

    And it is already coded :)

    https://pypi.org/project/machomachomangler/




    <div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 7 sept. 2021 à 19:05, Bastien ROUCARIES &lt;<a href="mailto:roucaries.bastien@gmail.com">roucaries.bastien@gmail.com</a>&gt; a écrit :<br></div><blockquote
    class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>I disagree. <br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 7 sept. 2021 à 17:48, Zebediah Figura &lt;<a href="
    mailto:zfigura@codeweavers.com" target="_blank" rel="noreferrer">zfigura@codeweavers.com</a>&gt; a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 9/7/21 5:16 AM, Bastien Roucari
    s wrote:<br>
    &gt; Le mardi 7 septembre 2021, 00:44:31 UTC Paul Wise a écrit :<br>
    &gt;&gt; On Mon, Sep 6, 2021 at 9:54 PM Zebediah Figura wrote:<br>
    &gt;&gt;&gt; The basic problem is that applications can and often do ship with PE<br>
    &gt;&gt;&gt; builds of cross-platform libraries. These libraries can be ahead of<br>
    &gt;&gt;&gt; Wine&#39;s system libraries, behind them, or even built with custom patches.<br>
    &gt;&gt;&gt; Accordingly we really don&#39;t want to load &quot;our&quot; freetype in place of<br>
    &gt;&gt;&gt; &quot;their&quot; freetype, or &quot;theirs&quot; in place of &quot;ours&quot;. But because of the way<br>
    &gt;&gt;&gt; the Win32 loader works, you can generally only have one DLL of a given<br>
    &gt;&gt;&gt; name loaded in a process, and further attempts to dlopen() [as it were]<br>
    &gt;&gt;&gt; &quot;libfreetype-6.dll&quot; will return the handle to the already loaded<br>
    &gt;&gt;&gt; library, potentially breaking either Wine or the application.<br> &gt;&gt;<br>
    &gt;&gt; I don&#39;t know the details here, but my immediate thought when reading<br>
    &gt;&gt; this is that you need some kind of namespace. I then found that linker<br>
    &gt;&gt; namespaces are a thing, perhaps they would provide the solution for<br>
    &gt;&gt; you. It sounds like the OpenGL shim loader solution listed on the<br> &gt;&gt; glibc wiki might work for your use-case. Or perhaps the LD_AUDIT<br> &gt;&gt; feature would also work.<br>
    &gt;&gt;<br>
    &gt;&gt; <a href="https://www.sourceware.org/glibc/wiki/LinkerNamespaces" rel="noreferrer noreferrer noreferrer" target="_blank">https://www.sourceware.org/glibc/wiki/LinkerNamespaces</a><br>
    &gt; I agree with pabs, implementing name space is a good solution<br>
    &gt; and will allow to be distrib friendly.<br>
    &gt; <br>
    &gt; Moreover it will be best if marking a library as wine system one could be done<br>
    &gt; post build. We will prefer to not modify upstream (like libpng) source.<br>
    &gt; <br>
    &gt; It is easier for us to apply small patch to upstream, or better in your case<br>
    &gt; to add a post link linker script or even some compiler flag that will add some<br>
    &gt; notes section to dll in order to mark it as use namespace system, or so on.<br>
    &gt; <br>
    &gt; The problem on windows side is well known as dll hell<br>
    &gt; <br>
    &gt; Renaming of the lib could be done post install. Moreover a crazy idea why not<br>
    &gt; renaming system dll instead of libpng-2.0.0.dll as libpng-2.0.0.sll (note the<br>
    &gt; version is manadaroty) Therefore we could use  upstream source. Then add a<br>
    &gt; small linker script that will rewrite the depends of  libpng-2.0.0.sll  to<br>
    &gt; .sll file (aka binary sed s/.dll/.sll/g).<br>
    &gt; <br>
    &gt; then add a small wraper (shim) like said pab that load the .sll library, the<br>
    &gt; best pratice will be a command tool that take the name of the sll and create<br>
    &gt; magically the dll<br>
    &gt; <br>
    &gt; Therefore from distrib point of side we only changes the way we build the<br>
    &gt; package, it could be automated, it is scalable and it does not need to patch<br>
    &gt; package by package. Only to add some linker script magic<br>

    The problem isn&#39;t particularly about detecting what is and isn&#39;t a <br> system library; I think we can come up with a reliable heuristic for <br>
    that, without even needing linker namespaces or anything.<br>

    The outstanding problem seems to be more about potentially breaking <br> applications because they see two identically named DLLs loaded in the <br> same process. Applications can and do trawl the internal loader state, <br> although the Win32 loader also exposes some APIs so they don&#39;t even have to.<br>

    It may also be that the aforementioned heuristic is too hacky to be <br> accepted upstream into Wine.<br></blockquote></div></div><div dir="auto">I do not propose to change the loader, i propose to change the link or post link stage of system library. You could rename the lib and change the dépend to new name after build. So
    you will have an unique name per system lib without changing the way you build these lib.</div><div dir="auto"><br></div><div dir="auto">It is équivalent to use a namespace resolved at late build time.</div><div dir="auto"></div></div></blockquote></div>
    </div><div dir="auto">And it is already coded :)</div><div dir="auto"><br></div><div dir="auto"><a href="https://pypi.org/project/machomachomangler/">https://pypi.org/project/machomachomangler/</a><br></div><div dir="auto"><div class="gmail_quote"><
    blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:
    1px #ccc solid;padding-left:1ex">
    </blockquote></div></div></div>
    </blockquote></div></div></div>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zebediah Figura@21:1/5 to Bastien ROUCARIES on Tue Sep 7 23:20:02 2021
    On 9/7/21 12:05 PM, Bastien ROUCARIES wrote:
    I disagree.

    Le mar. 7 sept. 2021 à 17:48, Zebediah Figura <zfigura@codeweavers.com> a écrit :

    On 9/7/21 5:16 AM, Bastien Roucariès wrote:
    Le mardi 7 septembre 2021, 00:44:31 UTC Paul Wise a écrit :
    On Mon, Sep 6, 2021 at 9:54 PM Zebediah Figura wrote:
    The basic problem is that applications can and often do ship with PE >>>>> builds of cross-platform libraries. These libraries can be ahead of
    Wine's system libraries, behind them, or even built with custom
    patches.
    Accordingly we really don't want to load "our" freetype in place of
    "their" freetype, or "theirs" in place of "ours". But because of the
    way
    the Win32 loader works, you can generally only have one DLL of a given >>>>> name loaded in a process, and further attempts to dlopen() [as it were] >>>>> "libfreetype-6.dll" will return the handle to the already loaded
    library, potentially breaking either Wine or the application.

    I don't know the details here, but my immediate thought when reading
    this is that you need some kind of namespace. I then found that linker >>>> namespaces are a thing, perhaps they would provide the solution for
    you. It sounds like the OpenGL shim loader solution listed on the
    glibc wiki might work for your use-case. Or perhaps the LD_AUDIT
    feature would also work.

    https://www.sourceware.org/glibc/wiki/LinkerNamespaces
    I agree with pabs, implementing name space is a good solution
    and will allow to be distrib friendly.

    Moreover it will be best if marking a library as wine system one could
    be done
    post build. We will prefer to not modify upstream (like libpng) source.

    It is easier for us to apply small patch to upstream, or better in your
    case
    to add a post link linker script or even some compiler flag that will
    add some
    notes section to dll in order to mark it as use namespace system, or so
    on.

    The problem on windows side is well known as dll hell

    Renaming of the lib could be done post install. Moreover a crazy idea
    why not
    renaming system dll instead of libpng-2.0.0.dll as libpng-2.0.0.sll
    (note the
    version is manadaroty) Therefore we could use upstream source. Then add
    a
    small linker script that will rewrite the depends of libpng-2.0.0.sll
    to
    .sll file (aka binary sed s/.dll/.sll/g).

    then add a small wraper (shim) like said pab that load the .sll library,
    the
    best pratice will be a command tool that take the name of the sll and
    create
    magically the dll

    Therefore from distrib point of side we only changes the way we build the >>> package, it could be automated, it is scalable and it does not need to
    patch
    package by package. Only to add some linker script magic

    The problem isn't particularly about detecting what is and isn't a
    system library; I think we can come up with a reliable heuristic for
    that, without even needing linker namespaces or anything.

    The outstanding problem seems to be more about potentially breaking
    applications because they see two identically named DLLs loaded in the
    same process. Applications can and do trawl the internal loader state,
    although the Win32 loader also exposes some APIs so they don't even have
    to.

    It may also be that the aforementioned heuristic is too hacky to be
    accepted upstream into Wine.

    I do not propose to change the loader, i propose to change the link or post link stage of system library. You could rename the lib and change the
    dépend to new name after build. So you will have an unique name per system lib without changing the way you build these lib.

    It is équivalent to use a namespace resolved at late build time.


    Ah, so what you're proposing is that we do some sort of objcopy-like
    patching at runtime, e.g. when copying the dependency into the prefix.

    It probably won't be easy, but it might be more feasible than modifying
    the loader. I'll look into it...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Wise@21:1/5 to Zebediah Figura on Wed Sep 8 01:10:02 2021
    On Tue, 2021-09-07 at 10:48 -0500, Zebediah Figura wrote:

    The outstanding problem seems to be more about potentially breaking applications because they see two identically named DLLs loaded in the
    same process. Applications can and do trawl the internal loader state, although the Win32 loader also exposes some APIs so they don't even have to.

    I might be wrong but I got the impression that runtime linker
    namespaces & LD_AUDIT are designed to solve this exact issue.

    --
    bye,
    pabs

    https://wiki.debian.org/PaulWise

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEYQsotVz8/kXqG1Y7MRa6Xp/6aaMFAmE37zgACgkQMRa6Xp/6 aaOi6A//QJywbpmXEhBcv/EfuAjNpKlOuwet6C8HXAApef/w06eRlL973v+rbBpw 9NjlerD+mYTo8Lrl0ANZPDqREptSN6ri8AuT5m0Wd8uA+bG3ID/fm9tFdJ9NMbAS WivTMA6VNX+9BQaySgzVPBqBMjjq+y30QW1EoSmZIkYlZSiMw8exVB9M82WFu3I+ 3J9gZckeueHMcuQW38Jy1oMDD1WodokxXZDwpwq/+2aWLJrTE40PEVwZDRFdR5g/ oJacMe0ZIxPq9jgYRcxfZaL1PLF23MRUCbCiD0E7OVv7IxuQe/XZAldD3iaFtol9 aJLVpyXkcNxj8TD1rfY5zjwUNVaTOeGGtvT1TU0kzjknI05nPUhKRdc2gHR7xdWn In5YXskL91AKgKQOZlZ7lLQJ8iL3N+p3vd7jWjxFAyiDWooY26BCPjz1XD+h+4NJ d3tkSjrEa/kqhRriiEPFiVnkE7KOeTB+jg4P8Qp9xyIfHvHNutLLKC9Clw26xW7K LFWFtxQsNwecCukvR6l0uVNjEDrCuzbI3tOp3yIaHsgoSEZL/GZH/5jK/upnNKFA sVVETNCkmY/7gJ1QzaPNX5O81d0u+eWEopapABg72gtCM90+keLKDP0lEM5teZ5/ blgY+29HaJPzxNsBQAeJzdDL2iWgR//kEptmWwS04jTIfUfj+os=
    =UV+D
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastien ROUCARIES@21:1/5 to All on Wed Sep 8 01:50:02 2021
    Le mar. 7 sept. 2021 à 21:16, Zebediah Figura
    <zfigura@codeweavers.com> a écrit :

    On 9/7/21 12:05 PM, Bastien ROUCARIES wrote:
    I disagree.

    Le mar. 7 sept. 2021 à 17:48, Zebediah Figura <zfigura@codeweavers.com> a écrit :

    On 9/7/21 5:16 AM, Bastien Roucariès wrote:
    Le mardi 7 septembre 2021, 00:44:31 UTC Paul Wise a écrit :
    On Mon, Sep 6, 2021 at 9:54 PM Zebediah Figura wrote:
    The basic problem is that applications can and often do ship with PE >>>>> builds of cross-platform libraries. These libraries can be ahead of >>>>> Wine's system libraries, behind them, or even built with custom
    patches.
    Accordingly we really don't want to load "our" freetype in place of >>>>> "their" freetype, or "theirs" in place of "ours". But because of the
    way
    the Win32 loader works, you can generally only have one DLL of a given >>>>> name loaded in a process, and further attempts to dlopen() [as it were] >>>>> "libfreetype-6.dll" will return the handle to the already loaded
    library, potentially breaking either Wine or the application.

    I don't know the details here, but my immediate thought when reading >>>> this is that you need some kind of namespace. I then found that linker >>>> namespaces are a thing, perhaps they would provide the solution for
    you. It sounds like the OpenGL shim loader solution listed on the
    glibc wiki might work for your use-case. Or perhaps the LD_AUDIT
    feature would also work.

    https://www.sourceware.org/glibc/wiki/LinkerNamespaces
    I agree with pabs, implementing name space is a good solution
    and will allow to be distrib friendly.

    Moreover it will be best if marking a library as wine system one could
    be done
    post build. We will prefer to not modify upstream (like libpng) source. >>>
    It is easier for us to apply small patch to upstream, or better in your >> case
    to add a post link linker script or even some compiler flag that will
    add some
    notes section to dll in order to mark it as use namespace system, or so >> on.

    The problem on windows side is well known as dll hell

    Renaming of the lib could be done post install. Moreover a crazy idea
    why not
    renaming system dll instead of libpng-2.0.0.dll as libpng-2.0.0.sll
    (note the
    version is manadaroty) Therefore we could use upstream source. Then add >> a
    small linker script that will rewrite the depends of libpng-2.0.0.sll
    to
    .sll file (aka binary sed s/.dll/.sll/g).

    then add a small wraper (shim) like said pab that load the .sll library, >> the
    best pratice will be a command tool that take the name of the sll and
    create
    magically the dll

    Therefore from distrib point of side we only changes the way we build the >>> package, it could be automated, it is scalable and it does not need to
    patch
    package by package. Only to add some linker script magic

    The problem isn't particularly about detecting what is and isn't a
    system library; I think we can come up with a reliable heuristic for
    that, without even needing linker namespaces or anything.

    The outstanding problem seems to be more about potentially breaking
    applications because they see two identically named DLLs loaded in the
    same process. Applications can and do trawl the internal loader state,
    although the Win32 loader also exposes some APIs so they don't even have >> to.

    It may also be that the aforementioned heuristic is too hacky to be
    accepted upstream into Wine.

    I do not propose to change the loader, i propose to change the link or post link stage of system library. You could rename the lib and change the dépend to new name after build. So you will have an unique name per system lib without changing the way you build these lib.

    It is équivalent to use a namespace resolved at late build time.


    Ah, so what you're proposing is that we do some sort of objcopy-like
    patching at runtime, e.g. when copying the dependency into the prefix.

    It probably won't be easy, but it might be more feasible than modifying
    the loader. I'll look into it...
    Yes sort of obcopy patching under linux it is called patchelf...

    If it work, it could be latter done in memory like paul wise suggest implementing namespace and LT_AUDIT (but it is a long term goal)
    1. capture library loading
    2. do the patching at loading time (using the same code then patchelf
    for pe replacing file read/write by mmap operation)

    And voila

    bastien

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastien ROUCARIES@21:1/5 to All on Wed Sep 8 01:30:02 2021
    Le mar. 7 sept. 2021 à 23:01, Paul Wise <pabs@debian.org> a écrit :

    On Tue, 2021-09-07 at 10:48 -0500, Zebediah Figura wrote:

    The outstanding problem seems to be more about potentially breaking applications because they see two identically named DLLs loaded in the
    same process. Applications can and do trawl the internal loader state, although the Win32 loader also exposes some APIs so they don't even have to.

    I might be wrong but I got the impression that runtime linker
    namespaces & LD_AUDIT are designed to solve this exact issue.
    Yes but it does not work for PE because win native application do
    messy stuff with lib loader...

    see dll hell for instance.

    Spec was wrong for the beginning for PE. And wine does not use the ELF
    loader but a homemade PE in order to be bug to bug compatible with
    windows.

    In the long term implementing a LT_AUDIT in the wine loader will be
    worthless, but in the short term elfpatch like approach could work.
    Python use it.

    Bastien

    --
    bye,
    pabs

    https://wiki.debian.org/PaulWise

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastien ROUCARIES@21:1/5 to All on Wed Sep 8 09:50:01 2021
    Hi,

    Adding smcv to the thread.

    Le mar. 7 sept. 2021 à 23:25, Bastien ROUCARIES
    <roucaries.bastien@gmail.com> a écrit :

    Le mar. 7 sept. 2021 à 21:16, Zebediah Figura
    <zfigura@codeweavers.com> a écrit :

    On 9/7/21 12:05 PM, Bastien ROUCARIES wrote:
    I disagree.

    Le mar. 7 sept. 2021 à 17:48, Zebediah Figura <zfigura@codeweavers.com> a
    écrit :

    On 9/7/21 5:16 AM, Bastien Roucariès wrote:
    Le mardi 7 septembre 2021, 00:44:31 UTC Paul Wise a écrit :
    On Mon, Sep 6, 2021 at 9:54 PM Zebediah Figura wrote:
    The basic problem is that applications can and often do ship with PE >>>>> builds of cross-platform libraries. These libraries can be ahead of >>>>> Wine's system libraries, behind them, or even built with custom
    patches.
    Accordingly we really don't want to load "our" freetype in place of >>>>> "their" freetype, or "theirs" in place of "ours". But because of the >> way
    the Win32 loader works, you can generally only have one DLL of a given
    name loaded in a process, and further attempts to dlopen() [as it were]
    "libfreetype-6.dll" will return the handle to the already loaded >>>>> library, potentially breaking either Wine or the application.

    I don't know the details here, but my immediate thought when reading >>>> this is that you need some kind of namespace. I then found that linker >>>> namespaces are a thing, perhaps they would provide the solution for >>>> you. It sounds like the OpenGL shim loader solution listed on the
    glibc wiki might work for your use-case. Or perhaps the LD_AUDIT
    feature would also work.

    https://www.sourceware.org/glibc/wiki/LinkerNamespaces
    I agree with pabs, implementing name space is a good solution
    and will allow to be distrib friendly.

    Moreover it will be best if marking a library as wine system one could >> be done
    post build. We will prefer to not modify upstream (like libpng) source. >>>
    It is easier for us to apply small patch to upstream, or better in your >> case
    to add a post link linker script or even some compiler flag that will >> add some
    notes section to dll in order to mark it as use namespace system, or so >> on.

    The problem on windows side is well known as dll hell

    Renaming of the lib could be done post install. Moreover a crazy idea >> why not
    renaming system dll instead of libpng-2.0.0.dll as libpng-2.0.0.sll
    (note the
    version is manadaroty) Therefore we could use upstream source. Then add
    a
    small linker script that will rewrite the depends of libpng-2.0.0.sll >> to
    .sll file (aka binary sed s/.dll/.sll/g).

    then add a small wraper (shim) like said pab that load the .sll library,
    the
    best pratice will be a command tool that take the name of the sll and >> create
    magically the dll

    Therefore from distrib point of side we only changes the way we build the
    package, it could be automated, it is scalable and it does not need to >> patch
    package by package. Only to add some linker script magic

    The problem isn't particularly about detecting what is and isn't a
    system library; I think we can come up with a reliable heuristic for
    that, without even needing linker namespaces or anything.

    The outstanding problem seems to be more about potentially breaking
    applications because they see two identically named DLLs loaded in the >> same process. Applications can and do trawl the internal loader state, >> although the Win32 loader also exposes some APIs so they don't even have >> to.

    It may also be that the aforementioned heuristic is too hacky to be
    accepted upstream into Wine.

    I do not propose to change the loader, i propose to change the link or post
    link stage of system library. You could rename the lib and change the dépend to new name after build. So you will have an unique name per system
    lib without changing the way you build these lib.

    It is équivalent to use a namespace resolved at late build time.


    Ah, so what you're proposing is that we do some sort of objcopy-like patching at runtime, e.g. when copying the dependency into the prefix.

    It probably won't be easy, but it might be more feasible than modifying
    the loader. I'll look into it...
    Yes sort of obcopy patching under linux it is called patchelf...

    If it work, it could be latter done in memory like paul wise suggest implementing namespace and LT_AUDIT (but it is a long term goal)
    1. capture library loading
    2. do the patching at loading time (using the same code then patchelf
    for pe replacing file read/write by mmap operation)

    And voila

    Simon, do you think you could implement a version of libcapasule for PE object ?

    Bastien

    bastien

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon McVittie@21:1/5 to Bastien ROUCARIES on Wed Sep 8 10:20:02 2021
    On Wed, 08 Sep 2021 at 07:31:59 +0000, Bastien ROUCARIES wrote:
    Simon, do you think you could implement a version of libcapasule for PE object ?

    Given that libcapsule is very glibc- and ELF-specific, doesn't work
    properly without new glibc feature work that isn't in Debian yet (I've
    lost track of whether/when it got merged upstream, it might be in 2.34)
    and wasn't written by me, the answer is likely to be no.

    As far as I understand it, the PE loader used for Wine is part of Wine,
    so it has total control over the libraries that it loads and how it loads
    them. This means that if Wine developers (the experts on this codebase)
    have decided a libcapsule-like approach isn't feasible or isn't desirable,
    they are probably right.

    More generally, if Wine developers wanted Wine's dependency libraries
    to be in one version of reality, and Windows DLLs to be in a different
    version of reality, then there's a straightforward way to do that:
    use ELF .so dependency libraries, like older versions of Wine did, and
    don't give them a representation in the PE layer. Presumably they have
    put in the work to move from ELF to PE dependency libraries because it
    has some compelling advantage, rather than creating work for themselves
    for no reason!

    smcv

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zebediah Figura@21:1/5 to Simon McVittie on Wed Sep 8 17:50:01 2021
    On 9/8/21 3:13 AM, Simon McVittie wrote:
    On Wed, 08 Sep 2021 at 07:31:59 +0000, Bastien ROUCARIES wrote:
    Simon, do you think you could implement a version of libcapasule for PE object ?

    Given that libcapsule is very glibc- and ELF-specific, doesn't work
    properly without new glibc feature work that isn't in Debian yet (I've
    lost track of whether/when it got merged upstream, it might be in 2.34)
    and wasn't written by me, the answer is likely to be no.

    As far as I understand it, the PE loader used for Wine is part of Wine,
    so it has total control over the libraries that it loads and how it loads them. This means that if Wine developers (the experts on this codebase)
    have decided a libcapsule-like approach isn't feasible or isn't desirable, they are probably right.

    More generally, if Wine developers wanted Wine's dependency libraries
    to be in one version of reality, and Windows DLLs to be in a different version of reality, then there's a straightforward way to do that:
    use ELF .so dependency libraries, like older versions of Wine did, and
    don't give them a representation in the PE layer. Presumably they have
    put in the work to move from ELF to PE dependency libraries because it
    has some compelling advantage, rather than creating work for themselves
    for no reason!

    Yeah, basically :-)

    The basic reason is that Wine is essentially trying to split itself into
    "PE" and "Unix" parts. The idea is that all of the "user" code is built
    in PE format, and only calls into unix code by making a sort of fake
    syscall. The "kernel" code is built in ELF format.

    There are a few basic reasons for doing this:

    * Many applications, mostly anti-cheat and anti-tamper engines, depend
    on our libraries actually being in PE format on disk, and matching that
    in memory. We used to have "fake" DLLs for this, but they weren't
    verisimilar enough.

    * Some of the important hosts for Wine have dropped support for 32-bit libraries or are going to drop it. Mac is the obvious example here, but
    many commercial Linux distributions also want to drop support. By
    limiting the surface through which code can transition between PE and
    Unix code, it becomes feasible to do 32-to-64 translation, where
    previously this was quite infeasible.

    * There's some demand for running Win32 debuggers under wine. These have
    always worked more than a little tenuously, but a couple of them are
    causing problems when they try to break in and unwind from Unix code. By
    acting like we're making actual syscalls, things work much better.

    Of the several dozen modules we have that currently call into Unix
    libraries, about half of them aren't going to use PE dependencies. Most
    of these have already been fully split into PE and Unix parts, including
    things like the socket layer and winegstreamer. This raises the
    question: why not just call into Unix for the other half as well? There
    are a few reasons:

    * Making fake syscalls is, like real syscalls, not cheap. It involves a
    full context switch into and out of Unix code.

    * Making callbacks from Unix code is difficult, and not cheap either.
    For some libraries this doesn't matter, but for others it really does.

    * Writing the wrappers between Unix and PE code involves some nontrivial
    work in itself. The smaller the interface is, the easier things are for us.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Wise@21:1/5 to Simon McVittie on Thu Sep 9 03:20:01 2021
    On 9/8/21 3:13 AM, Simon McVittie wrote:
    As far as I understand it, the PE loader used for Wine is part of Wine,
    so it has total control over the libraries that it loads and how it loads them. This means that if Wine developers (the experts on this codebase)
    have decided a libcapsule-like approach isn't feasible or isn't desirable, they are probably right.

    Could the PE loader add support for some sort of namespaces and then be
    told to load Wine dependencies within a Wine namespace?

    Does the Microsoft Windows loader support anything like this?

    Recompiling every PE library with special flags or renaming every PE
    library with a Wine prefix seems a bit tedious if just the PE loader
    and anything that requests Wine deps can use a namespace/capsule/etc.

    On Wed, 2021-09-08 at 10:42 -0500, Zebediah Figura wrote:

    The basic reason is that Wine is essentially trying to split itself into "PE" and "Unix" parts. The idea is that all of the "user" code is built
    in PE format, and only calls into unix code by making a sort of fake syscall. The "kernel" code is built in ELF format.

    There are a few basic reasons for doing this:

    Definitely seems like the right thing to do for Wine.

    --
    bye,
    pabs

    https://wiki.debian.org/PaulWise

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEYQsotVz8/kXqG1Y7MRa6Xp/6aaMFAmE5X5cACgkQMRa6Xp/6 aaNWzxAAkEOi1Lj5mGFrmEvSYhkJ2eQR5G53tOBzCBKLMnN4kvRR+HYVwWIkvp6A kv8KZuCQ5rXsp/op7vucpR69hXK8alM/bSZFrOAjEYjuqslaJ7hv6v/0zec7VkaV JV0s6ujDvr81h/6gTLxKrTVloRYM+td2VeqcekK1vsN/cd+x3d+0qPWMjIlqLrpG MX3MD1THoVoBr2A7XIDjkgyswuDRDRFApQtcKqlKR9wmwu7XO3QOUtAMdlPD871C 5lzIqODESh3WJ1Q4MHor6nXqCTKp/1QuWA49R1TkeXG8Tbf/4oxiJcgVgX8gL8HW cs/zmGGgJZyAmIS3uubTf70qLzXBWTAottZmSk4lovXiZMwf3z37ZyOvC1yZjcfQ +eWF0su6qv0TUh7iKz5iHHTLmutBH+TI9BuMjG8F4Knwcf0XkfCbnyLycYJ7eiI5 1488BfcCJM7X5NqOHmzznKIHsOUiXKolZBAd+O/Xht4erhLZ1ND/kCvtMIX7ZfGz btW5tSSW+MMFa00bveVBx3btSOm4mGUqu5gU/e/QUg/dgQLLqcC0L9QDY5xOs7sF EseQKujs9G+oweOPEavqE4dMONUS7bMXUKNzJ9qAwl4+DZdGacMaOwVz67wZBtHj 9dHLEYMGJ1fL8FbfowvpSz2RlpkMYBCd9a1iu7mnkoajNit5+xQ=
    =vdda
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zebediah Figura@21:1/5 to Paul Wise on Thu Sep 9 06:50:01 2021
    On 9/8/21 8:12 PM, Paul Wise wrote:
    On 9/8/21 3:13 AM, Simon McVittie wrote:
    As far as I understand it, the PE loader used for Wine is part of Wine,
    so it has total control over the libraries that it loads and how it loads
    them. This means that if Wine developers (the experts on this codebase)
    have decided a libcapsule-like approach isn't feasible or isn't desirable, >> they are probably right.

    Could the PE loader add support for some sort of namespaces and then be
    told to load Wine dependencies within a Wine namespace?

    Does the Microsoft Windows loader support anything like this?

    Recompiling every PE library with special flags or renaming every PE
    library with a Wine prefix seems a bit tedious if just the PE loader
    and anything that requests Wine deps can use a namespace/capsule/etc.


    The closest thing that Windows has is SxS, which is meant to solve I
    think some of the same problems (well, it's mainly meant to solve the versioning problem that Microsoft dug themselves into). The problem is
    that I believe it requires the namespace to be effectively hard-coded
    into the library in question, in the form of a manifest resource.

    Unfortunately, while thinking about the answer to this question, I
    realized another snag, which I think really does make using
    identically-named dynamic libraries impossible: if system library A
    loads system library B dynamically, i.e. does the equivalent of a
    dlopen(), we have no way of knowing which namespace to apply to it.
    [AFAICT dlmopen() has this problem too, and just isn't meant for that
    use case.] Even rewriting the import table doesn't help here.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zebediah Figura@21:1/5 to Paul Wise on Thu Sep 9 07:40:02 2021
    On 9/9/21 12:15 AM, Paul Wise wrote:
    On Wed, 2021-09-08 at 23:47 -0500, Zebediah Figura wrote:

    Unfortunately, while thinking about the answer to this question, I
    realized another snag, which I think really does make using
    identically-named dynamic libraries impossible: if system library A
    loads system library B dynamically, i.e. does the equivalent of a
    dlopen(), we have no way of knowing which namespace to apply to it.
    [AFAICT dlmopen() has this problem too, and just isn't meant for that
    use case.] Even rewriting the import table doesn't help here.

    While loading library A into a namespace Foo, the loader could set a
    process global variable containing the current namespace to load into,
    and then have the dlopen equivalent use namespace Foo in preference to
    the default namespace for the process. Then when library B is loaded it
    will go into namespace Foo. Once loading library B and A has completed
    the loader could revert to using the default namespace.

    Right, but we don't have any guarantee that library A will load library
    B in its constructor routines. In fact, if it's loading library B
    dynamically, it's probably not doing that.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Wise@21:1/5 to Zebediah Figura on Thu Sep 9 07:20:01 2021
    On Wed, 2021-09-08 at 23:47 -0500, Zebediah Figura wrote:

    Unfortunately, while thinking about the answer to this question, I
    realized another snag, which I think really does make using identically-named dynamic libraries impossible: if system library A
    loads system library B dynamically, i.e. does the equivalent of a
    dlopen(), we have no way of knowing which namespace to apply to it.
    [AFAICT dlmopen() has this problem too, and just isn't meant for that
    use case.] Even rewriting the import table doesn't help here.

    While loading library A into a namespace Foo, the loader could set a
    process global variable containing the current namespace to load into,
    and then have the dlopen equivalent use namespace Foo in preference to
    the default namespace for the process. Then when library B is loaded it
    will go into namespace Foo. Once loading library B and A has completed
    the loader could revert to using the default namespace.

    --
    bye,
    pabs

    https://wiki.debian.org/PaulWise

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEYQsotVz8/kXqG1Y7MRa6Xp/6aaMFAmE5mIcACgkQMRa6Xp/6 aaMn7A/+OEsgduU06wDWmg7FzQhMuWS6r7ln9qgsQIupr6cSPVatBTz5WjzDdb6o pmYUqwzLg+y5iSY0yCP2/8lit0sLdL0LaTohllYZTIzUD3e5Tc2eM2npj64PMuhW j4jLaaWZukbvzY23ioggzj+EMxd8r/9h31uvDVQWhaOl4w0uMgV+/3x7fzsEQ41p QDw8K5UdPi/bzsSGIsiA7VlHtjtvgUrSrbKHMyctFPFdPzQvEl4Xu9EuRHwr2/M/ RFJucO1mPw3moAtBH33bfEWnc+6ipRCHKMoxVAon5M6BBGFDGF2Hl3/Tb0tKZBMf 9y2ro/K6HzG0YwlxlV1OxmMMS8olLdEvYzayfC8TW1TXzG0KpYIg6Hc6EsEKbiww UlhrrcazDDdwJSngxEzvNxXQqVh7ZhUIXwETMy6imzvJMgkPpCtrDPvy2s6iyR9v noOaqc8EnI8lZfZA2kK4FWG4rBTPvmgXB4UpYJkLdVJ5PBBoycpfXpc12/Jt9AKC R1KfUyt1t0B5l7gZkiDjghWnSKJoR6hHPCqUEjKn787f9maGjmWapkPHJbreE8BX E2bOKM5pGYMQztY9LVYTDmbt53A7fjD1dxqiWxERcZsqmdCfljIxWHg+HvCotbfm FgHSGQnR4W2HpRYcftxA8JRptk/l1/c0B7foZmvwuyeoyhsIvNw=
    =QrPL
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Wise@21:1/5 to Zebediah Figura on Thu Sep 9 07:50:02 2021
    On Thu, 2021-09-09 at 00:39 -0500, Zebediah Figura wrote:

    Right, but we don't have any guarantee that library A will load library
    B in its constructor routines. In fact, if it's loading library B dynamically, it's probably not doing that.

    Can the loader tell which library asked it to load a library?
    Then the namespace could be inherited from the parent library.

    --
    bye,
    pabs

    https://wiki.debian.org/PaulWise

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEYQsotVz8/kXqG1Y7MRa6Xp/6aaMFAmE5n3AACgkQMRa6Xp/6 aaO2og/+N3qCLPv9oixg/kcWlIv95bJOP0zuIwtcMxjwpZOo8pqboieOoEMq5r9K tDvwvjfBZYgCqsyKjNp5DSTZSNgC9VpLkErHH3kKf2y+/rsi9hlappXojDY7PDgi lp2uOc8p9hFjcucCglh9szHm2rCEYpey3sOky3JlqnYVZkVDNL92kNRKjixW59aw h9Czus1660Fgy9UU6bt4/9NNxLviqdZD+azd+huc/4Mm1zQJz+NoW/rvEqSz7sHz B5MeRkkzCmYMl9gbSB+gWF07smjfaQeY0tVtrm4cgV8mDrCzGA3phEDK786Qdt8T d4dV8/6cUX9f36VQy8qFAmOUjqqBKnq3dX7KXZxdujCF4NTauEW3qDRRqiE1mEz8 94nslCMYYu6rSi+erg/Mg+Q3Y1u7Pb0/zMvcahowf54O67qPA4yC/ZxM6/3SuDxW rSmWhbr09WOmYdEWt0HMFAJwa65PF3Rh0Txhah4xh963vxBGpxYvTwpUqacjn7lP kxh5uKDevoo6sdOs91L0F+qoz6GUsmlO7DUwMW1CxPCtC8aKuWAAyATWbkksXzb/ IyfjUgB4/KzC27c6qEJf1FEmXMFcOCssgcvT2J/2bdIZgpdgJLWuqIfb8EXyt2dJ LvsHrh8Wu/n8W+KmAjAYc4gQSeO26v3+VHR0paqiLbTtayzUuVI=
    =w1vk
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zebediah Figura@21:1/5 to Paul Wise on Thu Sep 9 08:10:01 2021
    On 9/9/21 12:45 AM, Paul Wise wrote:
    On Thu, 2021-09-09 at 00:39 -0500, Zebediah Figura wrote:

    Right, but we don't have any guarantee that library A will load library
    B in its constructor routines. In fact, if it's loading library B
    dynamically, it's probably not doing that.

    Can the loader tell which library asked it to load a library?
    Then the namespace could be inherited from the parent library.


    Unfortunately, no. We have no way of knowing the caller.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Wise@21:1/5 to Zebediah Figura on Thu Sep 9 09:40:02 2021
    On Thu, 2021-09-09 at 00:59 -0500, Zebediah Figura wrote:

    Unfortunately, no. We have no way of knowing the caller.

    Can the PE loading mechanism do something like inject a fake dlopen
    function available only in the Wine namespace that just passes the Wine namespace to the dlmopen function? Or the same but for each library?

    --
    bye,
    pabs

    https://wiki.debian.org/PaulWise

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEYQsotVz8/kXqG1Y7MRa6Xp/6aaMFAmE5uIAACgkQMRa6Xp/6 aaNEtQ//TJm7+CnGy+mUZOlGLR+lTz/yZ3EQXq5oDlz1k+2Xpq4XPS2kBQCAOo8f EFCbkAzv2fM9UxPcoj5Qs08A7jc+9I98WPu2Gjj+pnQEqNVKtRUBgfHUrU5CabR9 DVe3DHQZeZvHnM1f/gPPVguvvlEREszbTx7xb5ixpSG/iti9VqJewYRQSRYyH1QA j8RAKM0sPKGzXmZaE0CB1YhfQQeC9Crzj4rCGMjuvZXRcSchw9qdizMIjtAeBRye NAyfp5wzjOirvhygwxCUuskIqUruqatQexCs1E1HuR1grWrXn/sKDwDl8m2JcX8z QNH3R/wVdowoNtvPg8MsSM45MSViq735IdpAJ9YegxihuiJCWqhTCcmoP2wUGsNB oL1Yq38F7c5THp4NFkyEwpGLVvQAnzAZA7CLqpoU6BMj+TqHZIeh8ByclvzrCjYf 4/1qhGQFnLgTXSR8jqTYTAkEDCCEzloRVt8AgQ+Zcy2mLucZGZJ1fZgqyyh9C6p3 AGxFgJT5ypE2qY+1Cc0ATE/ra0Nu+Gs4yuhB3EERAFRrJmBvN+vn1hPgd6mz+cVu igEvRckF9FCRtqhargrk8HHAK2BxMwZu3rUInnpSArIl0TPLzclFM7N3jpToA61x 5epNEfqunjFQQGabzNP8/9XXNyvBsDbNkegacfe6dT1BtbWxa3Y=
    =L+/v
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastien ROUCARIES@21:1/5 to All on Fri Sep 10 11:50:01 2021
    Le jeu. 9 sept. 2021 à 07:32, Paul Wise <pabs@debian.org> a écrit :

    On Thu, 2021-09-09 at 00:59 -0500, Zebediah Figura wrote:

    Unfortunately, no. We have no way of knowing the caller.

    Can the PE loading mechanism do something like inject a fake dlopen
    function available only in the Wine namespace that just passes the Wine namespace to the dlmopen function? Or the same but for each library?

    The problem is that windows apps particularly games try to check if
    mapped ram exec pages are from dll from disk and not modified in
    memory.

    Thus if we create namespace, this crappy software will stop to work
    except if we create or symlink a library with an unique name that the
    wine applications could fetch

    Note that windows use for libraryname only the basename not the
    fullpatch (zebediah could you confirm)

    I am proposing (for simplicity I call the problematic lib libpng that
    depends on libz)
    1. build like usual a libpng and libz. libpng depend on linbz
    2. copy libpng to libwinepng and libz to libwinez
    3 use a new patchpe command (like the patchelf command) to patch the
    depend of libwinepng
    So globally a post link time namespace (it will be better on debian
    side than to recompile and pass flags to library).

    You propose:
    1. build like usual a libpng and libz. libpng
    2 create symlink libwinepng -> libpng, liwinez->libz
    3. instruct the loader to load libwinepng privatly using namespace
    approach and do at run time the patchpe work

    I believe that your approach is technically superior but could be done
    on the top of my first approach and a second step.

    Zebediah could you please give use feedback from wine team ?

    If patchpe is workable (and I firmly believe it is), you could add a
    task to see if paul wise solution is workable and report here.

    Next step, will be to refine your proposal. For instance i really
    dislike the libpng libwinepng mapping I will prefer a mapping given as
    perlre
    and something that encode the wine ABI like s/^lib/lib-wineinternaluseABI1.0/g

    It will allow to create pkgconfig file for wine version of lib automatically

    Bastien

    --
    bye,
    pabs

    https://wiki.debian.org/PaulWise

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Wise@21:1/5 to Bastien ROUCARIES on Sat Sep 11 08:10:01 2021
    Disclaimer: I know precisely zero of the details here nor
    if the PE loader can support any of the below features.

    On Fri, 2021-09-10 at 09:23 +0000, Bastien ROUCARIES wrote:

    The problem is that windows apps particularly games try to check if
    mapped ram exec pages are from dll from disk and not modified in
    memory.

    The fake dlopen could presumably be provided by an on-disk DLL?
    The PE loader would just load the fake dlopen DLL first, like
    glibc does when you set the LD_PRELOAD environment variable.

    You propose:

    I'm not proposing any on-disk symlinks, renaming DLLs or any other
    changes to any PE DLLs, just loading into memory like dlmopen.

    The solution I'm thinking of looks something like this:

    src:libpng -> libpng16-16:$winarch -> /usr/lib/$wintriplet/libpng16.dll (requires Debian to support cross-only, partial and Windows arch types)

    PE loader sets up in-memory Wine namespace.

    PE loader loads into Wine namespace: /usr/lib/$windowstriplet/wine/fake-dlopen.dll

    PE loader loads Wine dependencies into Wine namespace.

    Some of the Wine dependencies call the Windows equivalent of dlopen,
    which resolves to the fake dlopen equivalent within the namespace,
    which calls the Windows equivalent of dlmopen("Wine", dll), which makes
    the PE loader load those libraries into the Wine namespace.

    PE loader finishes loading Wine dependencies and proceeds loading the
    PE file and its dependencies into the default namespace.

    Windows apps check mapped RAM pages and they show up correctly.
    The main issue would be that apps could check they run in Wine.
    OTOH the PE loader could also just hide the pages somehow?

    --
    bye,
    pabs

    https://wiki.debian.org/PaulWise

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEYQsotVz8/kXqG1Y7MRa6Xp/6aaMFAmE8RdUACgkQMRa6Xp/6 aaNYvg/9Fsjr+1fdf0Nbf5VHcZCK0+GC6QBlHb9/uaHxCz21yXpQm1Z7lvJF0oBm M9csrQi/JE11Qwpg4cCqr+nqy87i4GZ4UyXw2AdH+TtqH0+bhr/+xtgfysquiUqG phfVDi/zZ66jEmlJT4SgkhixPQmX8z82bzfB2jzx9f6rPA0yQeFc30wHUz0uF5K/ NhvuJ8HVZd2mBegw20MIOhDaBlpQm7PvLdLEHTcTV3OvIA12NrzXLhngVlgp3Jvm NvTz4z0Un3miJVnfN5jH+LvJMe6CkUptOsxXqk/+uXwz9SfHWrm+OnCgYBxKiF7L nXZ79J+ykZteirTFukUxEotJ6ILwNIDvaA9ZyiEG+3NCUejbTVULECJyrfGxXs0m xhphopNGWWOpMKkbMMlTwGcUDNmG/Kd6Mf2Fykr+SZDNOjaC6aDKtzUoW3GyNmgH laYK9DCwJL9XGbnyvkYie9uNK/9vMeNAdmqF6RIDPLllO1T6GQao8ljOHLCNTWo6 5J94NDtf/7z24yAPREMRa1MhUgM6dZnEv6aZagyA/l57Cy4hLvqXlZMk8N/FNBSy fvPCrS6hydG8LlJJoGwpf1EsucO4ZnFNuPm0F/94Mv4gK1oP3HF6rrZmc+kXis7p EUtdw3PNKNHBzNZVta9RZJOen9oBrNL2cblIck9TYWE1jgwUkcY=
    =RE3Z
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Adrian Bunk@21:1/5 to Zebediah Figura on Sat Sep 11 17:40:01 2021
    On Sat, Sep 04, 2021 at 08:17:53PM -0500, Zebediah Figura wrote:
    Hello all,

    I'm a contributor to the Wine project. To summarize the following mail, Wine needs special versions of some of its normal dependencies, such as libfreetype and libgnutls, built using the MinGW cross-compiler, and I'm sending out a mail to major distributions in order to get some feedback from our packagers on how these should be built and packaged.

    For a long time Wine has built all of its Win32 libraries (DLLs and EXEs) as ELF binaries. For various reasons related to application compatibility, we have started building our binaries as PE instead, using the MinGW cross-compiler. It is our intent to expand this to some of our dependencies as well. The list of dependencies that we intend to build using MinGW is not quite fixed yet, but we expect it to include and be mostly limited to the following:

    * libvkd3d
    * libFAudio
    * libgnutls
    * zlib (currently included via manual source import)
    * libmpg123
    * libgsm
    * libpng
    * libjpeg-turbo
    * libtiff
    * libfreetype
    * liblcms2
    * jxrlib

    and dependencies of the above packages (not including CRT dependencies,
    which Wine provides).
    ...
    Accordingly, although static linking and source imports are generally disprefered, it may quite likely be preferable in our case. We don't get the benefits of on-disk deduplication, since Wine is essentially the only piece of software which needs these libraries.
    ...

    How are distributions supposed to provide security support for Wine?

    As an example, Debian 10 that is security supported by Debian
    until next summer ships Wine 4.0.

    The libgnutls in Debian 10 has already been patched several times
    by Debian for CVE fixes.

    Having to patch several different versions of the same library
    in different packages multiplies the effort required to provide
    security support for a library.

    cu
    Adrian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastien ROUCARIES@21:1/5 to All on Sat Sep 11 20:10:01 2021
    Le sam. 11 sept. 2021 à 17:30, Adrian Bunk <bunk@debian.org> a écrit :

    On Sat, Sep 04, 2021 at 08:17:53PM -0500, Zebediah Figura wrote:
    Hello all,

    I'm a contributor to the Wine project. To summarize the following mail,
    Wine
    needs special versions of some of its normal dependencies, such as libfreetype and libgnutls, built using the MinGW cross-compiler, and I'm sending out a mail to major distributions in order to get some feedback
    from
    our packagers on how these should be built and packaged.

    For a long time Wine has built all of its Win32 libraries (DLLs and
    EXEs) as
    ELF binaries. For various reasons related to application compatibility,
    we
    have started building our binaries as PE instead, using the MinGW cross-compiler. It is our intent to expand this to some of our
    dependencies
    as well. The list of dependencies that we intend to build using MinGW is
    not
    quite fixed yet, but we expect it to include and be mostly limited to the following:

    * libvkd3d
    * libFAudio
    * libgnutls
    * zlib (currently included via manual source import)
    * libmpg123
    * libgsm
    * libpng
    * libjpeg-turbo
    * libtiff
    * libfreetype
    * liblcms2
    * jxrlib

    and dependencies of the above packages (not including CRT dependencies, which Wine provides).
    ...
    Accordingly, although static linking and source imports are generally disprefered, it may quite likely be preferable in our case. We don't get
    the
    benefits of on-disk deduplication, since Wine is essentially the only
    piece
    of software which needs these libraries.
    ...

    How are distributions supposed to provide security support for Wine?

    As an example, Debian 10 that is security supported by Debian
    until next summer ships Wine 4.0.

    The libgnutls in Debian 10 has already been patched several times
    by Debian for CVE fixes.

    Having to patch several different versions of the same library
    in different packages multiplies the effort required to provide
    security support for a library.


    Yes what why Paul and myself ask for partial arch. No static linking no
    embeded lib but we need answer from upstream.

    Note that windows application that use old library are not a concern from
    the debian si de

    Bastien


    cu
    Adrian



    <div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le sam. 11 sept. 2021 à 17:30, Adrian Bunk &lt;<a href="mailto:bunk@debian.org">bunk@debian.org</a>&gt; a écrit :<br></div><blockquote class="gmail_quote" style="
    margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sat, Sep 04, 2021 at 08:17:53PM -0500, Zebediah Figura wrote:<br>
    &gt; Hello all,<br>
    &gt; <br>
    &gt; I&#39;m a contributor to the Wine project. To summarize the following mail, Wine<br>
    &gt; needs special versions of some of its normal dependencies, such as<br> &gt; libfreetype and libgnutls, built using the MinGW cross-compiler, and I&#39;m<br>
    &gt; sending out a mail to major distributions in order to get some feedback from<br>
    &gt; our packagers on how these should be built and packaged.<br>
    &gt; <br>
    &gt; For a long time Wine has built all of its Win32 libraries (DLLs and EXEs) as<br>
    &gt; ELF binaries. For various reasons related to application compatibility, we<br>
    &gt; have started building our binaries as PE instead, using the MinGW<br>
    &gt; cross-compiler. It is our intent to expand this to some of our dependencies<br>
    &gt; as well. The list of dependencies that we intend to build using MinGW is not<br>
    &gt; quite fixed yet, but we expect it to include and be mostly limited to the<br>
    &gt; following:<br>
    &gt; <br>
    &gt; * libvkd3d<br>
    &gt; * libFAudio<br>
    &gt; * libgnutls<br>
    &gt; * zlib (currently included via manual source import)<br>
    &gt; * libmpg123<br>
    &gt; * libgsm<br>
    &gt; * libpng<br>
    &gt; * libjpeg-turbo<br>
    &gt; * libtiff<br>
    &gt; * libfreetype<br>
    &gt; * liblcms2<br>
    &gt; * jxrlib<br>
    &gt; <br>
    &gt; and dependencies of the above packages (not including CRT dependencies,<br>
    &gt; which Wine provides).<br>
    &gt;...<br>
    &gt; Accordingly, although static linking and source imports are generally<br> &gt; disprefered, it may quite likely be preferable in our case. We don&#39;t get the<br>
    &gt; benefits of on-disk deduplication, since Wine is essentially the only piece<br>
    &gt; of software which needs these libraries.<br>
    &gt;...<br>

    How are distributions supposed to provide security support for Wine?<br>

    As an example, Debian 10 that is security supported by Debian<br>
    until next summer ships Wine 4.0.<br>

    The libgnutls in Debian 10 has already been patched several times<br>
    by Debian for CVE fixes.<br>

    Having to patch several different versions of the same library<br>
    in different packages multiplies the effort required to provide<br>
    security support for a library.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Yes what why Paul and myself ask for partial arch. No static linking no embeded lib but we need answer from upstream.</div><div dir="auto"><br></div><
    div dir="auto">Note that windows application that use old library are not a concern from the debian si de</div><div dir="auto"><br></div><div dir="auto">Bastien</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0
    0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

    cu<br>
    Adrian<br>

    </blockquote></div></div></div>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Adrian Bunk@21:1/5 to Bastien ROUCARIES on Sun Sep 12 10:00:01 2021
    On Sun, Sep 05, 2021 at 08:53:49AM +0200, Bastien ROUCARIES wrote:
    ...
    Improve dpkg to support partial arch. I volonteer to implement none arch
    but i am waiting from guillem here.
    ...

    There is also plenty of infrastructure on the buildd, archive and
    release team sides that would likely need changes for supporting
    anything like that.

    A multilib based approach might be more realistic for bookworm.

    What benefits would a "none arch" even bring compared to building
    binary-all packages?
    The ability to binNMU is the only one that comes into my mind.

    cu
    Adrian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastien ROUCARIES@21:1/5 to All on Sun Sep 12 15:40:02 2021
    Le dim. 12 sept. 2021 à 07:38, Adrian Bunk <bunk@debian.org> a écrit :

    On Sun, Sep 05, 2021 at 08:53:49AM +0200, Bastien ROUCARIES wrote:
    ...
    Improve dpkg to support partial arch. I volonteer to implement none arch but i am waiting from guillem here.
    ...

    There is also plenty of infrastructure on the buildd, archive and
    release team sides that would likely need changes for supporting
    anything like that.

    A multilib based approach might be more realistic for bookworm.

    What benefits would a "none arch" even bring compared to building
    binary-all packages?
    The ability to binNMU is the only one that comes into my mind.
    we have at least 3 architectures that need uefi none arch...

    So we build three arch-all package with paterning name.



    cu
    Adrian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Adrian Bunk@21:1/5 to Bastien ROUCARIES on Sun Sep 12 16:10:01 2021
    On Sun, Sep 12, 2021 at 01:18:11PM +0000, Bastien ROUCARIES wrote:
    Le dim. 12 sept. 2021 à 07:38, Adrian Bunk <bunk@debian.org> a écrit :

    On Sun, Sep 05, 2021 at 08:53:49AM +0200, Bastien ROUCARIES wrote:
    ...
    Improve dpkg to support partial arch. I volonteer to implement none arch but i am waiting from guillem here.
    ...

    There is also plenty of infrastructure on the buildd, archive and
    release team sides that would likely need changes for supporting
    anything like that.

    A multilib based approach might be more realistic for bookworm.

    What benefits would a "none arch" even bring compared to building binary-all packages?
    The ability to binNMU is the only one that comes into my mind.
    we have at least 3 architectures that need uefi none arch...

    So we build three arch-all package with paterning name.

    I might be misunderstanding what you are trying to do.

    What release architecture would "none" packages be in the Debian
    archive, and on what buildds would they be built?

    Debian buildds are not cross-compiling packages for a different Debian architecture, a partial architecture would still require DSA-maintained
    buildds doing native building on this partial architecture.

    cu
    Adrian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Adrian Bunk@21:1/5 to Bastien ROUCARIES on Sun Sep 12 16:40:02 2021
    On Sun, Sep 12, 2021 at 01:57:44PM +0000, Bastien ROUCARIES wrote:

    I think you misunderstand: https://wiki.debian.org/Teams/Dpkg/Spec/FreestandingArches

    They are a full color gradiant between:
    - freestanding arches pure cross compile without any depends except arch:all - partial cross built arch
    - partial arch
    - full arch

    I believe the first step to get partial cross built arch is to begin
    by freestanding arch.

    I believe this is mostly irrelevant for the discussion about Wine.

    Making Wine in Debian depend on such lofty ideas that might be available
    very far in the future (if ever) would imply no Wine in the next Debian releases.

    Debian 12 will be released mid-2023, which is only 2 years away.
    Debian 13 will be released mid-2025, which is only 4 years away.

    If your partial cross built arch is ever fully implemented and supported
    by Debian it would be a good idea to migrate Wine to using that.

    But a realistic solution for Wine in Debian 12 has to be multilib,
    not multiarch.

    Bastien

    cu
    Adrian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastien ROUCARIES@21:1/5 to All on Sun Sep 12 16:20:02 2021
    Le dim. 12 sept. 2021 à 13:44, Adrian Bunk <bunk@debian.org> a écrit :

    On Sun, Sep 12, 2021 at 01:18:11PM +0000, Bastien ROUCARIES wrote:
    Le dim. 12 sept. 2021 à 07:38, Adrian Bunk <bunk@debian.org> a écrit :

    On Sun, Sep 05, 2021 at 08:53:49AM +0200, Bastien ROUCARIES wrote:
    ...
    Improve dpkg to support partial arch. I volonteer to implement none arch
    but i am waiting from guillem here.
    ...

    There is also plenty of infrastructure on the buildd, archive and
    release team sides that would likely need changes for supporting
    anything like that.

    A multilib based approach might be more realistic for bookworm.

    What benefits would a "none arch" even bring compared to building binary-all packages?
    The ability to binNMU is the only one that comes into my mind.
    we have at least 3 architectures that need uefi none arch...

    So we build three arch-all package with paterning name.

    I might be misunderstanding what you are trying to do.

    What release architecture would "none" packages be in the Debian
    archive, and on what buildds would they be built?

    Debian buildds are not cross-compiling packages for a different Debian architecture, a partial architecture would still require DSA-maintained buildds doing native building on this partial architecture.

    I think you misunderstand: https://wiki.debian.org/Teams/Dpkg/Spec/FreestandingArches

    They are a full color gradiant between:
    - freestanding arches pure cross compile without any depends except arch:all
    - partial cross built arch
    - partial arch
    - full arch

    I believe the first step to get partial cross built arch is to begin
    by freestanding arch.

    Bastien

    cu
    Adrian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastien ROUCARIES@21:1/5 to All on Sun Sep 12 17:20:02 2021
    Le sam. 11 sept. 2021 à 06:00, Paul Wise <pabs@debian.org> a écrit :

    Disclaimer: I know precisely zero of the details here nor
    if the PE loader can support any of the below features.

    On Fri, 2021-09-10 at 09:23 +0000, Bastien ROUCARIES wrote:

    The problem is that windows apps particularly games try to check if
    mapped ram exec pages are from dll from disk and not modified in
    memory.

    The fake dlopen could presumably be provided by an on-disk DLL?
    The PE loader would just load the fake dlopen DLL first, like
    glibc does when you set the LD_PRELOAD environment variable.

    You propose:

    I'm not proposing any on-disk symlinks, renaming DLLs or any other
    changes to any PE DLLs, just loading into memory like dlmopen.

    The solution I'm thinking of looks something like this:

    src:libpng -> libpng16-16:$winarch -> /usr/lib/$wintriplet/libpng16.dll (requires Debian to support cross-only, partial and Windows arch types)

    PE loader sets up in-memory Wine namespace.

    PE loader loads into Wine namespace: /usr/lib/$windowstriplet/wine/fake-dlopen.dll

    PE loader loads Wine dependencies into Wine namespace.

    Some of the Wine dependencies call the Windows equivalent of dlopen,
    which resolves to the fake dlopen equivalent within the namespace,
    which calls the Windows equivalent of dlmopen("Wine", dll), which makes
    the PE loader load those libraries into the Wine namespace.

    PE loader finishes loading Wine dependencies and proceeds loading the
    PE file and its dependencies into the default namespace.

    Seems that python do what you describe: https://svn.python.org/projects/python/trunk/PC/dl_nt.c
    Windows already implemented the name space called activation context.
    Need only windows XP or better but wine could offer the API

    Windows apps check mapped RAM pages and they show up correctly.
    The main issue would be that apps could check they run in Wine.
    OTOH the PE loader could also just hide the pages somehow?



    --
    bye,
    pabs

    https://wiki.debian.org/PaulWise

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Adrian Bunk@21:1/5 to Bastien ROUCARIES on Sun Sep 12 17:30:02 2021
    On Sun, Sep 12, 2021 at 02:57:20PM +0000, Bastien ROUCARIES wrote:
    Le dim. 12 sept. 2021 à 14:16, Adrian Bunk <bunk@debian.org> a écrit :

    On Sun, Sep 12, 2021 at 01:57:44PM +0000, Bastien ROUCARIES wrote:

    I think you misunderstand: https://wiki.debian.org/Teams/Dpkg/Spec/FreestandingArches

    They are a full color gradiant between:
    - freestanding arches pure cross compile without any depends except arch:all
    - partial cross built arch
    - partial arch
    - full arch

    I believe the first step to get partial cross built arch is to begin
    by freestanding arch.

    I believe this is mostly irrelevant for the discussion about Wine.

    Making Wine in Debian depend on such lofty ideas that might be available very far in the future (if ever) would imply no Wine in the next Debian releases.

    Debian 12 will be released mid-2023, which is only 2 years away.
    Debian 13 will be released mid-2025, which is only 4 years away.

    If your partial cross built arch is ever fully implemented and supported
    by Debian it would be a good idea to migrate Wine to using that.

    But a realistic solution for Wine in Debian 12 has to be multilib,
    not multiarch.
    Yes but current solution used by wine should be compatible with
    multiarch. And It was since 2012 that multiarch exists. Maybe time to
    speed up

    I do consider it quite evil how you are trying to steer upstream and
    Debian maintainers of Wine in a direction where Wine would be taken
    hostage for some lofty idea you have.

    bastien

    cu
    Adrian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Kitt@21:1/5 to Adrian Bunk on Sun Sep 12 17:40:02 2021
    On Sun, 12 Sep 2021 10:38:52 +0300, Adrian Bunk <bunk@debian.org> wrote:

    On Sun, Sep 05, 2021 at 08:53:49AM +0200, Bastien ROUCARIES wrote:
    ...
    Improve dpkg to support partial arch. I volonteer to implement none arch but i am waiting from guillem here.
    ...

    There is also plenty of infrastructure on the buildd, archive and
    release team sides that would likely need changes for supporting
    anything like that.

    A multilib based approach might be more realistic for bookworm.

    What benefits would a "none arch" even bring compared to building
    binary-all packages?
    The ability to binNMU is the only one that comes into my mind.

    IMO the main benefit of using multiarch would be that packages could be built for the new architectures without changes (ideally). libz is currently built for MinGW-w64 in an “Architecture: all” package, but it’s a separate source
    package; various other libraries are built with specific support in their source packages. While one could imagine adding support to all the appropriate source packages to build similar “Architecture: all” packages, that would require convincing all the relevant maintainers, and it would end up tying
    the testing migrations to MinGW-w64...

    In this scenario the solution wouldn’t be a “none” arch, but a Windows arch,
    if we can ever resolve https://bugs.debian.org/606825

    The buildd situation isn’t necessarily that much of an obstacle: it seems to me we could have “Windows” buildds which are really Linux amd64 systems, that
    cross-build for Windows.

    Regards,

    Stephen

    -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCgAdFiEEnPVX/hPLkMoq7x0ggNMC9Yhtg5wFAmE+HV0ACgkQgNMC9Yht g5yRcw/+N4OF2brJmHuHNRIxeeNmvw3johvG7H2rig8OnnLGheeXfztPb60fXuEC ECJM76IH+P43pIg7bivMMLz5s8qPnKKWTkPbEeZihvRYXD+v/1MS4evVUEKx7vEz VQFhKeWgKdjCP4SmevKRMIjtEbjDBHiKv52KzVWRbKav7VUc0OvkBDYEWRoOqGlR W8OcSHrisH/CAzD/g8aHoWSWLaV+P3VM7uGt78tpncJrvpoY4FPNJVodd9KJx0Y7 2BQDd3g6POa+Ulbc5fB9xWK1aIU1+FSmgshsgPOKrh/IR0piCic0v8raKPQaUz0a 1zY67vmpxMbZzMtJG0UoDPWWiHMNZufbHGCBsgPjmW30TUt0yq+AaPN5GrAUFaSC TrhOLmR3FUtd/MdpQK/FBQjVvonKMmTWDhP6ue97bpgtiOqMRDKQQcx+ueYQY51o d9PW69ZS5aj4gvEdQDTDCOT+GSTECspbF8JnWp4DnBXzTnU7KJ96SkGrnqP/QwHi ubppPgjCu7oExhiVzLOdXcHY/koy7wndkJYTwoKSXI0nCaFHsAFPHkDVGM8R76IT eCEaGTXTlDUDKtJW4TzRwn6ZJ/zkIVwgfZ+Mzuk3wAvcxR34vkr/QFZ5O/xjbI+8 RuXI22dLQCE9qisxm6UV6WZavPmOYet/1IrZWup7z5QAMCpg2Wk=
    =qoJQ
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Kitt@21:1/5 to Adrian Bunk on Sun Sep 12 19:10:02 2021
    On Sun, 12 Sep 2021 19:20:16 +0300, Adrian Bunk <bunk@debian.org> wrote:
    On Sun, Sep 12, 2021 at 05:31:41PM +0200, Stephen Kitt wrote:
    ...
    While one could imagine adding support to all the appropriate
    source packages to build similar “Architecture: all” packages, that would
    require convincing all the relevant maintainers,

    Adding a new release architecture (partial or not) requires convincing
    the ftp team and the release team.

    It would also require many software changes.

    Yes, it would. However, it requires convincing a well-defined set of people *once*. If we handle Windows dependencies using “Architecture: all” packages,
    we would either end up with something like Fedora’s MinGW-w64 SIG (with a complete set of independent packages), or we would end up having to convince
    a huge set of package maintainers over and over again.

    How would for example the dependencies of wine:amd64 be fulfilled?

    Just supporting that package dependencies might only be fulfilled by
    also using packages from a different architecture would require changes
    in many places, like for example the testing migration scripts that
    ensure installability after migration.

    In the same way as the none-arch packages would be. Yes, it’s a lot of work, but it’s useful for more than just Wine, and it can be done once for all the interested architectures.

    and it would end up tying the testing migrations to MinGW-w64...

    If this partial arch (and Wine) should be part of Debian releases,
    then testing migrations would have to be tied to it in any case.

    True, I’d missed that. (In my mind I was comparing this with having separate source packages.)

    ...
    The buildd situation isn’t necessarily that much of an obstacle: it seems to me we could have “Windows” buildds which are really Linux amd64 systems, that cross-build for Windows.

    The first obstacle is that if you want to be the first who does cross building packages on the buildds, there is likely a lot of work and bugfixing ahead for you for getting that working.

    A lot of that work has already been done for http://crossqa.debian.net/

    Fixing this would reduce the burden on all the maintainers who currently
    handle cross-built packages in the archive, so overall I think it would be a net win.

    Regards,

    Stephen

    -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCgAdFiEEnPVX/hPLkMoq7x0ggNMC9Yhtg5wFAmE+MvoACgkQgNMC9Yht g5wf+g//c/i2KTYzPcMPjdGKJGjZ+2QbU0MT2ziNVZWuGFPrpPZarXJqoNaiz8dp yuHCmi27qsxa3xQYH+HB8MrhRa8nFjwhjNDtPvPd6bKLK2hp9uaWBlTO/EZ9V8C4 1T3d40TI5JOEQ5TW+n7mCCYw02qw9b4l5A/wHDA1u1MWV+Diqs0SXI5b5HNVwgqd 4nV8i8TkbL0G82619/w86SGpgPR4CNup8hBU09V3o4TrYEmkYUppX+B3fsQUziwI BLB7yqIfJTVbCxd2m0j6Wo70uVMJOIViFTiq6YilwSpO51JXHcxhPO5MbCk3DHg6 cjFP7mB4tNBk1euzqoL5AgOI7wVdSS02NNNuRCr57LsOy3nXA+i2AJyApQH7zS6v y/3e+pfGcPOxqyOhb50JWlJO+22hYyu6Qcdz9qWzlt5L0muRlSwlglU1UxhQnvS8 kQux7Ijq8gSy2qJW16C6W5ESDJZMgprKf7SY+zn2ofCRrLi/lxZDG3hlLVu4PT3h uVoA/SY4BDMIvTru9hfc5dDSbcxp3CDu9CojJkV8/l7dWle6ZYUtewo7Ho9LVP3E oZ51il7Ti6yPlccjyopGB8iWzfwRPe2yAruw1FuBXdNIeXffKUg7ETtuG7li5NtV TqpF9OKI5Ptlus+39zJm1W8tPoOiAVfTQAuhos6LR/+uDJfWhEk=
    =BGhg
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Adrian Bunk@21:1/5 to Stephen Kitt on Sun Sep 12 18:40:01 2021
    On Sun, Sep 12, 2021 at 05:31:41PM +0200, Stephen Kitt wrote:
    ...
    While one could imagine adding support to all the appropriate
    source packages to build similar “Architecture: all” packages, that would require convincing all the relevant maintainers,

    Adding a new release architecture (partial or not) requires convincing
    the ftp team and the release team.

    It would also require many software changes.

    How would for example the dependencies of wine:amd64 be fulfilled?

    Just supporting that package dependencies might only be fulfilled by
    also using packages from a different architecture would require changes
    in many places, like for example the testing migration scripts that
    ensure installability after migration.

    and it would end up tying the testing migrations to MinGW-w64...

    If this partial arch (and Wine) should be part of Debian releases,
    then testing migrations would have to be tied to it in any case.

    ...
    The buildd situation isn’t necessarily that much of an obstacle: it seems to
    me we could have “Windows” buildds which are really Linux amd64 systems, that
    cross-build for Windows.

    The first obstacle is that if you want to be the first who does cross
    building packages on the buildds, there is likely a lot of work and
    bugfixing ahead for you for getting that working.

    Regards,

    Stephen

    cu
    Adrian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Adrian Bunk@21:1/5 to Stephen Kitt on Sun Sep 12 20:20:01 2021
    On Sun, Sep 12, 2021 at 07:03:54PM +0200, Stephen Kitt wrote:
    On Sun, 12 Sep 2021 19:20:16 +0300, Adrian Bunk <bunk@debian.org> wrote:
    On Sun, Sep 12, 2021 at 05:31:41PM +0200, Stephen Kitt wrote:
    ...
    While one could imagine adding support to all the appropriate
    source packages to build similar “Architecture: all” packages, that would
    require convincing all the relevant maintainers,

    Adding a new release architecture (partial or not) requires convincing
    the ftp team and the release team.

    It would also require many software changes.

    Yes, it would. However, it requires convincing a well-defined set of people *once*. If we handle Windows dependencies using “Architecture: all” packages,
    we would either end up with something like Fedora’s MinGW-w64 SIG (with a complete set of independent packages), or we would end up having to convince a huge set of package maintainers over and over again.

    Based on the package list provided in the initial email in this thread
    (and guessing the amount of transitive dependencies) I would have guessed
    that there are perhaps ~ 30 packages that would have to be touched once.

    And after that things will just continue working, just like with udebs
    which are in some ways similar to what is being discussed here.

    How would for example the dependencies of wine:amd64 be fulfilled?

    Just supporting that package dependencies might only be fulfilled by
    also using packages from a different architecture would require changes
    in many places, like for example the testing migration scripts that
    ensure installability after migration.

    In the same way as the none-arch packages would be. Yes, it’s a lot of work,
    but it’s useful for more than just Wine, and it can be done once for all the
    interested architectures.

    It is also the kind of change where it might be required that it is
    fully supported in one release before it can be used by packages in the
    next release, if for example any of dpkg/apt/aptitude/... in the
    previous stable gives an error when seeing dependencies to another architecture.

    ...
    Regards,

    Stephen

    cu
    Adrian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Bastien ROUCARIES on Mon Sep 13 17:50:01 2021
    I believe I can speak with my "main cross building porter" hat on.

    On Sun, Sep 12, 2021 at 01:57:44PM +0000, Bastien ROUCARIES wrote:
    They are a full color gradiant between:
    - freestanding arches pure cross compile without any depends except arch:all - partial cross built arch
    - partial arch
    - full arch

    I believe the first step to get partial cross built arch is to begin
    by freestanding arch.

    Certainly not. As much as I would love to see this happen, it is very unrealistic. wine can quite simply use -$arch-cross:all packages like
    very other bare metal target and switch to our pipe dream once it is
    ready (if ever).

    cross building is very far off becoming the thing you want it to be. It presently has a bus factor of around 1.5. Around 59% of source packages
    are cross-satisfiable. Around 78% of cross-satisfiable packages are
    cross buildable. In other words: less than 50% of packages are cross
    buildable. Beyond that, the cross porters cannot keep up with the
    current rate of regressions. Fractions are falling.

    To make cross building a viable thing we'd need at least three more
    porters determined to make it happen. Talk doesn't make it happen.
    Patches do. Let me know if you want to help. I'll get you started.

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Kitt@21:1/5 to Adrian Bunk on Mon Sep 13 20:30:02 2021
    On Sun, 12 Sep 2021 20:54:56 +0300, Adrian Bunk <bunk@debian.org> wrote:
    On Sun, Sep 12, 2021 at 07:03:54PM +0200, Stephen Kitt wrote:
    On Sun, 12 Sep 2021 19:20:16 +0300, Adrian Bunk <bunk@debian.org> wrote:
    On Sun, Sep 12, 2021 at 05:31:41PM +0200, Stephen Kitt wrote:
    ...
    While one could imagine adding support to all the appropriate
    source packages to build similar “Architecture: all” packages, that would require convincing all the relevant maintainers,

    Adding a new release architecture (partial or not) requires convincing the ftp team and the release team.

    It would also require many software changes.

    Yes, it would. However, it requires convincing a well-defined set of
    people *once*. If we handle Windows dependencies using “Architecture: all” packages, we would either end up with something like Fedora’s MinGW-w64 SIG (with a complete set of independent packages), or we would end up having to convince a huge set of package maintainers over and over again.

    Based on the package list provided in the initial email in this thread
    (and guessing the amount of transitive dependencies) I would have guessed that there are perhaps ~ 30 packages that would have to be touched once.

    ... which means ~30 maintainers who need convincing individually. My
    experience so far is that maintainers tend not to be interested (justifiably) in Windows cross-builds.

    And after that things will just continue working, just like with udebs
    which are in some ways similar to what is being discussed here.

    udebs are mostly a packaging concern. Keeping Windows cross-builds working tends to require a bit more effort unfortunately.

    How would for example the dependencies of wine:amd64 be fulfilled?

    Just supporting that package dependencies might only be fulfilled by also using packages from a different architecture would require changes in many places, like for example the testing migration scripts that ensure installability after migration.

    In the same way as the none-arch packages would be. Yes, it’s a lot of work, but it’s useful for more than just Wine, and it can be done once for all the interested architectures.

    It is also the kind of change where it might be required that it is
    fully supported in one release before it can be used by packages in the
    next release, if for example any of dpkg/apt/aptitude/... in the
    previous stable gives an error when seeing dependencies to another architecture.

    That is indeed a good point, thanks for bringing it up!

    Regards,

    Stephen

    -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCgAdFiEEnPVX/hPLkMoq7x0ggNMC9Yhtg5wFAmE/ltAACgkQgNMC9Yht g5wHmA/+L/4dUDQgMiWn9Cup6uKZ9jdpkq3n5yXTiutFxqEa52DpcGivnONqGFij gewv6DdlJ0w8HfNcTMcmO4qi8Y0vjXHQfhCjTkvNida7qnAehLUQiRx1pxQqV7ht jDiE62/w2dButeeRMNOIyccmVRqTeU5JyVHAKxG/WyN/i2dm4+i38yQUpnua1yWh Qf90k6sdcmX08EA8m3As1xhTg8xcVQW7kT0dcZHcgA9KkhaCFid1nK9sn5ADKOYG AzgMJfqvb8/w31uEscKJpRhILOTbZcZUV7nu2QdnwO947kcXWI29cq85zu3vqccv JKzoITjeukXgaKyhwhM9hltZ6jCXqmEf2me39yoceyEQ2XAOs6xz3KQw/FbOZFFi hGhbzoBVVL9b+YIWH2b+Z3AcwEx0fEt32aeni68570DfzM/76D9opr0ZBdR66fZf 92X6LPJ0y3iDTjz93ehqwbZZAYRaEX+E0pYg3fHkZwVBBO75Ewrjy0BWHMnPSsjS uM+zK3N+sCpLxQyPFWJGuBuxqjj9Y5Te0udMmBaVMj+y1mi/z6Tr3G3uM/jVyHr2 SOF0tcL/cx2H7g+YAiGxpHCdYBvKWgbhU9sbFtvgSpKrL+WB9fw7TzfK5nou+3/n xC58/M3V8VnVGxfL52xveTrNSG8ERQIV9HqvYhmfxIyjumFY4Yk=
    =sY/M
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Kitt@21:1/5 to Helmut Grohne on Mon Sep 13 20:20:02 2021
    On Mon, 13 Sep 2021 17:39:25 +0200, Helmut Grohne <helmut@subdivi.de> wrote:
    I believe I can speak with my "main cross building porter" hat on.

    On Sun, Sep 12, 2021 at 01:57:44PM +0000, Bastien ROUCARIES wrote:
    They are a full color gradiant between:
    - freestanding arches pure cross compile without any depends except arch:all
    - partial cross built arch
    - partial arch
    - full arch

    I believe the first step to get partial cross built arch is to begin
    by freestanding arch.

    Certainly not. As much as I would love to see this happen, it is very unrealistic. wine can quite simply use -$arch-cross:all packages like
    very other bare metal target and switch to our pipe dream once it is
    ready (if ever).

    And even that assumes that we can get agreement on what $arch should be for Windows targets :-(.

    cross building is very far off becoming the thing you want it to be. It presently has a bus factor of around 1.5. Around 59% of source packages
    are cross-satisfiable. Around 78% of cross-satisfiable packages are
    cross buildable. In other words: less than 50% of packages are cross buildable. Beyond that, the cross porters cannot keep up with the
    current rate of regressions. Fractions are falling.

    The bus factor is indeed a problem. For Wine (and even a wider MinGW-w64 ecosystem) we don’t need all that many source packages to be cross-satisfiable for the whole endeavour to be useful...

    The regressions are significant though: if packages can’t stay cross-satisfiable for Debian cross-targets, there’s little hope they can stay cross-satisfiable for Windows! This means that separate source packages are probably the only viable option.

    To make cross building a viable thing we'd need at least three more
    porters determined to make it happen. Talk doesn't make it happen.
    Patches do. Let me know if you want to help. I'll get you started.

    Is the process documented anywhere? Or does one simply pick a failure from http://crossqa.debian.net and figure out what’s going wrong (and hope that pulling the threads doesn’t reveal a monster...)?

    Regards,

    Stephen

    -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCgAdFiEEnPVX/hPLkMoq7x0ggNMC9Yhtg5wFAmE/ljMACgkQgNMC9Yht g5zxJg//XQUPLnBqu/gICSO5OfqVTH1A05u7ENBwAUJZgXbdbQ5IkSIa/XhWqqSG Fr+m8NDzjKgYIAM3TCnCHKoWw3EoGaJroeP7sfxrjz+u7rvOJjGp3lWE2RhqAFRw 8F35DZIf1qF0gFSkTIbhLB1NtHsPduY1xeGgp0BrhlzwDT31X6YvyMttIccSt28K hxfYcdPr6ndBq3HZwhuOg4fU668yBku74fsp0eGvQo11vfWqxaIXVayaC5MraMpC ks+nXlevf/hMTrVOPBQ8hkHo4rxcTt0/4CfEfGViGtarm7u/CjU4zhUbNCxVyH1R jziFXt1k4MTrm1EMUJXUCrFJk+937JaDgC3OyIlhkamnaxUEDLSFx/j+TeEOSlRK 7qGoj8gttM58cfvIZc/nbmmKGGKJ3+0CRZEkCtj2PRvuD3G8lPaJj/lDudlZRigr pJbwY8eYgL8kAEgIV/oJ60QwVSA/FfVhwMmXsCFIPxp5O3iXQh2BXX+omMNFzm46 c9SA3bkx9bRT9Pdm7brpS55CB7ta0Ry+9z+In8mjMy9b4c8VI+QU+27NUBfJUb1c v1FNbl/vrJ0ElBGnAlM6+r78GrpZ2y3G67NtrbXiR7/zlNkQvzoBve1MJ1H8/hte njnQJ/Mr1hILjwtGwXJFp4Fn5+GII2QaeEpl3xEg/nu30RQxW0M=
    =3vak
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Stephen Kitt on Mon Sep 13 22:10:02 2021
    On Mon, Sep 13, 2021 at 08:19:31PM +0200, Stephen Kitt wrote:
    Is the process documented anywhere? Or does one simply pick a failure from http://crossqa.debian.net and figure out what’s going wrong (and hope that pulling the threads doesn’t reveal a monster...)?

    That describes the process quite well. In particular, crossqa.d.n links
    to existing bug reports to avoid duplication of work. A major lack
    (beyond people doing the work) is domain-specific knowledge of the
    various archive sections. So once you locate a monster, don't stop
    there, but contact debian-cross@lists.debian.org or
    #debian-bootstrap@oftc and let us combine your domain-specific knowledge
    with some cross compilation experience to create an original solution.
    So yeah, start with those packages that you know well.

    Check http://crossqa.debian.net/src/<sourcepackagename> for your pet
    packages or follow the "cross" link in the right sidebar at
    tracker.d.o. Also (thanks to IOhannes zmölnig) enable cross building in
    your salsa-ci pipeline.

    In any case though, don't let wine wait for cross building to become a
    thing.

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Adrian Bunk@21:1/5 to Stephen Kitt on Mon Sep 13 22:30:01 2021
    On Mon, Sep 13, 2021 at 08:19:31PM +0200, Stephen Kitt wrote:
    ...
    For Wine (and even a wider MinGW-w64
    ecosystem) we don’t need all that many source packages to be cross-satisfiable for the whole endeavour to be useful...

    But you would still need to create and maintain the whole
    infrastructure.

    The larger picture is that there are at least 3 big topics:
    - cross-architecture dependencies
    - partial release architectures
    - cross-building a release architecture

    Every single of these topics would be a huge amount of work.

    If you need all 3 as basis for a solution for Wine,
    then that's simply not realistic in the foreseeable future.

    The regressions are significant though: if packages can’t stay cross-satisfiable for Debian cross-targets, there’s little hope they can stay
    cross-satisfiable for Windows! This means that separate source packages are probably the only viable option.
    ...

    Separate source packages don't bring any real benefits compared to
    just bundling and building everything in src:wine.

    Either would likely imply that Wine in Debian comes without security
    support, and the Release Notes stating that Wine should only be used
    for trusted local contents.

    Regards,

    Stephen

    cu
    Adrian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastien ROUCARIES@21:1/5 to All on Mon Sep 13 23:00:02 2021
    Le lun. 13 sept. 2021 à 20:24, Adrian Bunk <bunk@debian.org> a écrit :

    On Mon, Sep 13, 2021 at 08:19:31PM +0200, Stephen Kitt wrote:
    ...
    For Wine (and even a wider MinGW-w64
    ecosystem) we don’t need all that many source packages to be cross-satisfiable for the whole endeavour to be useful...

    But you would still need to create and maintain the whole
    infrastructure.

    The larger picture is that there are at least 3 big topics:
    - cross-architecture dependencies
    - partial release architectures
    - cross-building a release architecture

    Every single of these topics would be a huge amount of work.

    If you need all 3 as basis for a solution for Wine,
    then that's simply not realistic in the foreseeable future.

    The regressions are significant though: if packages can’t stay cross-satisfiable for Debian cross-targets, there’s little hope they can stay
    cross-satisfiable for Windows! This means that separate source packages are probably the only viable option.
    ...

    Separate source packages don't bring any real benefits compared to
    just bundling and building everything in src:wine.

    No please do not do that. Vendoring is bad and I fight on the
    javascript side since four years, against it.

    Either would likely imply that Wine in Debian comes without security
    support, and the Release Notes stating that Wine should only be used
    for trusted local contents.

    Regards,

    Stephen

    cu
    Adrian


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Adrian Bunk@21:1/5 to Bastien ROUCARIES on Mon Sep 13 23:40:01 2021
    On Mon, Sep 13, 2021 at 08:38:52PM +0000, Bastien ROUCARIES wrote:
    Le lun. 13 sept. 2021 à 20:24, Adrian Bunk <bunk@debian.org> a écrit :
    On Mon, Sep 13, 2021 at 08:19:31PM +0200, Stephen Kitt wrote:
    ...
    The regressions are significant though: if packages can’t stay cross-satisfiable for Debian cross-targets, there’s little hope they can stay
    cross-satisfiable for Windows! This means that separate source packages are
    probably the only viable option.
    ...

    Separate source packages don't bring any real benefits compared to
    just bundling and building everything in src:wine.

    No please do not do that. Vendoring is bad and I fight on the
    javascript side since four years, against it.
    ...

    Separate source packages that duplicate existing sources are as much
    vendoring as doing the same inside src:wine.

    There are only two realistic options for Wine:
    1. building multilib packages from the regular sources
    of the libraries in the archive, or
    2. vendoring

    Noone seems to be willing to do 1., which leaves 2. as only option.

    cu
    Adrian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zebediah Figura@21:1/5 to All on Sun Apr 17 02:30:01 2022
    Hello all,

    Since this conversation several months ago I've been working with the
    Wine maintainer on implementing a solution upstream that is compatible
    with our requirements and the pretty much universal desire by packagers
    to avoid system library imports. I believe I've found a solution that
    will work for now for everyone, although it has raised some questions
    about standardization of MinGW packages—see the "Open Questions" section
    of this mail for more details.

    == Summary of upstream progress ==

    Currently Wine bundles the source of several libraries. At the same
    time, as was discussed we've implemented a system upstream by which
    external shared libraries can be linked to and loaded (while keeping
    them in a separate "namespace" so that they don't conflict with
    identically named application DLLs.) There are still some concerns on
    the Wine side that this will break applications in subtle ways, but unfortunately there has been almost no testing of this feature yet.

    The libraries which we import are as follows:

    * libFAudio
    * libgsm
    * libjpeg
    * jxrlib
    * liblcms2
    * libmpg123
    * libpng
    * libtiff
    * libvkd3d
    * libxml2
    * libxslt
    * zlib

    This list is probably going to remain stable. Despite what was discussed earlier I do *not* forsee us importing libOSMesa (it turns out that it
    actually makes more sense on the Win32 "kernel" side). An import of
    libfreetype or libgnutls is also unlikely at this point (we've found it
    more worthwhile to write thunks for both).

    We currently do *not* support external static linking. The basic reason
    for this is that Wine builds against its own CRT rather than MinGW's,
    and we cannot safely statically link to a module built with a different CRT.

    == Technical details ==

    In order to use system shared libraries, Wine needs to know where to
    find them at runtime. This is done with a configure argument:

    configure --with-system-dllpath=/first/directory/:/second/directory/

    Note that this may need to include the location of libgcc_s and other dependencies, which is in a different location on Debian.

    Separately, for each argument, we need to know the compiler and linker
    flags used to find the library. This also can be done with configure
    arguments, much like for native libraries:

    configure GSM_PE_CFLAGS="-Iwhatever" GSM_PE_LIBS="-Lwhatever -lgsm"

    If MinGW pkg-config is present, and --with-system-dllpath is specified,
    Wine will automatically use it to detect the compiler and linker flags
    for all of the above packages supporting pkg-config, which in particular excludes libgsm and jxrlib. Thus in practice it should not be necessary
    to hand-code most CFLAGS and LIBS variables.

    == Open Question(s) ==

    Currently it's necessary to use a configure argument to specify where to
    find the runtime path. This is fine for distributions, which is where
    most people are going to be getting Wine anyway. It's a bit unfortunate
    for anyone self-compiling Wine, though, and it'd be nice if there was
    some way to avoid it. Unfortunately, there are two things standing in
    our way.

    The first problem is that the location of runtime DLLs varies wildly
    between distributions, and there's no common independent way to detect
    it. We could potentially hardcode a few "guesses" at the runtime path
    into Wine's configure script, but that brings us to the second problem:
    there's no way to verify the presence of runtime DLLs. We *are* the
    loader and lower-level APIs and would have to bootstrap ourselves first,
    and this is pretty much infeasible. Verifying by name doesn't really
    work either, since the name isn't really predictable.

    Hence "standardize the location of runtime DLLs across distributions"
    isn't really a feasible solution either (or at least not a complete
    one), as nice as it would be—we have no way to know whether a
    distribution is post-standardization or not.

    Rather, I think the best solution is to have some tool which, if present
    or successful, lists one or more directories where libraries can be
    found. I'm not sure what the most sensible thing here is:

    * pkg-config would be an obvious tool to extend, but would presumably
    require modifying .pc files for all relevant packages upstream. The
    location also seems to be consistent across all packages within each distribution I was able to test, so there probably isn't much point in
    making it package-specific. [For the packages we care about, cmake and
    libtool both put things in /bin by default, and zlib apparently has no
    built-in cross-compilation support.]

    * Introducing an analogue of ld.so.conf seems like a good idea. It would
    allow for per-package extra directories, and is relatively easy to
    parse, although ideally it would be even easier than that (i.e. if
    someone else could deal with the "include" part, that would be great).

    ἔρρωσθε,
    Zeb Figura

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)