Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request - Make a version for aarch64 #133

Open
me-nkr opened this issue Oct 15, 2020 · 24 comments
Open

Request - Make a version for aarch64 #133

me-nkr opened this issue Oct 15, 2020 · 24 comments

Comments

@me-nkr
Copy link

me-nkr commented Oct 15, 2020

I'm using a raspberry pi 4 b running 64 bit ubuntu server with a gnome DE. A figma linux version supporting this system would be a great help.
- Thanls

@aharish
Copy link

aharish commented Dec 30, 2020

Hi, I was looking to see if there were versions for this architecture as well. I will probably clone the source and compile it on my Pi to see how it holds up. Will let you know how it goes.

@aharish
Copy link

aharish commented Jan 2, 2021

Hello all, I thought I'd give an update on how this is progressing.

I managed to clone the source locally to my Pi 4 (4GB) and tried building via npm i. Few things - I needed to also install libfreetype6-dev for npm to install the dependencies.

However, when I tried building for production via npm run build, it failed as sass-loader says arm64 is an unsupported architecture. I have encountered this while using cferdinandi/gulp-boilerplate on the Pi, where it would build from source if the architecture was not supported. That didn't happen here, so I will need to see if I can find some other way to work around this as I am sure sass-loader is a core component of the apps UI.

One option for me to try to get around this issue would be to do as mentioned in this comment. I will test it out and see how it goes and report back.

@aharish
Copy link

aharish commented Jan 3, 2021

Good morning guys. I was up until almost 3 AM yesterday to get this to work. I have managed to build an ARM64/aarch64 version of Figma Linux that will work on any ARM64 based SOC, including the Raspberry Pi 4, the PinePhone/PineBook, Rock Pis and so on.

screenshot_20210103_025744

As you can see from the screenshot above, I have it running on my Pi 4 that is running Ubuntu 20.10 Server, with i3wm. I had to jump through a few hoops to get this compiled and working, and I will try to detail them below.

Here's a question to the maintainers (@ChugunovRoman) - Is there any way that I can share the built .deb package so that it can be linked to the GitHub Releases page? I am willing to have my Pi dedicated to building new releases of Figma Linux for the Pi since I do not know of a free CI that builds for the ARM platform yet. For now, I have only built a .deb package, but I can also build an AppImage, .rpm, pacman or other packages as necessary, including an armhf or `armv7l' (ARM 32-bit hard float architecture) that should support Raspberry Pi OS 32-bit.


