sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
807 stars 39 forks source link

ST4 throws plugin_host-3.3 and 3.8 error for Jetson AGX Xavier (ARM64) #4420

Closed Neel1302 closed 5 months ago

Neel1302 commented 3 years ago

Hi,

I installed ST4 via apt as described (here).

I am installing this on the NVIDIA Jetson AGX Xavier (Contains a NVIDIA Carmel ARMv8.2 CPU) running Ubuntu 18.04.

Upon installing, I get the following error on ST4 startup (same behaviour in safe mode):

image

image

In addition, this results in the preferences menu to be greyed out as follow:

image

Wanted to report this bug so a solution can be worked on.

Thanks, Neel

BenjaminSchaaf commented 3 years ago

Does anything get logged to the Sublime Text console?

Neel1302 commented 3 years ago

Does anything get logged to the Sublime Text console?

Here is the console output upon startup (Note: I have tried restarting many times, but the result is the same):

image

BenjaminSchaaf commented 3 years ago

Can you run ldd /opt/sublime_text/plugin_host-3.3 please.

Neel1302 commented 3 years ago

Can you run ldd /opt/sublime_text/plugin_host-3.3 please.

Here is the output: image

Also, here is the GLIBC version that is packed with the Ubuntu image: image

Note, however, that on a non ARM64 machine (i.e. on my AMD64 machine) that also runs Ubuntu 18.04 the GLIBC version is the same, however running ldd /opt/sublime_text/plugin_host-3.3 doesn't seem to show any issues with GLIBC as it did for the ARM64 machine: image

BenjaminSchaaf commented 3 years ago

For various reasons the ARM builds require a newer version of glibc than the x86 builds. I can suggest either upgrading to 20.04 or using a PPA to install a more recent glibc.

Neel1302 commented 3 years ago

Thanks @BenjaminSchaaf.

As far as I can tell upgrading GLIBC on 18.04 can lead to many other components (packaged with 18.04) to break due to dependency issue.

I know a big community uses NVIDIA Jetson based ARM boards for the robotics (autonomous driving and so on) industry and beyond and they support 18.04 for the OS (which is packaged with GLIBC 2.27); so it would have been great if ST4 supported GLIBC 2.27 for ARM. I am not sure if there is a possibility of providing a build compatible with GLIBC 2.27 or not but maybe it is worth mentioning this requirement on for ARM builds on the install page for ST4 in case anyone is wondering why the plugins crash.

Thanks again, Neel

fengye commented 3 years ago

Same for me here on a Jetson Nano. Same glibc 2.27 <-> 2.28 situation. Would be great if ST4 can support 2.27

theofficialgman commented 3 years ago

the problem is likely the case because sublimehq is building their arm64 build on debian buster VM/container which uses glibc 2.28.

They should be able to make an arm64 container on bionic and build on that no problem which would solve the issue.

lulle2007200 commented 3 years ago

I made a script to install sublime text on arm64 ubuntu 18.04, installs sublime text stable, if not installed, installs glibc2.28 (compiled by me) only for Sublime Text. Doesn't affect the rest of the system.

Neel1302 commented 3 years ago

I made a script to install sublime text on arm64 ubuntu 18.04, installs sublime text stable, if not installed, installs glibc2.28 (compiled by me) only for Sublime Text. Doesn't affect the rest of the system.

I tried this solution, but there is an issue: image

I also tried your initial workaround and sublime refuses to startup due to a segmentation fault.

lulle2007200 commented 3 years ago

It's been tested on a Nintendo Switch and a Jetson Nano running Ubuntu Bionic, worked fine on both. I'm on vacation at the moment, so best I can do is to suggest to take a look at the script and do what it does manually and see what fails. Also, what device are you using?

Re the initial workaround: That did break open file/open folder etc., hence I removed it again.

Neel1302 commented 3 years ago

I am installing this on the NVIDIA Jetson AGX Xavier (Contains a NVIDIA Carmel ARMv8.2 CPU) running Ubuntu 18.04.

Thanks, yes, but manually following the steps also produces same results - I got past the open: Text file delay issue via manually performing the sequence of the steps in the script, but I get a segmentation fault on startup of sublime.

theofficialgman commented 3 years ago

you probably have sublime text or some function of it still running on your system when you run the script.. thats why you get the "open: text file busy" error I would assume

Neel1302 commented 3 years ago

you probably have sublime text or some function of it still running on your system when you run the script.. thats why you get the "open: text file busy" error I would assume

I will try again and ensure no sublime window is open and update this reply.

