atom icon indicating copy to clipboard operation
atom copied to clipboard

Linux atom build failing (Arch Linux)

Open Aligedchud opened this issue 2 years ago • 17 comments

Hello I am using Arch Linux, kernel version 6.1.3, everything is up to date

The Yay build is not working it has the error message as shown below: https://imgur.com/a/xYaHe2D

I tried the PKG-BUILD from the AUR link: https://aur.archlinux.org/atom-community-git.git to see if yay was broken After git cloning it and running command makepkg -f PKGBUILD I get the same error message

Aligedchud avatar Jan 07 '23 06:01 Aligedchud

maybe see https://github.com/atom-community/atom/issues/385?

icecream17 avatar Jan 07 '23 15:01 icecream17

The fix from #385 does not work when running script/bootstrap command I get this error: script/bootstrap is deprecated. Use node script/bootstrap.js instead Node: v19.3.0 Python: v3.10.9 Installing script runner dependencies Error: spawnSync npm ENOENT at Object.spawnSync (node:internal/child_process:1117:20) at spawnSync (node:child_process:871:24) at Object.execFileSync (node:child_process:914:15) at installScriptRunnerDependencies (/home/jj/atom/script/lib/install-script-runner-dependencies.js:9:16) at bootstrap (/home/jj/atom/script/bootstrap.js:40:3) at Object. (/home/jj/atom/script/bootstrap.js:64:1) at Module._compile (node:internal/modules/cjs/loader:1218:14) at Module._extensions..js (node:internal/modules/cjs/loader:1272:10) at Module.load (node:internal/modules/cjs/loader:1081:32) at Module._load (node:internal/modules/cjs/loader:922:12) I get the same error running the node script/bootstrap.js: Node: v19.3.0 Python: v3.10.9 Installing script runner dependencies Error: spawnSync npm ENOENT at Object.spawnSync (node:internal/child_process:1117:20) at spawnSync (node:child_process:871:24) at Object.execFileSync (node:child_process:914:15) at installScriptRunnerDependencies (/home/jj/atom/script/lib/install-script-runner-dependencies.js:9:16) at bootstrap (/home/jj/atom/script/bootstrap.js:40:3) at Object. (/home/jj/atom/script/bootstrap.js:64:1) at Module._compile (node:internal/modules/cjs/loader:1218:14) at Module._extensions..js (node:internal/modules/cjs/loader:1272:10) at Module.load (node:internal/modules/cjs/loader:1081:32) at Module._load (node:internal/modules/cjs/loader:922:12)

I also don't have the .atom folder or the node-modules in the atom/apm folder

Aligedchud avatar Jan 07 '23 19:01 Aligedchud