For anyone that wants to attempt this themselves, I am detailing the steps I took below:

  1. First off, ensure that you have Node.js (preferably from Nodesource) installed. Then, git clone this repository.

  2. cd into the directory. If you try installing the dependencies needed for the app to work now, it will probably fail as we do not have libfreetype6-dev installed on the system for this app to be built, especially if you are on Ubuntu or other Debian based distros. Solve this by installing

     sudo apt install libfreetype6-dev
    
  3. Once done, you should now be in a position to install the dependencies. Install it by running

     npm i
    

    The installation should take a while, and once it is done, you can build the app for production. However, figma-linux depends on node-sass which does not have any pre-built images for any of the ARM architectures (either armhf, or aarch64). In my previous comment this was a major road block for me, and I could not move further. While I tried the workaround I mentioned earlier, it meant that I would have to change core files (package.json) every time I needed to build for a new release of figma-linux which is not feasible and would likely break over time. The only sane option is to build node-sass from source to ensure that we stay 100% compliant with the upstream code of figma-linux.

  4. Now let us build node-sass from source so that the build script can use this instead of complaining about an unsupported architecture. There are two ways of building it, and the easiest way is to run

     npm install node-sass
    
  5. This should take a while to compile, but once done you should be good to actually start building the app for production. Build for production by running

     npm run build
    
  6. At this point, you should have figma-linux built and ready for production, and you can check if everything works by running npm run start. However, this is pretty pointless as you cannot login (since it is not installed on the system, xdg-open cannot resolve any figma:// links to pass along the auth token back to your instance of figma-linux).

  7. Let us remedy this by building a .deb package to install the app. Please note that this is a CPU intensive process, and if you are building this on a Pi 4, then you might want to have sufficient cooling (I have the official Pi 4 case and the official Pi 4 case fan which isn't the most efficient cooling system, but will do for now).

    Now, there is a bug with fpm wherein it has hard-coded the architecture to be x86, which for our intents and purposes will not work. To work around this, let us install Ruby, and then install the fpm Ruby gem.

     sudo apt install ruby ruby-dev
     sudo gem install fpm -v 1.10.2 # We specify the version explicitly as v11+ has a bug that will not build proper `.deb` packages
    
  8. Since we have a small single board computer, it is probably a good idea to edit our ./config/builder.json to remove the build targets that we don't need. Open up ./config/builder.json in a text editor and go to line 77 where you will find a list of all the targets. Let us replace this so that we will now only have one single target architecture:

        "target": [
             {
               "target": "deb",
               "arch": [
                 "arm64"
               ]
             }
           ]
    
  9. Save the file and quit. We can now build our .deb package. We need to let electron-builder know to use the fpm we installed from Ruby, and not download a binary from the internet during the build process. We do this like so:

     USE_SYSTEM_FPM=true npm run builder
    

At this point you should have a .deb package built and ready to be installed via apt or dpkg in figma-linux/builds/installer/.

@me-nkr
Copy link
Author

me-nkr commented Jan 3, 2021

Great work man.
I have a question, it will support on Ubuntu 20.04 server os too ryt ?
And where can I get the installable file ? (I'm a bit of new to Linux).
And kudos to your work man. Keep grinding

@aharish
Copy link

aharish commented Jan 3, 2021

Yes, the arm64 version should work on Ubuntu 20.04 as long as it is arm64/aarch64

I have gone ahead and built both arm64 and armhf/armv7l .deb files that should work on a Raspberry Pi, Pinebook, RockPi and so on as is. You can find the files here: https://gofile.io/d/zZKddt

Please note that I will delete the files above after official support for the ARM architecture has been adopted by the Figma Linux team. It is not a good idea to share executable files from untrusted sources in this manner. This is only a temporary measure for those that need/can't build from source at the moment

You can install them with sudo dpkg -i figma-linux*.deb

@ChugunovRoman
Copy link
Collaborator

Hi there!
I'll be rework the building of the app. And maybe then I will add support of arm64 architecture

@aharish
Copy link

aharish commented Jan 3, 2021

Amazing to hear that Roman! Until then I will try to keep ARM versions up to date with the releases.

Good day, and Happy New Year to both of you

@andrylalaina
Copy link

Hi aharish,
Can you reupload the .deb file for arm64 pleases
I very need the figma for my raspberry pi
And Thanks you

@aharish
Copy link

aharish commented Jan 29, 2021

Hi, I have built the 0.7.1 Figma Linux release for ARM64. Will upload this when I get back home from work today.

@ChugunovRoman
Copy link
Collaborator

Hi, I have built the 0.7.1 Figma Linux release for ARM64. Will upload this when I get back home from work today.

Send the package for ARM64 me in telegram, I will add to the release

@aharish
Copy link

aharish commented Jan 29, 2021

Sent.

@me-nkr
Copy link
Author

me-nkr commented Jan 29, 2021

@ChugunovRoman do let us know when the arm release will be available. @aharish kudos to your work mate.

@ChugunovRoman
Copy link
Collaborator

@me-nkr I uploaded for the arm64 for 0.7.1

@me-nkr
Copy link
Author

me-nkr commented Jan 29, 2021

Sorry for the noob question, but I just have to download https://github.com/Figma-Linux/figma-linux/releases/download/v0.7.1/figma-linux_0.7.1_arm64.deb and install them with sudo dpkg -i figma-linux*.deb ryt ?

@aharish
Copy link

aharish commented Jan 29, 2021

Yes. Please make sure that you execute the command in the same directory where the file is.

@me-nkr
Copy link
Author

me-nkr commented Jan 29, 2021

I will sure do that. It's a proud moment btw that I was able to become one of the reason for this to happen. @aharish thanks again for your contribution. If there's any reason to reopen this thread please ping me at navenfrank7@gmail.com.

@me-nkr me-nkr closed this as completed Jan 29, 2021
@me-nkr me-nkr reopened this Jan 30, 2021
@me-nkr
Copy link
Author

me-nkr commented Jan 30, 2021

@aharish I just downloaded the .deb file, and installed it with dpkg. when I'm trying to run it by clicking the icon nothing happens. And when I tried using figma-linux in terninal the following error was produced.

A JavaScript error occurred in the main process
Uncaught Exception:
Error: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /opt/figma-linux/resources/app.asar.unpacked/node_modules/figma-linux-rust-binding/native/index.node)
    at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1812)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1203:18)
    at Object.func [as .node] (electron/js2c/asar_bundle.js:5:2039)
    at Module.load (internal/modules/cjs/loader.js:992:32)
    at Module._load (internal/modules/cjs/loader.js:885:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12738)
    at Module.require (internal/modules/cjs/loader.js:1032:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/opt/figma-linux/resources/app.asar/main/main.js:1:55238)
    at __webpack_require__ (/opt/figma-linux/resources/app.asar/main/main.js:1:204)

hope you can provide a solution.

@aharish
Copy link

aharish commented Jan 31, 2021

@me-nkr as in mentioned in the main repo README file you will need to install libgconf-2-4 for Debian based distros (which includes Ubuntu and the like).

@me-nkr
Copy link
Author

me-nkr commented Jan 31, 2021

@aharish It's already installed. And still getting the error.

@andrylalaina
Copy link

@aharish I also get this error,help me please

@aharish
Copy link

aharish commented Feb 2, 2021

Are you sure both of your systems are up to date?

sudo apt update && sudo apt upgrade

Meanwhile I will boot up fresh copies of both Raspberry Pi OS and Ubuntu Desktop 20.10 and check.

@me-nkr
Copy link
Author

me-nkr commented Feb 2, 2021

Are you sure both of your systems are up to date?

sudo apt update && sudo apt upgrade

Meanwhile I will boot up fresh copies of both Raspberry Pi OS and Ubuntu Desktop 20.10 and check.

I updated before and after installation. And my OS is 20.04 with gnome desktop environment.
I read somewhere that GLIBC_2.32 is not available for 20.04. mine is GLIBC_2.31. but yours was 18.04 ryt ?

@andrylalaina
Copy link

@aharish I use ubuntu 18.04, please can you make it for ubuntu 18.04 pls

@aharish
Copy link

aharish commented Mar 10, 2021

but yours was 18.04 ryt ?

Indeed it is not! You can see from my above screenshot (and a couple of mentions in a few of the comments above) that I am running Ubuntu 20.10 Groovy Gorilla.

I have been busy with work IRL, and have not been able to divert much attention to my open-source commitments, but I did manage to get a development environment set up for Ubuntu 20.04 LTS which is probably what I will use to build all future versions of Figma Linux for ARM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants