Tested under Linux?

What user account should this be installed under? I'm normally logged in as root (which there are legitimate arguments against). Your binaries got installed in /root/.cargo/bin. Not only was it not in the path, even after a reboot, but things in /root are off-limits to any other users, and some processes if they drop privileges. So I copied your binaries to /usr/bin or someplace in the path. Rustc worked.

Then I went back to trying to build Firefox 61.0 and it bombed with:

 7:05.54 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/intl/LineBreaker.h
 7:05.54 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/intl/WordBreaker.h
 7:05.55 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/RangeBoundary.h
 7:05.55 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/nsRFPService.h
 7:05.55 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/nsMediaFeatures.h
 7:05.55 --- stderr
 7:05.56 /usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/Compiler.h:49:12: fatal error: 'cstddef' file not found
 7:05.56 /usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/Compiler.h:49:12: fatal error: 'cstddef' file not found, err: true

Which seems to be a rust problem I think. So I was thinking copying the binaries probably wasn't good enough. So I did rustup self uninstall, deleted the copied binaries, logged in as a different user. Rebooted, rustc isn't in the path.

Googling the error I get some hits in the Mozilla dev stuff about this error message being related to rust but nothing terribly conclusive. Running Debian Buster, installed Rust by fetching the installer with Curl, used the defaults.

Locate shows I have cstddef at:
/usr/include/boost/compatibility/cpp_c_headers/cstddef
/usr/include/c++/7/cstddef
/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/system_wrappers/cstddef

rustup is meant to be run without root privileges. A typical install puts everything in the home directory. I actually don't know whether rustup can be used to manage a global installation of rust for multiple users, though based on this issue I'd say "not yet."

(interestingly: I am on arch, and I install rustup through package management. When I do this, rustup goes into /usr/bin, as do a bunch of symlinks for rustc and etc (all of which simply point to rustup). But the rust distributions installed through rustup are still per-user, and appear in $HOME/.cargo and $HOME/.rustup)


When you first ran rustup, you should have seen this (approximately)

It will add the cargo, rustc, rustup and other commands to Cargo's bin 
directory, located at:

  /root/.cargo/bin

This path will then be added to your PATH environment variable by modifying the
profile file located at:

  /root/.profile