Thanks, Neel

lulle2007200 commented 3 years ago

I am installing this on the NVIDIA Jetson AGX Xavier (Contains a NVIDIA Carmel ARMv8.2 CPU) running Ubuntu 18.04.

Oh, sorry, didn't realize you are OP. Anyway, problem seems to be indeed sublime not being fully closed. I reworked the script to not fail if sublime is still open. In case sublime is still running while the script is being run, changes should be in effect after sublime is closed and fully restarted the next time.

Neel1302 commented 3 years ago

@lulle2007200 Thanks for making the change while on vaccation. I can confirm the updated script works on the AGX Xavier (I closed all sublime windows as anticipated by @theofficialgman as the issue). I tried the script without closing sublime, and it still worked - so the modifications made worked.

I am sure ARM users on 1804 will appreciate it if this patch was packaged into sublime for ARM or even if a pointer to this script was mentioned on the installation page for ARM.

Thanks again, Neel

lulle2007200 commented 3 years ago

You're welcome, glad it works.

motiv-ncb commented 3 years ago

lulle, thank you so much for this. Confirming that it works with Nvidia Jetson NX as well.

jamescodesthings commented 2 years ago

Confirmed working on Jetson Nano B01 Devkit (4gb). Thanks @lulle2007200

foemre commented 2 years ago

@lulle2007200 confirmed working on Jetson TX2. Thanks !

agrija9 commented 2 years ago

@motiv-ncb @lulle2007200 Confirming that also worked on my Nvidia Jetson NX. @lulle2007200 you rock!

theofficialgman commented 2 years ago

@BenjaminSchaaf could we get an update on ST4 arm64 being build on a different development system/OS? If all you have at your disposal is the pi4 still (which you told me in the discord), you can simple use the 18.04 image for it https://cdimage.ubuntu.com/releases/18.04/release/ . if you need the destkop as well, just install the server image and the install ubuntu-desktop

of course it would be easier to acquire an nvidia jetson (nano, xavier, hackable nintendo switch, etc) but the above is still an option without extra hardware

theofficialgman commented 2 years ago

potential workaround for building glibc 2.27 compatible binaries on buster:

chromium actually builds glibc 2.17 compatible binaries on newer debian installs and relinks them back to older glibc versions (in their case, they use modified bullseye chroots and then relink back to glibc 2.17) you shouldn't have to do this though since you use buster with glibc 2.28 and there is only one function that changed which causes incompatibility, fcntl64

you can disable this function on your build machine like so, and any produced binaries should link to glibc 2.27 or lower

# fcntl64() was introduced in glibc 2.28.  Make sure to use fcntl() instead.
  fcntl_h="/usr/include/fcntl.h"
  sed -i '{N; s/#ifndef __USE_FILE_OFFSET64\(\nextern int fcntl\)/#if 1\1/}' \
      "${fcntl_h}"

I wouldn't do this on a working install unless its just a build machine but you can always backup that file for testing

basically we are just disabling the redirect that was added in the development library for libc6-dev so that produced binaries don't link to fcntl64 (this is what the redirect looked like btw)

#ifndef __USE_FILE_OFFSET64
extern int fcntl (int __fd, int __cmd, ...);
#else
# ifdef __REDIRECT
extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64);
# else
#  define fcntl fcntl64
# endif
#endif
#ifdef __USE_LARGEFILE64
extern int fcntl64 (int __fd, int __cmd, ...);
#endif

the relevant chromium buildscripts that they have written that this code came from: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/build/linux/sysroot_scripts/sysroot-creator.sh https://chromium.googlesource.com/chromium/src/+/refs/heads/main/build/linux/sysroot_scripts/reversion_glibc.py

also normal, you can see what functions a binary is calling with objdump -T to look at the relevant glibc calls

objdump -T binaryname | grep -i "glibc_"
theofficialgman commented 1 year ago

@BenjaminSchaaf any update on this? the change for fnctl64 should be quite trivial as seen above.

if you want to more powerful ARM linux dev machine btw, oracle's free 4 core Ampere ARM servers are very fast, have tons of ram, and fast networking. its part of their always free tier of servers https://www.oracle.com/cloud/free/ . I have been using one personally for many months now. You can run a Ubuntu Bionic image on it btw

BenjaminSchaaf commented 5 months ago

Sublime Text 4174 was built from an ubuntu 16.04 image with GLIBC 2.23 - though the newest symbol we actually use is from 2.17. That covers all currently supported versions of Debian and RHEL; we won't be supporting older versions than that.