Trouble installing gcc/clang tool chains

Unfortunately, I have had no luck installing/running developer tool chains with flatpak. Being new to flatpak, I assume I’m missing some fundamental step but I don’t know what it is.

This is on the Endless Mini (ARMv7), OS version 3.1.8, though that should not make a difference here.

$ flatpak install gnome org.gnome.Platform//3.24 org.gnome.Sdk//3.24

This should install both the org.freedesktop.Platform and org.freedesktop.Sdk (as dependencies) along with the Gnome Platform/SDK on top of that. I do see the download the install complete and I’m returned to the command line, so I assume all is well. But now…

$ flatpak list

Nothing. I see no installed packages. So now I try to open a session into a sandbox:

$ flatpak run --command=bash -d --filesystem=home org.gnome.Sdk
error: app/org.gnome.Sdk/arm/master not installed

Well, I’m not surprised since I could not see anything installed after listing the flatpaks.

After some experimenting I seem to have stumbled upon a way to list installed runtimes:

$ flatpak list --runtime
org.freedesktop.Platform.Locale
org.freedesktop.Platform       
org.freedesktop.Sdk.Locale     
org.freedesktop.Sdk            
org.gnome.Platform.Locale      
org.gnome.Platform             
org.gnome.Sdk.Locale           
org.gnome.Sdk

So it does look like I have both runtimes and SDKs installed. But how do I open a sandboxed terminal?

Any ideas on how I can proceed?

1 Like

flatpak run is the right thing but I believe it searches in the app/ namespace rather than runtime/ namespace unless you provide the full ref to the runtime you want.

Try like this:

ramcq@upsilon:~$ flatpak list --runtime -d
...
org.gnome.Sdk/x86_64/3.24                            gnome                       f8ac436bb208 - 1.5 GB    system    
ramcq@upsilon:~$ flatpak run --filesystem=home --command=bash org.gnome.Sdk 
error: app/org.gnome.Sdk/x86_64/master not installed
ramcq@upsilon:~$ flatpak run --filesystem=home --command=bash org.gnome.Sdk/x86_64/3.24
ramcq@upsilon:~$ # woop
ramcq@upsilon:~$ exit
exit
ramcq@upsilon:~$
1 Like

Thanks for the help! There are a few tools I use that are missing but I don’t expect everything to be there.

1 Like

One issue I ran into is that once I’m inside a sandbox I only have access to the tools in /bin/apps and /usr/bin and those don’t always overlap with the tools I had access to outside.

So for example, I can use gcc from inside the sandbox but I can’t now get at vi (so can’t edit files). I have to either exit the sandbox or open a terminal outside to edit files. That’s really inconvenient and I can’t believe there is not a simpler way to accomplish this.

1 Like

Try with --filesystem=host

1 Like

Thanks for the suggestion but that doesn’t work unfortunately. Its pretty awkward to have to edit files in one terminal and compile in another. I cannot access both gcc and vi in the same session using the org.freedesktop runtime.

1 Like

So, you could do one of these:

  • Use an SDK/editor which is already “Flatpak’d” or even one that supports Flatpak already. For example GNOME Builder is available on Endless from the gnome-apps repository which we enable by default. It actually uses a “host portal” to escape the Flatpak sandbox for compilation/debugging/etc purposes, and also natively supports building/running your projects under other Flatpak SDKs. It’s definitely going to be closest to giving you a well-polished “native” Flatpak developer experience, if you’re happy to use it as your development environment.

  • Build the app(s)/editors/etc you want as Flatpaks by writing .json files to feed to flatpak-builder. Then you can run that editor app inside a sandbox based on the GNOME SDK, and do all of your editing/building inside that sandbox.

  • Write a wrapper script that you put into your path (eg /usr/local/bin) which is symlinked to a number of different names (eg gcc, make, etc) and simply invokes the tool via flatpak:

    ramcq@upsilon:~$ cat gcc
    #!/bin/sh
    flatpak run --filesystem=host --command=$(basename $0) org.gnome.Sdk/x86_64/3.24 $@
    ramcq@upsilon:~$ ./gcc -v
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-unknown-linux/6.2.0/lto-wrapper
    Target: x86_64-unknown-linux
    Configured with: …/…/…/…/…/…/work-shared/gcc-6.2.0-r0/gcc-6.2.0/configure --build=x86_64-linux --host=x86_64-unknown-linux --target=x86_64-unknown-linux --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/srv/sdkbuilder/work/build/x86_64/freedesktop-sdk-base-1-6/build/x86_64/tmp-glibc/sysroots/qemux86-64 --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=x86_64-unknown-linux- --without-local-prefix --enable-lto --enable-libssp --enable-libitm --disable-bootstrap --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --without-isl --with-sysroot=/ --with-build-sysroot=/srv/sdkbuilder/work/build/x86_64/freedesktop-sdk-base-1-6/build/x86_64/tmp-glibc/sysroots/qemux86-64 --with-gxx-include-dir=/usr/include/c++/6.2.0 --without-long-double-128 --enable-nls --enable-initfini-array --enable-__cxa_atexit
    Thread model: posix
    gcc version 6.2.0 (GCC)

1 Like

Thanks,

Your proposed solution using symlinks is pretty clever and is probably the most flexible so long as the tools you want are already flatpak’ed.

As for GNOME Builder, I have the Endless Mini and did not see this in the App Center. I assumed it was because Builder is not supported on ARM. If this is not the case, can you tell me how I can access Builder?

Thanks again.

1 Like