I am a bit confused about the details of your story here, since it seems like a reboot should have done it (depending on how you are "logging in" as root; simply using su won't cut it, since .profile only runs on login shells IIRC). Fully console bound or SSH users can just log out and back in, while typically for people in an X environment, rebooting or restarting the session manager is necessary.

...but anyways, I'd just clean out the stuff it put in root, since it's not going to do anyone much good there.


Aside: I actually could've sworn rustup used to chastise the user if they ran it with root privileges.

1 Like

Hmm, I'm logging in right now with Lightdm I think, I'd rather boot to a command line but I haven't looked into it. I did a reboot and logged in as alan, the user I was logged in as when I installed this time.

 up64$ whoami
 alan
 up64$ echo $PATH
 /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/gimp210/bin
 up64$ pwd
 /home/alan
 up64$ cat .profile

 export PATH="$HOME/.cargo/bin:$PATH"
 up64$ rustc --version
 bash: rustc: command not found
 up64$ 

Maybe I see it, in /etc/bash.bashrc is PATH=$PATH:/usr/local/gimp210/bin (no quotes). I don't know which of $HOME/.profile and /etc/bash.bashrc gets run last but maybe bashrc clobbered profile.

As root my path right now is:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/gimp210/bin

But there's more involved than just paths I think, like a library or header isn't getting found. Rustc partly works. Most of the firefox build output (this time anyway) involves cargo, ending at

7:05.55 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/nsRFPService.h
7:05.55 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/nsMediaFeatures.h
7:05.55 --- stderr
7:05.56 /usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/Compiler.h:49:12: fatal error: 'cstddef' file not found
7:05.56 /usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/Compiler.h:49:12: fatal error: 'cstddef' file not found, err: true
7:05.79 thread '' panicked at 'Failed to generate bindings, flags: ["/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/ServoBindings.h", "--rust-target", "1.0", "--blacklist-type", "nsACString_internal", "--blacklist-type", "nsAString_internal", "--blacklist-type", "ComputedStyleBorrowed", "--blacklist-type", "ComputedStyleBorrowedOrNull", "--blacklist-type", "mozilla::css::GridTemplateAreasValue", "--blacklist-type", "mozilla::css::ErrorReporter", "--blacklist-type", "mozilla::css::ImageValue", "--blacklist-type", "mozilla::css::URLValue", "--blacklist-type", "mozilla::css::URLValueData", "--blacklist-type", "mozilla::dom::CallerType", "--blacklist-type", "mozilla::AnonymousCounterStyle", "--blacklist-type", "mozilla::AtomArray", "--blacklist-type", "mozilla::FontStretch",

cstddef may be a C++ file, I'm not sure.

OK, put quotes in /etc/bash.bashrc. As root my path is now:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/gimp210/bin:/home/alan/.cargo/bin:/usr/local/gimp210/bin:/home/alan/.cargo/bin

Not sure why some things are there twice but I'll fix it later. Now I get:

rustc --version
error: no default toolchain configured

What, in the rust context, constitutes a toolchain? Bear in mind I'm trying to get Firefox, not learn Rust. I was mildly curious and started reading, but a 2 megabyte "Hello world" cured that real fast. I could do it in maybe 100 bytes of x86 assembler. Well, 25 years ago, I don't remember that much.

Right now I'd rather play with Weston/Wayland which I just got my first glimpse of. My GTK3 built with a wayland backend. I'm on a Pi with VC4 graphics, probably any ATI or Nvidia card can do something similar.

In most X environments, you can press Alt+F1, Alt+F2, etc. (or on some systems it's Alt+Shift+Fn) to switch to plain TTY login consoles. I'm not sure exactly what part of the software stack provides this, but due to its wide prevalence I suspect the functionality is part of X11 itself. In any case, from there, you can log in as root directly. (root will need to have a password set; if it doesn't, I think you can set one up by simply su-ing to root and running passwd).

Do the following. This installs the stable toolchain and makes it the default:

$ rustup default stable
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2018-05-29, rust version 1.26.1 (827013a31 2018-05-25)
info: downloading component 'rustc'
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu installed - rustc 1.26.1 (827013a31 2018-05-25)

There are other choices of toolchains like beta (for prereleases) and nightly (the bleeding-edge), as well as specific versions (e.g. 1.20.0), or nightlies from a specific date. But according to this Mozilla page, firefox targets stable rust.

You can verify that the stable toolchain is used before building firefox (do this in the firefox directory):

$ rustc --version
rustc 1.26.1 (827013a31 2018-05-25)

Ah, OK.

default toolchain set to 'stable-aarch64-unknown-linux-gnu'

  stable-aarch64-unknown-linux-gnu installed - rustc 1.26.1 (827013a31 2018-05-25)
rustc --version
rustc 1.26.1 (827013a31 2018-05-25)

The Firefox build is pretty aggressive running multiple threads, makes it impossible to do anything else on the machine (Raspberry Pi). I'm pretty out of touch with the world while it's running. Expecting a Rock64 this morning actually.

Same thing happens. Doesn't find that cstddef file. Which is a c++ standard definitions file. C data types - Wikipedia I've been compiling mostly C++ for 2 days, it has to be there (/usr/include/c++/7/cstddef) but Rust has a problem with it.

6:26.41 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/ServoDeclarationBlock.h
 6:26.41 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/DeclarationBlock.h
 6:26.41 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/ServoTraversalStatistics.h
 6:26.42 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/SizeOfState.h
 6:26.42 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/nsCSSProps.h
 6:26.42 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/CSSPropFlags.h
 6:26.42 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/nsContentUtils.h
 6:26.43 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/dom/AutocompleteInfoBinding.h
 6:26.43 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/intl/LineBreaker.h
 6:26.43 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/intl/WordBreaker.h
 6:26.43 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/RangeBoundary.h
 6:26.44 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/nsRFPService.h
 6:26.44 cargo:rerun-if-changed=/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/nsMediaFeatures.h
 6:26.44 --- stderr
 6:26.45 /usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/Compiler.h:49:12: fatal error: 'cstddef' file not found
 6:26.45 /usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/Compiler.h:49:12: fatal error: 'cstddef' file not found, err: true
 6:26.65 thread '<unnamed>' panicked at 'Failed to generate bindings, flags: ["/usr/src/misc/firefox/firefox-61.0/obj-aarch64-unknown-linux-gnu/dist/include/mozilla/ServoBindings.h", "--rust-target", "1.0", "--blacklist-type", "nsACString_internal", "--blacklist-type", "nsAString_internal", "--blacklist-type", "ComputedStyleBorrowed", "--blacklist-type", "ComputedStyleBorrowedOrNull", "--blacklist-type", "mozilla::css::GridTemplateAreasValue", "--blacklist-type", "mozilla::css::ErrorReporter", "--blacklist-type", "mozilla::css::ImageValue", "--blacklist-type", "mozilla::css::URLValue", "--blacklist-type", "mozilla::css::URLValueData", "--blacklist-type", "mozilla::dom::CallerType", "--blacklist-type", "mozilla::AnonymousCounterStyle", "--blacklist-type", "mozilla::AtomArray", "--blacklist-type", "mozilla::FontStretch", "--blacklist-type", "mozilla::FontSlantStyle", "--blacklist-type", "mozilla::FontWeight", "--blacklist-type", "mozilla::MallocSizeOf", "--blacklist-type", ...

Actually I'm not sure how the information gets passed around: I have GCC 6,7 & 8 installed, by locate only 7 has a cstddef file. 7 is the one Firefox wanted.

I can't help with the rust debugging, but I'd like to contribute some expectation management re:

Firefox is a massive piece of software, probably amongst the biggest pieces of source code a desktop user will ever touch, and easily in the same ballpark as the (extended) Linux kernel.
There is a reason that Mozilla dedicates entire farms of distributed high-powered machines to compiling its own internal builds.
Raspberry pis might be very powerful when compared to Arduino, but hopelessly anemic compared to the average build server/workstation.
Pi's already struggle with a graphical desktop+webbrowser even when they don't do anything extra..

There should be CLI arguments to reduce the number of compilation threads somewhere in the Firefox build system, but expecting interactive use on a pi, while also running compilations, is unrealistic.

1 Like