Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I use the SVN versions of both LFS and BLFS, so everything is pretty much on the bleeding edge. Because Firefox has required rustc for the past several releases, I keep rustc up to date.
Here's the problem: Using the supplied config.toml file per the instructions results in a failure when it comes time to build rustc_llvm, in particular the PassWrapper.cpp file. The error message is lengthy so I'll condense it down to just the salient portion:
Code:
cargo:warning=c++: error: unrecognized command line option '-Wcovered-switch-default'; did you mean '-Wno-switch-default'?
cargo:warning=c++: error: unrecognized command line option '-Wstring-conversion'; did you mean '-Wint-conversion'?
cargo:warning=c++: error: unrecognized command line option '-fcolor-diagnostics'
exit code 1
[...]
"../rustllvm/PassWrapper.cpp" with args "c++" did not execute successfully
Further research reveals that these compiler flags are applicable to clang++ and NOT GNU's c++. Evidently the mere presence of the LLVM-6.0 toolchain is sufficient to trigger the passing of these flags to the compiler, even if it's NOTclang++. There's some cmake trickery used to select these flags but it evidently doesn't account for GNU's compiler.
I've solved the problem by altering the BLFS build script by adding these commands just prior to invoking x.py:
Code:
export CC=clang
export CXX=clang++
In short, rather than trying to fight the battle of those LLVM-style flags being passed to the compiler, I've surrendered by just using the LLVM toolchain for the build.
All works well...rustc-1.25.0 builds and installs cleanly and as a result, the current Firefox-60.0 also builds and runs without error.
Since the LFS/BLFS authors are careful to test everything, I'm left wondering how rustc-1.25.0 gets built without making the change I cited?
Since the LFS/BLFS authors are careful to test everything, I'm left wondering how rustc-1.25.0 gets built without making the change I cited?
As a followup to my post, I've identified the source of the problem involving options passed to GNU's c++ that are only recognized by the LLVM toolchain. The ./src/librustc_llvm/build.rs file contains a call to llvm-config to request --cxxflags. With LLVM-6.0, those compiler flags include these options not recognized by the default system GNU compiler:
Hacking that build.rs file to skip those options permits a successful build without using clang++.
Still the question remains, how was a rustc-1.25.0 build possible without either hacking that one file or specifying CXX=clang++, neither of which are mentioned in the BLFS instructions? Has anyone has success building rustc by following the steps without the deviations I cited?
Has anyone has success building rustc by following the steps without the deviations I cited?
I compiled rustc without the above steps and then used it to compile firefox. I believe llvm is merely an option in the BLFS book and is not absolutely required. I have BLFS running without llvm on two machines, one with radeon and the other with nVidia pascal GPU. AFAIK, llvm is only needed to build certain gallium drivers. See this thread.
Last edited by plasmonics; 05-20-2018 at 11:29 AM.
I compiled rustc without the above steps and then used it to compile firefox. I believe llvm is merely an option in the BLFS book and is not absolutely required. [...] AFAIK, llvm is only needed to build certain gallium drivers.
I've been tracking LLVM ever since it was first introduced not because of needing video drivers but for, IMHO, the superior diagnostics clang++ has over GNU's c++. (Although recent versions of the GNU toolchain have been getting much better in this regard).
To the point of the thread, subsequent tests have confirmed that as long as LLVM-6.0.0 is installed, then it is necessary to prefix the x.py build script with CXX=clang++. The --cxxflags provided by llvm-config are not compatible with GNU's c++. Since the remedy is so simple, I'll just go ahead and mark this thread as SOLVED.
All my build scripts point to clang and clang++ for compiling unless it absolutely requires gcc and g++. No problems yet other than a problem with JFS as of recent with shutdowns, but otherwise, its been all good.
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616
Rep:
I don't bother building rustc from scratch because you really can't build it from scratch. There is no building rust without downloading a precompiled binary that acts as a bootstrap compiler. If you tried to build a rust package for a completely new processor you'd be SOL unless you wrote your own cross plugin for rustc first. IIRC The actual original rust compiler was written in LISP or some such and is no longer a viable option from what I understand. (No, I don't know why they call it rust(c) either, that whole project seems a bit scatter-brained in its implementation.) That being the case, I just use the curl based installer command on my lfsdev account, which is the one I use for building and installing packages.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.