• [gentoo-dev] [ebuild] How to do make install while in compilation stage

    From Xi Shen@21:1/5 to All on Mon Jul 11 05:20:01 2022
    Hi,

    I am trying to create an ebuild file for https://github.com/NVIDIA/libnvidia-container. It has a few other
    dependencies which will be built by itself.

    My ebuild can download and compile those dependencies. But one of the dependency "libtirpc-1.3.2" needs to install itself in the temporary
    portage environment. Its Makefile allows me to pass in the "DESTDIR"
    variable which I passed in "/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps",
    but when it installs, the package is installed to "/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps/usr/local",
    the working director got repeated after the "deps" directory.

    I checked the makefile, but could not figure out where that path got replicated. I guess when running inside the portage build environment,
    there's some "chroot" trick that prevents packages from writing the root
    file system.

    So I want to ask if I need to do a "make install" during compilation, how should I pass the destination directory?


    Thanks

    <div dir="ltr">Hi,<div><br></div><div>I am trying to create an ebuild file for <a href="https://github.com/NVIDIA/libnvidia-container">https://github.com/NVIDIA/libnvidia-container</a>. It has a few other dependencies which will be built by itself.</
    <div><br></div><div>My ebuild can download and compile those dependencies. But one of the dependency &quot;libtirpc-1.3.2&quot; needs to install itself in the temporary portage environment. Its Makefile allows me to pass in the &quot;DESTDIR&quot;
    variable which I passed in &quot;/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps&quot;, but when it installs, the package is installed to &quot;/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-
    container-1.10.0/deps/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps/usr/local&quot;, the working director got repeated after the &quot;deps&quot; directory.</div><div><br></div><div>I checked the makefile, but
    could not figure out where that path got replicated. I guess when running inside the portage build environment, there&#39;s some &quot;chroot&quot; trick that prevents packages from writing the root file system.</div><div><br></div><div>So I want to ask
    if I need to do a &quot;make install&quot; during compilation, how should I pass the destination directory?</div><div><br></div><div><br></div><div>Thanks</div></div>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrew Ammerlaan@21:1/5 to Xi Shen on Mon Jul 11 06:40:01 2022
    Hi,

    On 11/07/2022 05:17, Xi Shen wrote:
    Hi,

    I am trying to create an ebuild file for https://github.com/NVIDIA/libnvidia-container <https://github.com/NVIDIA/libnvidia-container>. It has a few other dependencies which will be built by itself.

    Such an ebuild already exists in the ::guru overlay (maintainer in CC).
    I see it is one version behind though. Feel free to bump it to the
    latest version if you want, probably a simple copy and renaming of the
    ebuild will do the trick.

    My ebuild can download and compile those dependencies. But one of the dependency "libtirpc-1.3.2" needs to install itself in the temporary
    portage environment. Its Makefile allows me to pass in the "DESTDIR"
    variable which I passed in "/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps",
    but when it installs, the package is installed to "/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps/usr/local",
    the working director got repeated after the "deps" directory.

    I checked the makefile, but could not figure out where that path got replicated. I guess when running inside the portage build environment, there's some "chroot" trick that prevents packages from writing the root
    file system.

    So I want to ask if I need to do a "make install" during compilation,
    how should I pass the destination directory?

    Don't try to install things to the installation directory (${ED}) during
    the compile phase. If you really have something that insists on being
    installed somewhere to complete the compilation, then install it to some temporary directory, e.g. ${T} and then if necessary copy it from the
    temporary directory into the installation directory during the install
    phase. The ebuild in ::guru seems to solve your problem with a bunch of patches, which I think is a better solution.

    Best regards,
    Andrew

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Xi Shen@21:1/5 to Rui Huang on Mon Jul 11 09:00:02 2022
    Thanks a lot!

    On Mon, 11 Jul 2022 at 16:18, Rui Huang <[email protected]> wrote:

    Hi,

    The latest libnvidia-container-1.10.0 has been tested and committed to the dev branch of the ::guru overlay (waiting to be merged into the master branch)


    https://github.com/gentoo/guru/commit/9edb349a59c3479b53ffa4049e220ee223aeb0ec

    And the matching app-containers/nvidia-container-toolkit-1.10.0 has also
    been committed to the dev branch.
    After waiting for the merge, you can directly use the ebuild in the ::guru overlay.


    https://github.com/gentoo/guru/commit/350c753f97903397f5fe8f9c05f815007e339018

    Best regards,
    Huang Rui

    On Mon, 11 Jul 2022 at 12:35, Andrew Ammerlaan <[email protected]> wrote:

    Hi,

    On 11/07/2022 05:17, Xi Shen wrote:
    Hi,

    I am trying to create an ebuild file for
    https://github.com/NVIDIA/libnvidia-container
    <https://github.com/NVIDIA/libnvidia-container>. It has a few other
    dependencies which will be built by itself.

    Such an ebuild already exists in the ::guru overlay (maintainer in CC).
    I see it is one version behind though. Feel free to bump it to the
    latest version if you want, probably a simple copy and renaming of the
    ebuild will do the trick.

    My ebuild can download and compile those dependencies. But one of the
    dependency "libtirpc-1.3.2" needs to install itself in the temporary
    portage environment. Its Makefile allows me to pass in the "DESTDIR"
    variable which I passed in

    "/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps",

    but when it installs, the package is installed to

    "/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps/usr/local",

    the working director got repeated after the "deps" directory.

    I checked the makefile, but could not figure out where that path got
    replicated. I guess when running inside the portage build environment,
    there's some "chroot" trick that prevents packages from writing the
    root
    file system.

    So I want to ask if I need to do a "make install" during compilation,
    how should I pass the destination directory?

    Don't try to install things to the installation directory (${ED}) during
    the compile phase. If you really have something that insists on being
    installed somewhere to complete the compilation, then install it to some
    temporary directory, e.g. ${T} and then if necessary copy it from the
    temporary directory into the installation directory during the install
    phase. The ebuild in ::guru seems to solve your problem with a bunch of
    patches, which I think is a better solution.

    Best regards,
    Andrew



    <div dir="ltr">Thanks a lot! <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 11 Jul 2022 at 16:18, Rui Huang &lt;<a href="mailto:[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquote class="gmail_quote"
    style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>The latest libnvidia-container-1.10.0 has been tested and committed to the dev branch of the ::guru overlay (waiting to be
    merged into the master branch)</div><div><br></div><div><a href="https://github.com/gentoo/guru/commit/9edb349a59c3479b53ffa4049e220ee223aeb0ec" target="_blank">https://github.com/gentoo/guru/commit/9edb349a59c3479b53ffa4049e220ee223aeb0ec</a></div><div><
    </div><div>And the matching app-containers/nvidia-container-toolkit-1.10.0 has also been committed to the dev branch.</div><div>After waiting for the merge, you can directly use the ebuild in the ::guru overlay.<br></div><div><br></div><div><a href="
    https://github.com/gentoo/guru/commit/350c753f97903397f5fe8f9c05f815007e339018" target="_blank">https://github.com/gentoo/guru/commit/350c753f97903397f5fe8f9c05f815007e339018</a><div><div><br></div><div>Best regards,<br>Huang Rui<br></div></div></div></
    <br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 11 Jul 2022 at 12:35, Andrew Ammerlaan &lt;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&gt; wrote:<br></div><blockquote class="gmail_
    quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>

    On 11/07/2022 05:17, Xi Shen wrote:<br>
    &gt; Hi,<br>
    &gt; <br>
    &gt; I am trying to create an ebuild file for <br>
    &gt; <a href="https://github.com/NVIDIA/libnvidia-container" rel="noreferrer" target="_blank">https://github.com/NVIDIA/libnvidia-container</a> <br>
    &gt; &lt;<a href="https://github.com/NVIDIA/libnvidia-container" rel="noreferrer" target="_blank">https://github.com/NVIDIA/libnvidia-container</a>&gt;. It has a few other <br>
    &gt; dependencies which will be built by itself.<br>

    Such an ebuild already exists in the ::guru overlay (maintainer in CC). <br>
    I see it is one version behind though. Feel free to bump it to the <br>
    latest version if you want, probably a simple copy and renaming of the <br> ebuild will do the trick.<br>

    &gt; My ebuild can download and compile those dependencies. But one of the <br> &gt; dependency &quot;libtirpc-1.3.2&quot; needs to install itself in the temporary <br>
    &gt; portage environment. Its Makefile allows me to pass in the &quot;DESTDIR&quot; <br>
    &gt; variable which I passed in <br>
    &gt; &quot;/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps&quot;, <br>
    &gt; but when it installs, the package is installed to <br>
    &gt; &quot;/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps/usr/local&quot;, <br>
    &gt; the working director got repeated after the &quot;deps&quot; directory.<br>
    &gt; <br>
    &gt; I checked the makefile, but could not figure out where that path got <br> &gt; replicated. I guess when running inside the portage build environment, <br>
    &gt; there&#39;s some &quot;chroot&quot; trick that prevents packages from writing the root <br>
    &gt; file system.<br>
    &gt; <br>
    &gt; So I want to ask if I need to do a &quot;make install&quot; during compilation, <br>
    &gt; how should I pass the destination directory?<br>

    Don&#39;t try to install things to the installation directory (${ED}) during <br>
    the compile phase. If you really have something that insists on being <br> installed somewhere to complete the compilation, then install it to some <br> temporary directory, e.g. ${T} and then if necessary copy it from the <br> temporary directory into the installation directory during the install <br> phase. The ebuild in ::guru seems to solve your problem with a bunch of <br> patches, which I think is a better solution.<br>

    Best regards,<br>
    Andrew<br>
    </blockquote></div>
    </blockquote></div>

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