Setup Compile Environment Windows 10 WSL

Discussion in 'Switch - Tutorials' started by Rusb, Dec 12, 2018.

  1. Rusb
    OP

    Rusb GBAtemp Regular

    Member
    4
    Apr 17, 2014
    Hello, some weeks ago I made a clean WSL (Windows Subsystem for Linux) image to setup a devenv for the switch and I'm here to share it with you.

    First, update your Windows 10 to the latest version or you may be not able to execute some necessary steps.

    STEP 1: Activate WSL on your windows machine.
    Follow this tutorial: https://winaero.com/blog/enable-wsl-windows-10-fall-creators-update/

    STEP2: Download LxRunOffline from here
    https://github.com/DDoSolitary/LxRunOffline/releases

    STEP3: Download my ArchLinux image preinstalled with all needed things:
    PM ME.
    Move the switchdev.tar.gz to somewhere recognizable

    STEP4: Extract LxRunOffline, open a console and do the following command:

    Example:
    .\LxRunOffline.exe i -n switchdev -d c:\switch -f .\switchdev.tar.gz -s

    Usage:
    .\LxRunOffline.exe i
    Options:
    -n arg Name of the distribution
    -d arg The directory to install the distribution into.
    -f arg The tar file containing the root filesystem of the
    distribution to be installed.
    -r arg The directory in the tar file to extract. This argument
    is optional.
    -c arg The config file to use. This argument is optional.
    -v arg (=1) The version of filesystem to use, latest available one
    if not specified.
    -s Create a shortcut for this distribution on Desktop.


    STEP5:
    Run the image doing:
    LxRunOffline.exe r -n switchdev

    where switchdev is the name you put on the installation process.


    STEP6:
    run this two commands to have it fully working:

    pacman -Sy switch-sdl2 switch-sdl2_gfx switch-sdl2_image switch-sdl2_mixer switch-sdl2_net switch-sdl2_ttf switch-bulletphysics switch-bzip2 switch-curl switch-ffmpeg switch-flac switch-freetype switch-glad switch-glm switch-jansson switch-libass switch-libconfig switch-libdrm_nouveau switch-libexpat switch-libfribidi switch-libjpeg-turbo switch-libjson-c switch-libmad switch-libmikmod switch-libmodplug switch-libogg switch-libopus switch-libpng switch-libsamplerate switch-libtheora switch-libvorbis switch-libvorbisidec switch-libxml2 switch-mesa switch-mpg123 switch-opusfile switch-pkg-config switch-zlib


    echo "export DEVKITA64=/opt/devkitpro/devkitA64/" >> /root/.bashrc && source /root/.bashrc

    That's all, whenever you run your image you will be root, devkitpro it's already installed in the /opt directory, you now can compile the switch examples


    I made this some weeks ago as I said and I'm not testing the procedure again, but It's easy enough to read a little.

    If you have questions ask me :)
     
    Last edited by Rusb, Dec 20, 2018
    Ericthegreat and ChaosEternal like this.
  2. cearp

    cearp 瓜老外

    Member
    16
    May 26, 2008
    Tuvalu
    is it more convenient than just using a 'normal' vm?
     
  3. Rusb
    OP

    Rusb GBAtemp Regular

    Member
    4
    Apr 17, 2014
    Your entire filesystem is shared with the linux image, so you can just drag the code you want to compile in any folder, shift+right click on the folder, hit open powershell/cmd here, and simply run

    LxRunOffline.exe r -n switchdev
    on the terminal or have an alias like switchdev or something like that.

    Then, you are on that folder on a linux terminal with all prepared to compile.

    See it by yourself, in my case switch is an alias to LxRunOffline.

     
    Last edited by Rusb, Dec 16, 2018 - Reason: Video finished processing :)
    Ericthegreat and cearp like this.
  4. cearp

    cearp 瓜老外

    Member
    16
    May 26, 2008
    Tuvalu
    @Rusb thanks.
    I knew about WSL but never used it.
    I'm doing a windows reinstall today/tomorrow and so I'll give it a go once I'm all set up :)
     
  5. Rusb
    OP

    Rusb GBAtemp Regular

    Member
    4
    Apr 17, 2014
    No need to thank :)

    I wanted to make an image of ArchLinux due to the fact that DevkitPro uses pacman, however if you want to setup an WSL installation is as easy as going to the Microsoft Store and download Debian/Ubuntu/OpenSUSE... other distros as arch needs to be crafted manually or use prebaked tars.

    Note that by default, you will have a command called "bash" that points you to your first WSL installation.
    This command will retain the path you are in. If you have more than one installation, you can choose a default one to enter using "bash" or use the distro name.
    LxRunOffline is a tool that manages that distros and let you add new ones with ease. (But it doesn't work perfectly yet... export tar.gz didn't work for me and I had to tar it manually).

    Personally, I stopped using a full linux installation due to WSL, using an XServer and pulseaudio you can get graphics and audio, in fact, in my work I use Eclipse IDE through a debian WSL.

    If I want to copy my devenv from one PC to another, It's so easy that seems like magic, for me it's a better version of docker. Reminds me to FreeBSD jails.

    There is almost 100% compat running Linux native programs (I only got some errors while exploring linux syscall clone with esoteric parameters) and well, I preffer to use the tools windows has over linux ones :3
     
    Last edited by Rusb, Dec 17, 2018
    cearp likes this.
  6. realWinterMute

    realWinterMute GBAtemp Regular

    Member
    4
    Feb 24, 2011
    Why are you releasing other people's work and pretending it's yours.

    This repackaging is neither permitted nor required. You don't even acknowledge us.

    https://devkitpro.org/wiki/devkitPro_pacman
     
  7. Rusb
    OP

    Rusb GBAtemp Regular

    Member
    4
    Apr 17, 2014
    can you explain on how is this others people work?
     
  8. realWinterMute

    realWinterMute GBAtemp Regular

    Member
    4
    Feb 24, 2011
    Did you think all the tools and libraries magically appeared in a cloud of pixie dust ready for you to bundle up and pretend it was yours?
     
  9. Rusb
    OP

    Rusb GBAtemp Regular

    Member
    4
    Apr 17, 2014
    Can you underline where I said that the libraries and tools where mine? I explicity say that I made the image aka installed the archlinux distribution, packed it and exported it.
    I not only mentioned devkitpro without claiming authory but I followed the GPL license
    https://devkitpro.org/wiki/Trademarks

    In fact, claiming it is a Devkit work would be a break of the license supposing I changed something (that you don't know but I anticipate you that I don't):
    The GPL does not grant you any right to use devkitPro trademarks in connection with these derivative works. devkitPro trademarks may not be used in connection with any such derivative works unless that usage is explicitly and specifically licensed, in writing, from Dave Murphy.

    I'm not a lawyer and can be wrong tho.

    I'm not trying to take credit on other people work, I'm only trying to help people to setup a devenv on windows 10 or make them notice that this way exists.

    If you noticed something wrong with the post, you could just say it and I will try to adapt it if I consider it's necessary, being less of a dick can be helpful and more profitable to everyone, including me.

    Also, if you want to know why doing this repackaging is useful, it's guaranteed to be working on WSL and you can't install (or at least you couldn't) the archlinux image from the Windows Store, making the process to be manual. It's the same case of a docker image.

    Sorry if I offended someone with this, if I'm told to remove this post I'll and make another with an actual full installation guide without the ease of use of the image but with the links to install devkitpro on the blank image.
     
    Last edited by Rusb, Dec 20, 2018
  10. Costello

    Costello Headmaster

    Administrator
    23
    Oct 24, 2002
    @Rusb
    thanks for your understanding - please respect the original author's work.
    wintermute is a pillar of the scene and deserves our respect.
     
  11. realWinterMute

    realWinterMute GBAtemp Regular

    Member
    4
    Feb 24, 2011
    You don't need to do this. You can install the devkitPro pacman .deb on a standard WSL ubuntu image, make a symlink & run pacman -S switch-dev, job done. See https://devkitpro.org/wiki/devkitPro_pacman This will get the latest tools installed ready to go if that's what you want to do. We also supply windows native tools which are easier to integrate with windows editors although we're currently trying to sort out an editor to bundle with the tools.

    arch on WSL is unsupported and not recommended. This is why there's no archWSL in the windows store and why it's probably best not to use it. See https://lists.archlinux.org/pipermail/arch-dev-public/2018-January/029139.html

    I hear the best way to use arch on win10 is to uninstall win10 first :P

    devkitPro also provide docker images at https://hub.docker.com/u/devkitpro

    You don't install devkitPro, we're an organisation dedicated to producing and maintaining a variety of tools & libraries to make it easier to build homebrew. Repackaging of our tools causes confusion and often leaves users with broken installations please don't do it.
     
    Last edited by realWinterMute, Dec 20, 2018
  12. gnmmarechal

    gnmmarechal GBAtemp Guru

    Member
    14
    GBAtemp Patron
    gnmmarechal is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jul 13, 2014
    Portugal
    https://gs2012.xyz
    WSL is a pretty handy thing to have on hand.
     
  13. cearp

    cearp 瓜老外

    Member
    16
    May 26, 2008
    Tuvalu
    thanks @realWinterMute for showing how easy it to do yourself and for the wiki link.
    but I'm certain the OP had no evil intentions, he didn't even give the pre-made pack a name, so it's quite clear (at least to me) that it's simply aiming to help, saving the end user some time and to lower the barrier to entry. Devkitpro was mentioned in the post, but yeah not explicit thanks given. Right or wrong, he was only trying to do a nice thing not everyone thinks of all the situations of outcomes before helping, or reads all the terms and conditions etc.
    In general, for life, we don't want people to stop trying to help out, or scare them away from doing so, so this thing might happen again in the future, whether it's right or wrong.
     
  14. cearp

    cearp 瓜老外

    Member
    16
    May 26, 2008
    Tuvalu
    Hmm, ok so I tried to set this up myself (WSL).
    I downloaded debian, updated it, did the symlink,
    Code:
    sudo ln -s /proc/self/mounts /etc/mtab
    downloaded the devkitpro-pacman.deb to my user home folder,
    sudo dpkg -i devkitpro-pacman.deb and the output I get is:

    Code:
    [sudo] password for cearp:
    (Reading database ... 10035 files and directories currently installed.)
    Preparing to unpack devkitpro-pacman.deb ...
    Unpacking devkitpro-pacman (1.0.1) over (1.0.1) ...
    Setting up devkitpro-pacman (1.0.1) ...
    pacman-conf: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory
    mkdir: cannot create directory ‘’: No such file or directory
    gpg: marginals needed: 3  completes needed: 1  trust model: pgp
    gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
    chmod: cannot access '/trustdb.gpg': No such file or directory
    pacman-conf: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory
    ==> ERROR: You do not have sufficient permissions to read the pacman keyring.
    ==> Use 'pacman-key --init' to correct the keyring permissions.
    /opt/devkitpro/pacman/bin/pacman: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory
    dpkg: error processing package devkitpro-pacman (--install):
     subprocess installed post-installation script returned error exit status 127
    Errors were encountered while processing:
     devkitpro-pacman
    
    wintermute did say it was easy on ubuntu, I assumed debian would have been enough, the distro size is less that's the only real reason I chose it.
    I'll try later with ubuntu.


    --edit:
    ubuntu (18.04) updated, symlink maybe wasn't needed because 'ln: failed to create symbolic link '/etc/mtab': File exists'
    the pacman deb installed with no issues :)
    ran sudo dpk-pacman -S switch-dev, quit and reopened the shell, copied an example into my home folder, tried to 'make', it turns out ubuntu didn't even include make, installed that and the example built perfectly!
     
    Last edited by cearp, Dec 20, 2018
    Cyan and Rusb like this.
  15. cdoty

    cdoty GBAtemp Fan

    Member
    3
    Sep 14, 2009
    United States
    People really need to read through the GPL license. It does not grant you god like control over your software.. in fact it has the opposite effect. Anyone is free to do whatever with the software, as long as they release, or provide a way of obtaining, the source code. The may rename it, charge for it, even claim it as their own (ever heard of Red Hat linux?).

    This reminds me of the temper tantrums thrown by the RetroArch crew every time someone uses the software as the basis for a device.
     
    Last edited by cdoty, Jan 3, 2019
    Coto likes this.
  16. Coto

    Coto -

    Member
    7
    Jun 4, 2010
    Chile
    You are right there. As long a piece of software is GPL´d then the work must be inmediately open sourced (that means source code availability). That does not grant god-like control over software. In fact, if you disagree with the license, you can only go as far as licensing your own bits of code, and you must discard everything that is GPL´d.


    Ideally everyone that uses GPL´d code, (even embedded in their toolchains ;-) ) must follow these rules.
     
    Last edited by Coto, Jan 8, 2019
Quick Reply
Draft saved Draft deleted
Loading...