(Based on https://github.com/atom-community/atom/blob/master/script/bootstrap.cmd the deprecation error doesn't affect anything.)

This is purely a guess because the issue author says the build process has been simplified, but maybe your node version is too recent. Last I remember Atom used an old version of node (based on my build script, v14)

(The issue is still open so it seems this probably isn't really a solution.)

Though if you're just trying to download Atom (not build), there is https://github.com/atom-community/atom/blob/master/docs/Installation.md which is also mentioned in the issue.

icecream17 avatar Jan 08 '23 01:01 icecream17

The important bit of the error from the top of the post is

Error: There was a fatal error while downloading/extracting the tarball

I'm not sure what would cause that, but if it was just a corrupted download over the network, trying to run it again should resolve it.

The second error:

Error: spawnSync npm ENOENT

Says you have no npm executable on your system (Edit: Or at least no npm on the PATH in whatever context you're running the build from).

Please install npm on your system so it is accessible on the PATH somewhere. The build scripts for atom-community/atom download two copies of npm, one under script/node_modules, and one under script/script-runner/node_modules, but both of them need npm to be on your PATH and working in order to run. (So, you need both npm and node on your PATH somewhere, probably).


General note about Arch: The Arch build process sometimes tries to extract things like npm, node and electron into their own system packages, and various other changes from the build scripts as they're written here. Anyone providing steps to build that from AUR are putting their own custom steps together to do it "the Arch way". But these are not provided by maintainers here, and they are not guaranteed to work. Folks here may provide some help getting them to work, but the main way to build this repo is the scripts exactly as they are provided in this repo itself. This should hopefully "just work" on Arch, if you have the needed dependencies installed, but is not specifically tested on Arch.

DeeDeeG avatar Jan 08 '23 22:01 DeeDeeG

After I downloaded npm I ran the command node script/bootstrap.js and I get a different error: https://imgur.com/a/XfVRvlG

Aligedchud avatar Jan 09 '23 07:01 Aligedchud

@Aligedchud two things:

  • Please strongly prefer posting the errors as text rather than screenshots.
  • And please try again using the oldest still-supported NodeJS LTS release.
    • There might be some issues compiling native C/C++ addons in the codebase against newer NodeJS. For example, our older copy of node-gyp writes to process.config, which used to be allowed, but is now deprecated and apparently hard-removed in the latest NodeJS 19?? See this related issue: https://github.com/nodejs/node-gyp/pull/2368. The fix is in node-gyp 8.2.0 and later. But this project use node-gyp v5.x

You can post the error messages like this, if you want to avoid making super long posts that make it harder to scroll through the issue:

<details><summary>error message (click to expand):</summary>

$ command you ran
[output here ...]

</details>

Or post to a pastebin type of site, etc.

DeeDeeG avatar Jan 09 '23 22:01 DeeDeeG

@Aligedchud try building atom after setting the env variable below:

ATOM_ELECTRON_URL='https://artifacts.electronjs.org/headers/dist'

jonian avatar Jan 10 '23 23:01 jonian

Where do I set the env variable or what command would I or do I add it in the atom.sh

Aligedchud avatar Jan 14 '23 02:01 Aligedchud

If you use bash shell run the command below to build atom:

ATOM_ELECTRON_URL='https://artifacts.electronjs.org/headers/dist' script/build

If you use fish shell run the command below to build atom:

env ATOM_ELECTRON_URL='https://artifacts.electronjs.org/headers/dist' script/build

jonian avatar Jan 14 '23 08:01 jonian

I ran the command ATOM_ELECTRON_URL='https://artifacts.electronjs.org/headers/dist' script/build and the modules installed successfully but it skipped the install:

Skipping installation. Specify the --install option to install Atom

Node: v14.21.2 Python: v3.10.9 Installing script runner dependencies Installing script dependencies Installing apm apm 2.6.5-atomic.1.0 npm 6.14.18 node 12.18.3 x64 atom unknown python 3.10.9 git 2.39.0 Installing modules ✓

Wrote Dependencies Fingerprint: /home/jj/atom/node_modules/.dependencies-fingerprint 9ed133770aba4b33ffc58f81147c949f36cfb49d Cleaning /home/jj/atom/out Copying assets to /home/jj/atom/out/app Transpiling packages with custom transpiler configurations in /home/jj/atom/out/app Transpiling Babel paths in /home/jj/atom/out/app Transpiling CoffeeScript paths in /home/jj/atom/out/app Transpiling CSON paths in /home/jj/atom/out/app Transpiling PEG.js paths in /home/jj/atom/out/app Installing modules ✓ transpiling for package github Generating module cache for /home/jj/atom/out/app Generating pre-built less cache in /home/jj/atom/out/app/less-compile-cache Generating metadata for /home/jj/atom/out/app/package.json Generating API docs at /home/jj/atom/docs/output/atom-api.json Dumping symbols in /home/jj/atom/out/symbols

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error: Failed to write symbol file. . Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error: Failed to write symbol file. . Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error: Failed to write symbol file. . Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error: Failed to write symbol file. . Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error...

##[warning] Failed to dump the symbols via minidump. Error. Ignoring the error... Running electron-packager on /home/jj/atom/out/app with app name "atom" Packaging app for platform linux x64 using electron v11.5.0 Changing permissions for node files in /home/jj/atom/out/atom-dev-1.63.0-dev-336706c81-amd64 Copying non-ASAR resources to /home/jj/atom/out/atom-dev-1.63.0-dev-336706c81-amd64/resources Writing LICENSE.md to /home/jj/atom/out/atom-dev-1.63.0-dev-336706c81-amd64/resources Application bundle created at /home/jj/atom/out/atom-dev-1.63.0-dev-336706c81-amd64

Minifying startup script Verifying if snapshot can be executed via mksnapshot Generating startup blob with mksnapshot Moving generated startup blob into "/home/jj/atom/out/atom-dev-1.63.0-dev-336706c81-amd64/v8_context_snapshot.bin" Moving generated startup blob into "/home/jj/atom/out/atom-dev-1.63.0-dev-336706c81-amd64/snapshot_blob.bin" Skipping creating debian package. Specify the --create-debian-package option to create it. Skipping creating rpm package. Specify the --create-rpm-package option to create it. Skipping artifacts compression. Specify the --compress-artifacts option to compress Atom binaries (and symbols on macOS) Skipping installation. Specify the --install option to install Atom

Aligedchud avatar Jan 14 '23 19:01 Aligedchud

@Aligedchud atom was build successfully, you can run it using the executable created in the out directory. I don't recommend you use the --install option. If you want to install it on your system it is better to use a PKGBUILD.

jonian avatar Jan 14 '23 19:01 jonian

But if you want to install it using the atom scripts, use:

ATOM_ELECTRON_URL='https://artifacts.electronjs.org/headers/dist' script/build --install

jonian avatar Jan 14 '23 19:01 jonian

So if anyone wants to build and install atom on arch follow the steps below:

  1. Clone the repository
git clone https://github.com/atom-community/atom.git
  1. Build atom debian package
sudo pacman -S dpkg # required to build debian package

cd atom
ATOM_RELEASE_VERSION=1.63.0 ATOM_ELECTRON_URL='https://artifacts.electronjs.org/headers/dist' script/build --create-debian-package
  1. Create a PKGBUILD file in the out directory with the contents below:
pkgname="atom-bin"
pkgver=1.63.0
pkgrel=1
pkgdesc="Community build of the hackable text editor"
arch=("x86_64")
url="https://github.com/atom-community/atom"
license=("MIT")
depends=("libxkbfile" "ripgrep")
provides=("atom" "apm")
source=("atom-amd64.deb")
sha256sums=('SKIP')

prepare() {
  bsdtar xf data.tar.xz
}

package() {
  mv usr "$pkgdir"
}
  1. Build and install arch linux package
cd out
makepkg -si

jonian avatar Jan 14 '23 20:01 jonian

I did a clean clone of the atom.git and ran the commands above I get this after I run makepkg -si

==> Making package: atom-bin 1.63.0-1 (Sat 14 Jan 2023 10:26:04 PM CST) ==> Checking runtime dependencies... ==> Checking buildtime dependencies... ==> Retrieving sources... ==> ERROR: atom-amd64.deb was not found in the build directory and is not a URL.

what's in the atom.out dir:

app atom-1.63.9-amd64 PKGBUILD src startup.js symbols

PKGBUILD: pkgname="atom-bin" pkgver=1.63.0 pkgrel=1 pkgdesc="Community build of the hackable text editor" arch=("x86_64") url="https://github.com/atom-community/atom" license=("MIT") depends=("libxkbfile" "ripgrep") provides=("atom" "apm") source=("atom-amd64.deb") sha256sums=('SKIP')

prepare() { bsdtar xf data.tar.xz }

package() { mv usr "$pkgdir" }

Aligedchud avatar Jan 15 '23 04:01 Aligedchud

The build script did not create a debian package, make sure you have dpkg installed and redo steps 2-4:

sudo pacman -S dpkg

jonian avatar Jan 15 '23 08:01 jonian

I did all of the steps again and get this error at the makepkg -si command

❯ makepkg -si ==> Making package: atom-bin 1.63.0-1 (Tue 17 Jan 2023 06:05:18 PM CST) ==> Checking runtime dependencies... ==> Checking buildtime dependencies... ==> Retrieving sources... -> Found atom-amd64.deb ==> Validating source files with sha256sums... atom-amd64.deb ... Skipped ==> Extracting sources... -> Extracting atom-amd64.deb with bsdtar ==> Starting prepare()... bsdtar: Error opening archive: Failed to open 'data.tar.xz' ==> ERROR: A failure occurred in prepare().

Aligedchud avatar Jan 18 '23 00:01 Aligedchud

Slight tangent, but I want to mention this here: Now that https://github.com/atom-community/apm/pull/124 is merged, I do intend to update apm at this repo to include that fix, if that's alright.

I know more people watch this repo than the atom-community/apm repo, so I thought I'd mention it here before I try to do that.

DeeDeeG avatar Jan 20 '23 18:01 DeeDeeG